v0.2.4: moved loot and continue tags to bottom right, much more accessable

This commit is contained in:
Evan Debenham 2015-02-08 02:45:05 -05:00
parent 89d72e60d1
commit 071403a7aa
4 changed files with 50 additions and 47 deletions

View File

@ -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() {

View File

@ -31,7 +31,7 @@ public class LootIndicator extends Tag {
public LootIndicator() {
super( 0x1F75CC );
setSize( 24, 22 );
setSize( 24, 24 );
visible = false;
}

View File

@ -14,7 +14,7 @@ public class ResumeIndicator extends Tag {
public ResumeIndicator() {
super(0xCDD5C0);
setSize( 24, 22 );
setSize( 24, 24 );
visible = false;

View File

@ -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) {