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

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

parent 58be33a6
...@@ -214,7 +214,9 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -214,7 +214,9 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
*/ */
public class StartButton extends Entity { public class StartButton extends Entity {
private boolean enabled = true; private static final float BUTTON_BLINK_DELAY = 0.3f;
private boolean enabled = true;
private Entity backgroundLayer; private Entity backgroundLayer;
private Entity blinkerLayer; private Entity blinkerLayer;
...@@ -226,7 +228,6 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -226,7 +228,6 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
private Sprite unpressedButtonSprite; private Sprite unpressedButtonSprite;
private Sprite disabledButtonSprite; private Sprite disabledButtonSprite;
private Sprite blinkerButtonSprite;
private Text buttonText; private Text buttonText;
private float textUnpressedPositionX; private float textUnpressedPositionX;
...@@ -249,10 +250,6 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -249,10 +250,6 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
// backgrounds // backgrounds
unpressedButtonSprite = new Sprite(0, 0, ResourceManager.getInstance().getTexture(ResourceManager.CONTROL_START_UNPRESSED), vertexBufferObject); 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); 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 // touch area
touchArea = new Rectangle(0, 0, unpressedButtonSprite.getWidth(), unpressedButtonSprite.getHeight(), vertexBufferObject) { touchArea = new Rectangle(0, 0, unpressedButtonSprite.getWidth(), unpressedButtonSprite.getHeight(), vertexBufferObject) {
...@@ -294,22 +291,21 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener ...@@ -294,22 +291,21 @@ public class PotmeActivity extends GameActivity implements TileMapClickListener
} }
public void enablePulsing() { public void enablePulsing() {
FadeInModifier fadeIn = new FadeInModifier(1f); FadeInModifier fadeIn = new FadeInModifier(BUTTON_BLINK_DELAY);
fadeIn.setAutoUnregisterWhenFinished(true); fadeIn.setAutoUnregisterWhenFinished(true);
FadeOutModifier fadeOut = new FadeOutModifier(1f); FadeOutModifier fadeOut = new FadeOutModifier(BUTTON_BLINK_DELAY);
fadeOut.setAutoUnregisterWhenFinished(true); fadeOut.setAutoUnregisterWhenFinished(true);
SequenceEntityModifier sequenceModifier = new SequenceEntityModifier(fadeOut, fadeIn); SequenceEntityModifier sequenceModifier = new SequenceEntityModifier(fadeOut, fadeIn);
sequenceModifier.setAutoUnregisterWhenFinished(true); sequenceModifier.setAutoUnregisterWhenFinished(true);
blinkerModifier = new LoopEntityModifier(sequenceModifier); blinkerModifier = new LoopEntityModifier(sequenceModifier);
blinkerButtonSprite.registerEntityModifier(blinkerModifier); unpressedButtonSprite.registerEntityModifier(blinkerModifier);
} }
public void disablePulsing() { public void disablePulsing() {
if (blinkerModifier != null) { if (blinkerModifier != null) {
blinkerButtonSprite.unregisterEntityModifier(blinkerModifier); unpressedButtonSprite.unregisterEntityModifier(blinkerModifier);
blinkerModifier = null; blinkerModifier = null;
} }
blinkerButtonSprite.setAlpha(0);
} }
public boolean isEnbleda() { public boolean isEnbleda() {
......
...@@ -84,7 +84,6 @@ public class ResourceManager { ...@@ -84,7 +84,6 @@ public class ResourceManager {
public static final String CONTROL_NEXT = ASSET_CONTROL + "next.png"; 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_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_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_ACTUAL = ASSET_CONTROL + "actual.png";
public static final String CONTROL_KEY = ASSET_CONTROL + "key_icon.png"; public static final String CONTROL_KEY = ASSET_CONTROL + "key_icon.png";
...@@ -104,7 +103,6 @@ public class ResourceManager { ...@@ -104,7 +103,6 @@ public class ResourceManager {
public static final String INFO_SAFE1 = ASSET_INFO + "safe1.png"; 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_SAFE2 = ASSET_INFO + "safe2.png";
public static final String INFO_START_ARROW = ASSET_INFO + "start_arrow.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/"; private static final String ASSET_SFX_SOURCE = ASSET_GAME + "sfx/";
...@@ -207,7 +205,6 @@ public class ResourceManager { ...@@ -207,7 +205,6 @@ public class ResourceManager {
loadTexture(engine, context, CONTROL_NEXT); loadTexture(engine, context, CONTROL_NEXT);
loadTexture(engine, context, CONTROL_START_UNPRESSED); loadTexture(engine, context, CONTROL_START_UNPRESSED);
loadTexture(engine, context, CONTROL_START_DISABLED); loadTexture(engine, context, CONTROL_START_DISABLED);
loadTexture(engine, context, CONTROL_START_BLINKER);
loadTexture(engine, context, CONTROL_ACTUAL); loadTexture(engine, context, CONTROL_ACTUAL);
loadTexture(engine, context, CONTROL_KEY); loadTexture(engine, context, CONTROL_KEY);
...@@ -224,7 +221,6 @@ public class ResourceManager { ...@@ -224,7 +221,6 @@ public class ResourceManager {
loadTexture(engine, context, INFO_SAFE1); loadTexture(engine, context, INFO_SAFE1);
loadTexture(engine, context, INFO_SAFE2); loadTexture(engine, context, INFO_SAFE2);
loadTexture(engine, context, INFO_START_ARROW); loadTexture(engine, context, INFO_START_ARROW);
loadTexture(engine, context, INFO_START_ARROW_BLINKER);
SoundFactory.setAssetBasePath(ASSET_SFX_SOURCE); SoundFactory.setAssetBasePath(ASSET_SFX_SOURCE);
......
...@@ -90,7 +90,7 @@ public class ActionsWidget extends Entity implements ActionListener { ...@@ -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 float TUTORIAL_INFO_ARROW_FADEIN_DELAY = 0.5f;
private static final int TOP_Z_INDEX = ActionType.values().length + 1; private static final int TOP_Z_INDEX = ActionType.values().length + 1;
private static final float BACKGROUND_WIDTH_RATIO = 1.3f; private static final float BACKGROUND_WIDTH_RATIO = 1.3f;
...@@ -317,17 +317,8 @@ public class ActionsWidget extends Entity implements ActionListener { ...@@ -317,17 +317,8 @@ public class ActionsWidget extends Entity implements ActionListener {
ResourceManager.getInstance().getTexture(ResourceManager.INFO_START_ARROW), ResourceManager.getInstance().getTexture(ResourceManager.INFO_START_ARROW),
vertexBufferObjectManager); 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); infoArrowSprite.setAlpha(0);
infoArrowBlinkerSprite.setAlpha(0);
ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowSprite); ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowSprite);
ActionLayer.INFO_LAYER.getLayerEntity().attachChild(infoArrowBlinkerSprite);
FadeInModifier fadeIn = new FadeInModifier(TUTORIAL_INFO_ARROW_BLINK_DURATION); FadeInModifier fadeIn = new FadeInModifier(TUTORIAL_INFO_ARROW_BLINK_DURATION);
fadeIn.setAutoUnregisterWhenFinished(true); fadeIn.setAutoUnregisterWhenFinished(true);
...@@ -342,10 +333,7 @@ public class ActionsWidget extends Entity implements ActionListener { ...@@ -342,10 +333,7 @@ public class ActionsWidget extends Entity implements ActionListener {
@Override @Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) { public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
FadeInModifier fadeInModifier = new FadeInModifier(TUTORIAL_INFO_ARROW_FADEIN_DELAY); infoArrowSprite.registerEntityModifier(new LoopEntityModifier(sequenceModifier));
fadeInModifier.setAutoUnregisterWhenFinished(true);
infoArrowSprite.registerEntityModifier(fadeInModifier);
infoArrowBlinkerSprite.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