From 071403a7aa8d3dd857ea9ca1f66c28e9082ce1f5 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 8 Feb 2015 02:45:05 -0500 Subject: [PATCH] v0.2.4: moved loot and continue tags to bottom right, much more accessable --- .../scenes/GameScene.java | 51 +++++++++++++++++-- .../ui/LootIndicator.java | 2 +- .../ui/ResumeIndicator.java | 2 +- .../shatteredpixeldungeon/ui/StatusPane.java | 42 +-------------- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 7cda93884..569b8af11 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -20,6 +20,8 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import java.io.IOException; import com.shatteredpixel.shatteredpixeldungeon.*; +import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator; +import com.shatteredpixel.shatteredpixeldungeon.ui.ResumeIndicator; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; import com.watabou.noosa.Group; @@ -106,6 +108,10 @@ public class GameScene extends PixelScene { private Toolbar toolbar; private Toast prompt; + + private AttackIndicator attack; + private LootIndicator loot; + private ResumeIndicator resume; @Override public void create() { @@ -212,13 +218,23 @@ public class GameScene extends PixelScene { toolbar.setRect( 0,uiCamera.height - toolbar.height(), uiCamera.width, toolbar.height() ); add( toolbar ); - AttackIndicator attack = new AttackIndicator(); + attack = new AttackIndicator(); attack.camera = uiCamera; - attack.setPos( - uiCamera.width - attack.width(), + attack.setPos( + uiCamera.width - attack.width(), toolbar.top() - attack.height() ); add( attack ); - + + loot = new LootIndicator(); + loot.camera = uiCamera; + add( loot ); + + resume = new ResumeIndicator(); + resume.camera = uiCamera; + add( resume ); + + layoutTags(); + log = new GameLog(); log.camera = uiCamera; log.setRect( 0, toolbar.top(), attack.left(), 0 ); @@ -330,9 +346,36 @@ public class GameScene extends PixelScene { if (Dungeon.hero.ready && !Dungeon.hero.paralysed) { log.newLine(); } + + if (tagAttack != attack.active || tagLoot != loot.visible || tagResume != resume.visible) { + + tagAttack = attack.active; + tagLoot = loot.visible; + tagResume = resume.visible; + + layoutTags(); + } cellSelector.enabled = Dungeon.hero.ready; } + + private boolean tagAttack = false; + private boolean tagLoot = false; + private boolean tagResume = false; + + private void layoutTags() { + + float pos = tagAttack ? attack.top() : toolbar.top(); + + if (tagLoot) { + loot.setPos( uiCamera.width - loot.width(), pos - loot.height() ); + pos = loot.top(); + } + + if (tagResume) { + resume.setPos( uiCamera.width - resume.width(), pos - resume.height() ); + } + } @Override protected void onBackPressed() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java index c8430154d..b0851a524 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/LootIndicator.java @@ -31,7 +31,7 @@ public class LootIndicator extends Tag { public LootIndicator() { super( 0x1F75CC ); - setSize( 24, 22 ); + setSize( 24, 24 ); visible = false; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java index 4cc673e64..24e988f56 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java @@ -14,7 +14,7 @@ public class ResumeIndicator extends Tag { public ResumeIndicator() { super(0xCDD5C0); - setSize( 24, 22 ); + setSize( 24, 24 ); visible = false; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index 1e1325866..2336f7e0b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -57,8 +57,6 @@ public class StatusPane extends Component { private BitmapText keys; private DangerIndicator danger; - private ResumeIndicator resume; - private LootIndicator loot; private BuffIndicator buffs; private Compass compass; @@ -120,12 +118,6 @@ public class StatusPane extends Component { danger = new DangerIndicator(); add( danger ); - loot = new LootIndicator(); - add( loot ); - - resume = new ResumeIndicator(); - add ( resume ); - buffs = new BuffIndicator( Dungeon.hero ); add( buffs ); } @@ -151,49 +143,17 @@ public class StatusPane extends Component { keys.y = 6; - layoutTags(); + danger.setPos( width - danger.width(), 18 ); buffs.setPos( 32, 11 ); btnMenu.setPos( width - btnMenu.width(), 1 ); } - private void layoutTags() { - - float pos = 18; - - if (tagDanger) { - danger.setPos( width - danger.width(), pos ); - pos = danger.bottom() + 1; - } - - if (tagLoot) { - loot.setPos( width - loot.width(), pos ); - pos = loot.bottom() + 1; - } - - if (tagResume) { - resume.setPos( width - resume.width(), pos ); - } - } - - private boolean tagDanger = false; - private boolean tagLoot = false; - private boolean tagResume = false; - @Override public void update() { super.update(); - if (tagDanger != danger.visible || tagLoot != loot.visible || tagResume != resume.visible) { - - tagDanger = danger.visible; - tagLoot = loot.visible; - tagResume = resume.visible; - - layoutTags(); - } - float health = (float)Dungeon.hero.HP / Dungeon.hero.HT; if (health == 0) {