v1.2.0: refactored various code around status pane
This commit is contained in:
parent
632ae6cca0
commit
3f0a2ad1a3
|
@ -79,7 +79,7 @@ import com.shatteredpixel.shatteredpixeldungeon.tiles.WallBlockingTilemap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Banner;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Banner;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BusyIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.BossHealthBar;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CharHealthIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CharHealthIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||||
|
@ -143,12 +143,11 @@ public class GameScene extends PixelScene {
|
||||||
|
|
||||||
private MenuPane menu;
|
private MenuPane menu;
|
||||||
private StatusPane status;
|
private StatusPane status;
|
||||||
|
|
||||||
|
private BossHealthBar boss;
|
||||||
|
|
||||||
private GameLog log;
|
private GameLog log;
|
||||||
|
|
||||||
private BusyIndicator busy;
|
|
||||||
private CircleArc counter;
|
|
||||||
|
|
||||||
private static CellSelector cellSelector;
|
private static CellSelector cellSelector;
|
||||||
|
|
||||||
private Group terrain;
|
private Group terrain;
|
||||||
|
@ -357,8 +356,13 @@ public class GameScene extends PixelScene {
|
||||||
|
|
||||||
status = new StatusPane();
|
status = new StatusPane();
|
||||||
status.camera = uiCamera;
|
status.camera = uiCamera;
|
||||||
status.setSize( uiCamera.width, 0 );
|
status.setRect(0, 0, uiCamera.width, 0 );
|
||||||
add(status);
|
add(status);
|
||||||
|
|
||||||
|
boss = new BossHealthBar();
|
||||||
|
boss.camera = uiCamera;
|
||||||
|
boss.setPos( 6 + (uiCamera.width - boss.width())/2, 20);
|
||||||
|
add(boss);
|
||||||
|
|
||||||
toolbar = new Toolbar();
|
toolbar = new Toolbar();
|
||||||
toolbar.camera = uiCamera;
|
toolbar.camera = uiCamera;
|
||||||
|
@ -387,17 +391,6 @@ public class GameScene extends PixelScene {
|
||||||
add( log );
|
add( log );
|
||||||
|
|
||||||
layoutTags();
|
layoutTags();
|
||||||
|
|
||||||
busy = new BusyIndicator();
|
|
||||||
busy.camera = uiCamera;
|
|
||||||
busy.x = 1;
|
|
||||||
busy.y = status.bottom() + 1;
|
|
||||||
add( busy );
|
|
||||||
|
|
||||||
counter = new CircleArc(18, 4.25f);
|
|
||||||
counter.color( 0x808080, true );
|
|
||||||
counter.camera = uiCamera;
|
|
||||||
counter.show(this, busy.center(), 0f);
|
|
||||||
|
|
||||||
switch (InterlevelScene.mode) {
|
switch (InterlevelScene.mode) {
|
||||||
case RESURRECT:
|
case RESURRECT:
|
||||||
|
@ -693,8 +686,6 @@ public class GameScene extends PixelScene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
counter.setSweep((1f - Actor.now()%1f)%1f);
|
|
||||||
|
|
||||||
if (Dungeon.hero.ready && Dungeon.hero.paralysed == 0) {
|
if (Dungeon.hero.ready && Dungeon.hero.paralysed == 0) {
|
||||||
log.newLine();
|
log.newLine();
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class BossHealthBar extends Component {
|
||||||
private static BossHealthBar instance;
|
private static BossHealthBar instance;
|
||||||
private static boolean bleeding;
|
private static boolean bleeding;
|
||||||
|
|
||||||
BossHealthBar() {
|
public BossHealthBar() {
|
||||||
super();
|
super();
|
||||||
visible = active = (boss != null);
|
visible = active = (boss != null);
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
|
@ -25,6 +25,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.effects.CircleArc;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
|
||||||
|
@ -65,8 +67,6 @@ public class StatusPane extends Component {
|
||||||
|
|
||||||
private Image exp;
|
private Image exp;
|
||||||
|
|
||||||
private BossHealthBar bossHP;
|
|
||||||
|
|
||||||
private int lastLvl = -1;
|
private int lastLvl = -1;
|
||||||
|
|
||||||
private BitmapText level;
|
private BitmapText level;
|
||||||
|
@ -74,6 +74,9 @@ public class StatusPane extends Component {
|
||||||
private BuffIndicator buffs;
|
private BuffIndicator buffs;
|
||||||
private Compass compass;
|
private Compass compass;
|
||||||
|
|
||||||
|
private BusyIndicator busy;
|
||||||
|
private CircleArc counter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createChildren() {
|
protected void createChildren() {
|
||||||
|
|
||||||
|
@ -118,15 +121,19 @@ public class StatusPane extends Component {
|
||||||
exp = new Image( Assets.Interfaces.XP_BAR );
|
exp = new Image( Assets.Interfaces.XP_BAR );
|
||||||
add( exp );
|
add( exp );
|
||||||
|
|
||||||
bossHP = new BossHealthBar();
|
|
||||||
add( bossHP );
|
|
||||||
|
|
||||||
level = new BitmapText( PixelScene.pixelFont);
|
level = new BitmapText( PixelScene.pixelFont);
|
||||||
level.hardlight( 0xFFFFAA );
|
level.hardlight( 0xFFFFAA );
|
||||||
add( level );
|
add( level );
|
||||||
|
|
||||||
buffs = new BuffIndicator( Dungeon.hero, false );
|
buffs = new BuffIndicator( Dungeon.hero, false );
|
||||||
add( buffs );
|
add( buffs );
|
||||||
|
|
||||||
|
busy = new BusyIndicator();
|
||||||
|
add( busy );
|
||||||
|
|
||||||
|
counter = new CircleArc(18, 4.25f);
|
||||||
|
counter.color( 0x808080, true );
|
||||||
|
counter.show(this, busy.center(), 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,6 +141,8 @@ public class StatusPane extends Component {
|
||||||
|
|
||||||
height = 32;
|
height = 32;
|
||||||
|
|
||||||
|
bg.x = x;
|
||||||
|
bg.y = y;
|
||||||
bg.size( width, bg.height );
|
bg.size( width, bg.height );
|
||||||
|
|
||||||
avatar.x = bg.x + 15 - avatar.width / 2f;
|
avatar.x = bg.x + 15 - avatar.width / 2f;
|
||||||
|
@ -144,8 +153,8 @@ public class StatusPane extends Component {
|
||||||
compass.y = avatar.y + avatar.height / 2f - compass.origin.y;
|
compass.y = avatar.y + avatar.height / 2f - compass.origin.y;
|
||||||
PixelScene.align(compass);
|
PixelScene.align(compass);
|
||||||
|
|
||||||
hp.x = shieldedHP.x = rawShielding.x = 30;
|
hp.x = shieldedHP.x = rawShielding.x = x + 30;
|
||||||
hp.y = shieldedHP.y = rawShielding.y = 3;
|
hp.y = shieldedHP.y = rawShielding.y = y + 3;
|
||||||
|
|
||||||
hpText.scale.set(PixelScene.align(0.5f));
|
hpText.scale.set(PixelScene.align(0.5f));
|
||||||
hpText.x = hp.x + 1;
|
hpText.x = hp.x + 1;
|
||||||
|
@ -153,9 +162,12 @@ public class StatusPane extends Component {
|
||||||
hpText.y -= 0.001f; //prefer to be slightly higher
|
hpText.y -= 0.001f; //prefer to be slightly higher
|
||||||
PixelScene.align(hpText);
|
PixelScene.align(hpText);
|
||||||
|
|
||||||
bossHP.setPos( 6 + (width - bossHP.width())/2, 20);
|
buffs.setPos( x + 31, y + 9 );
|
||||||
|
|
||||||
buffs.setPos( 31, 9 );
|
busy.x = x + 1;
|
||||||
|
busy.y = y + 33;
|
||||||
|
|
||||||
|
counter.point(busy.center());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int[] warningColors = new int[]{0x660000, 0xCC0000, 0x660000};
|
private static final int[] warningColors = new int[]{0x660000, 0xCC0000, 0x660000};
|
||||||
|
@ -202,8 +214,8 @@ public class StatusPane extends Component {
|
||||||
lastLvl = Dungeon.hero.lvl;
|
lastLvl = Dungeon.hero.lvl;
|
||||||
level.text( Integer.toString( lastLvl ) );
|
level.text( Integer.toString( lastLvl ) );
|
||||||
level.measure();
|
level.measure();
|
||||||
level.x = 27.5f - level.width() / 2f;
|
level.x = x + 27.5f - level.width() / 2f;
|
||||||
level.y = 28.0f - level.baseLine() / 2f;
|
level.y = y + 28.0f - level.baseLine() / 2f;
|
||||||
PixelScene.align(level);
|
PixelScene.align(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +224,8 @@ public class StatusPane extends Component {
|
||||||
lastTier = tier;
|
lastTier = tier;
|
||||||
avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
|
avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
counter.setSweep((1f - Actor.now()%1f)%1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showStarParticles(){
|
public void showStarParticles(){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user