Commit 3dc7a6e9 authored by Matyáš Latner's avatar Matyáš Latner

#83 Úprava rychlosti a stylu blikání šipek nápovědy

parent 58be33a6
......@@ -214,6 +214,8 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
*/
public class StartButton extends Entity {
private static final float BUTTON_BLINK_DELAY = 0.3f;
private boolean enabled = true;
private Entity backgroundLayer;
......@@ -226,7 +228,6 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private Sprite unpressedButtonSprite;
private Sprite disabledButtonSprite;
private Sprite blinkerButtonSprite;
private Text buttonText;
private float textUnpressedPositionX;
......@@ -249,10 +250,6 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
// backgrounds
unpressedButtonSprite = new Sprite(0, 0, ResourceManager.getInstance().getTexture(ResourceManager.CONTROL_START_UNPRESSED), vertexBufferObject);
disabledButtonSprite = new Sprite(0, 0, ResourceManager.getInstance().getTexture(ResourceManager.CONTROL_START_DISABLED), vertexBufferObject);
blinkerButtonSprite = new Sprite(0, 0, ResourceManager.getInstance().getTexture(ResourceManager.CONTROL_START_BLINKER), vertexBufferObject);
disablePulsing();
blinkerLayer.attachChild(blinkerButtonSprite);
// touch area
touchArea = new Rectangle(0, 0, unpressedButtonSprite.getWidth(), unpressedButtonSprite.getHeight(), vertexBufferObject) {
......@@ -294,22 +291,21 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
}
public void enablePulsing() {
FadeInModifier fadeIn = new FadeInModifier(1f);
FadeInModifier fadeIn = new FadeInModifier(BUTTON_BLINK_DELAY);
fadeIn.setAutoUnregisterWhenFinished(true);
FadeOutModifier fadeOut = new FadeOutModifier(1f);
FadeOutModifier fadeOut = new FadeOutModifier(BUTTON_BLINK_DELAY);
fadeOut.setAutoUnregisterWhenFinished(true);
SequenceEntityModifier sequenceModifier = new SequenceEntityModifier(fadeOut, fadeIn);
sequenceModifier.setAutoUnregisterWhenFinished(true);
blinkerModifier = new LoopEntityModifier(sequenceModifier);
blinkerButtonSprite.registerEntityModifier(blinkerModifier);
unpressedButtonSprite.registerEntityModifier(blinkerModifier);
}
public void disablePulsing() {
if (blinkerModifier != null) {
blinkerButtonSprite.unregisterEntityModifier(blinkerModifier);
unpressedButtonSprite.unregisterEntityModifier(blinkerModifier);
blinkerModifier = null;
}
blinkerButtonSprite.setAlpha(0);
}
public boolean isEnbleda() {
......
......@@ -84,7 +84,6 @@ public class ResourceManager {
public static final String CONTROL_NEXT = ASSET_CONTROL + "next.png";
public static final String CONTROL_START_UNPRESSED = ASSET_CONTROL + "start_button_unpressed.png";
public static final String CONTROL_START_DISABLED = ASSET_CONTROL + "start_button_disabled.png";
public static final String CONTROL_START_BLINKER = ASSET_CONTROL + "start_button_blinker.png";
public static final String CONTROL_ACTUAL = ASSET_CONTROL + "actual.png";
public static final String CONTROL_KEY = ASSET_CONTROL + "key_icon.png";
......@@ -104,7 +103,6 @@ public class ResourceManager {
public static final String INFO_SAFE1 = ASSET_INFO + "safe1.png";
public static final String INFO_SAFE2 = ASSET_INFO + "safe2.png";
public static final String INFO_START_ARROW = ASSET_INFO + "start_arrow.png";
public static final String INFO_START_ARROW_BLINKER = ASSET_INFO + "start_arrow_blinker.png";
private static final String ASSET_SFX_SOURCE = ASSET_GAME + "sfx/";
......@@ -207,7 +205,6 @@ public class ResourceManager {
loadTexture(engine, context, CONTROL_NEXT);
loadTexture(engine, context, CONTROL_START_UNPRESSED);
loadTexture(engine, context, CONTROL_START_DISABLED);
loadTexture(engine, context, CONTROL_START_BLINKER);
loadTexture(engine, context, CONTROL_ACTUAL);
loadTexture(engine, context, CONTROL_KEY);
......@@ -224,7 +221,6 @@ public class ResourceManager {
loadTexture(engine, context, INFO_SAFE1);
loadTexture(engine, context, INFO_SAFE2);
loadTexture(engine, context, INFO_START_ARROW);
loadTexture(engine, context, INFO_START_ARROW_BLINKER);
SoundFactory.setAssetBasePath(ASSET_SFX_SOURCE);
......
......@@ -90,7 +90,7 @@ public class ActionsWidget extends Entity implements ActionListener {
}
}
private static final float TUTORIAL_INFO_ARROW_BLINK_DURATION = 1f;
private static final float TUTORIAL_INFO_ARROW_BLINK_DURATION = 0.3f;
private static final float TUTORIAL_INFO_ARROW_FADEIN_DELAY = 0.5f;
private static final int TOP_Z_INDEX = ActionType.values().length + 1;
private static final float BACKGROUND_WIDTH_RATIO = 1.3f;
......@@ -317,17 +317,8 @@ public class ActionsWidget extends Entity implements ActionListener {
ResourceManager.getInstance().getTexture(ResourceManager.INFO_START_ARROW),
vertexBufferObjectManager);
final Sprite infoArrowBlinkerSprite = new Sprite(positionX + START_ARROW_X_OFFSET,
positionY - START_ARROW_Y_OFFSET,
START_ARROW_WIDTH,
START_ARROW_HEIGHT,
ResourceManager.getInstance().getTexture(ResourceManager.INFO_START_ARROW_BLINKER),
vertexBufferObjectManager);
infoArrowSprite.setAlpha(0);
infoArrowBlinkerSprite.setAlpha(0);
ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowSprite);
ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowBlinkerSprite);
FadeInModifier fadeIn = new FadeInModifier(TUTORIAL_INFO_ARROW_BLINK_DURATION);
fadeIn.setAutoUnregisterWhenFinished(true);
......@@ -342,10 +333,7 @@ public class ActionsWidget extends Entity implements ActionListener {
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
FadeInModifier fadeInModifier = new FadeInModifier(TUTORIAL_INFO_ARROW_FADEIN_DELAY);
fadeInModifier.setAutoUnregisterWhenFinished(true);
infoArrowSprite.registerEntityModifier(fadeInModifier);
infoArrowBlinkerSprite.registerEntityModifier(new LoopEntityModifier(sequenceModifier));
infoArrowSprite.registerEntityModifier(new LoopEntityModifier(sequenceModifier));
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment