cleaned up formatting:

- removed trailing whitespace
- changed all leading whitespace to tabs
- removed IDE created author comments
This commit is contained in:
Evan Debenham
2015-06-12 16:22:26 -04:00
parent baa83b7e43
commit cebdff0221
335 changed files with 8555 additions and 8714 deletions
@@ -24,50 +24,50 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
public class Archs extends Component {
private static final float SCROLL_SPEED = 20f;
private static final float SCROLL_SPEED = 20f;
private SkinnedBlock arcsBg;
private SkinnedBlock arcsFg;
private SkinnedBlock arcsBg;
private SkinnedBlock arcsFg;
private static float offsB = 0;
private static float offsF = 0;
private static float offsB = 0;
private static float offsF = 0;
public boolean reversed = false;
public boolean reversed = false;
@Override
protected void createChildren() {
arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG );
arcsBg.offsetTo( 0, offsB );
add( arcsBg );
@Override
protected void createChildren() {
arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG );
arcsBg.offsetTo( 0, offsB );
add( arcsBg );
arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG );
arcsFg.offsetTo( 0, offsF );
add( arcsFg );
}
arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG );
arcsFg.offsetTo( 0, offsF );
add( arcsFg );
}
@Override
protected void layout() {
arcsBg.size( width, height );
arcsBg.offset( arcsBg.texture.width / 4 - (width % arcsBg.texture.width) / 2, 0 );
@Override
protected void layout() {
arcsBg.size( width, height );
arcsBg.offset( arcsBg.texture.width / 4 - (width % arcsBg.texture.width) / 2, 0 );
arcsFg.size( width, height );
arcsFg.offset( arcsFg.texture.width / 4 - (width % arcsFg.texture.width) / 2, 0 );
}
arcsFg.size( width, height );
arcsFg.offset( arcsFg.texture.width / 4 - (width % arcsFg.texture.width) / 2, 0 );
}
@Override
public void update() {
@Override
public void update() {
super.update();
super.update();
float shift = Game.elapsed * SCROLL_SPEED;
if (reversed) {
shift = -shift;
}
float shift = Game.elapsed * SCROLL_SPEED;
if (reversed) {
shift = -shift;
}
arcsBg.offset( 0, shift );
arcsFg.offset( 0, shift * 2 );
arcsBg.offset( 0, shift );
arcsFg.offset( 0, shift * 2 );
offsB = arcsBg.offsetY();
offsF = arcsFg.offsetY();
}
offsB = arcsBg.offsetY();
offsF = arcsFg.offsetY();
}
}
@@ -66,7 +66,7 @@ public class AttackIndicator extends Tag {
sprite.y = y + (height - sprite.height()) / 2;
PixelScene.align( sprite );
}
}
}
@Override
public void update() {
@@ -109,7 +109,7 @@ public class AttackIndicator extends Tag {
} else {
active = true;
lastTarget = Random.element( candidates );
updateImage();
updateImage();
flash();
}
} else {
@@ -65,11 +65,11 @@ public class BuffIndicator extends Component {
public static final int BLEEDING = 26;
public static final int MARK = 27;
public static final int DEFERRED = 28;
public static final int DROWSY = 29;
public static final int MAGIC_SLEEP = 30;
public static final int THORNS = 31;
public static final int FORESIGHT = 32;
public static final int VERTIGO = 33;
public static final int DROWSY = 29;
public static final int MAGIC_SLEEP = 30;
public static final int THORNS = 31;
public static final int FORESIGHT = 32;
public static final int VERTIGO = 33;
public static final int RECHARGING = 34;
public static final int LOCKED_FLOOR= 35;
public static final int CORRUPT = 36;
@@ -38,11 +38,11 @@ public class CheckBox extends RedButton {
text.x = PixelScene.align( PixelScene.uiCamera, x + margin );
text.y = PixelScene.align( PixelScene.uiCamera, y + margin );
margin = (height - icon.height) / 2;
margin = (height - icon.height) / 2;
icon.x = PixelScene.align( PixelScene.uiCamera, x + width - margin - icon.width );
icon.y = PixelScene.align( PixelScene.uiCamera, y + margin );
}
icon.x = PixelScene.align( PixelScene.uiCamera, x + width - margin - icon.width );
icon.y = PixelScene.align( PixelScene.uiCamera, y + margin );
}
public boolean checked() {
return checked;
@@ -49,10 +49,10 @@ public class Compass extends Image {
super.update();
if (!visible) {
visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell];
visible = Dungeon.level.visited[cell] || Dungeon.level.mapped[cell];
}
if (visible) {
if (visible) {
PointF scroll = Camera.main.scroll;
if (!scroll.equals( lastScroll )) {
lastScroll.set( scroll );
@@ -17,58 +17,58 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.ui;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Button;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Button;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
public class ExitButton extends Button {
protected Image image;
protected Image image;
public ExitButton() {
super();
public ExitButton() {
super();
width = image.width;
height = image.height;
}
width = image.width;
height = image.height;
}
@Override
protected void createChildren() {
super.createChildren();
@Override
protected void createChildren() {
super.createChildren();
image = Icons.EXIT.get();
add( image );
}
image = Icons.EXIT.get();
add( image );
}
@Override
protected void layout() {
super.layout();
@Override
protected void layout() {
super.layout();
image.x = x;
image.y = y;
}
image.x = x;
image.y = y;
}
@Override
protected void onTouchDown() {
image.brightness( 1.5f );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override
protected void onTouchDown() {
image.brightness( 1.5f );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override
protected void onTouchUp() {
image.resetColor();
}
@Override
protected void onTouchUp() {
image.resetColor();
}
@Override
protected void onClick() {
if (Game.scene() instanceof TitleScene) {
Game.instance.finish();
} else {
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
}
}
@Override
protected void onClick() {
if (Game.scene() instanceof TitleScene) {
Game.instance.finish();
} else {
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
}
}
}
@@ -54,11 +54,11 @@ public class GameLog extends Component implements Signal.Listener<String> {
if (text.startsWith( GLog.POSITIVE )) {
text = text.substring( GLog.POSITIVE.length() );
color = CharSprite.POSITIVE;
} else
} else
if (text.startsWith( GLog.NEGATIVE )) {
text = text.substring( GLog.NEGATIVE.length() );
color = CharSprite.NEGATIVE;
} else
} else
if (text.startsWith( GLog.WARNING )) {
text = text.substring( GLog.WARNING.length() );
color = CharSprite.WARNING;
@@ -68,7 +68,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
color = CharSprite.NEUTRAL;
}
text = Utils.capitalize( text ) +
text = Utils.capitalize( text ) +
(PUNCTUATION.matcher( text ).matches() ? "" : ".");
if (lastEntry != null && color == lastColor) {
@@ -96,7 +96,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
}
@Override
protected void layout() {
protected void layout() {
float pos = y;
for (int i=length-1; i >= 0; i--) {
BitmapTextMultiline entry = (BitmapTextMultiline)members.get( i );
@@ -26,13 +26,13 @@ public enum Icons {
SKULL,
BUSY,
COMPASS,
INFO,
INFO,
PREFS,
WARNING,
TARGET,
MASTERY,
WATA,
SHPX,
SHPX,
WARRIOR,
MAGE,
ROGUE,
@@ -49,9 +49,9 @@ public enum Icons {
WAND_HOLSTER,
CHECKED,
UNCHECKED,
EXIT,
CHALLENGE_OFF,
CHALLENGE_ON,
EXIT,
CHALLENGE_OFF,
CHALLENGE_ON,
RESUME;
public Image get() {
@@ -88,9 +88,9 @@ public enum Icons {
case WATA:
icon.frame( icon.texture.uvRect( 30, 16, 45, 26 ) );
break;
case SHPX:
icon.frame( icon.texture.uvRect( 64, 44, 80, 60 ) );
break;
case SHPX:
icon.frame( icon.texture.uvRect( 64, 44, 80, 60 ) );
break;
case WARRIOR:
icon.frame( icon.texture.uvRect( 0, 29, 16, 45 ) );
break;
@@ -139,15 +139,15 @@ public enum Icons {
case UNCHECKED:
icon.frame( icon.texture.uvRect( 66, 12, 78, 24 ) );
break;
case EXIT:
icon.frame( icon.texture.uvRect( 108, 0, 124, 16 ) );
break;
case CHALLENGE_OFF:
icon.frame( icon.texture.uvRect( 78, 16, 102, 40 ) );
break;
case CHALLENGE_ON:
icon.frame( icon.texture.uvRect( 102, 16, 126, 40 ) );
break;
case EXIT:
icon.frame( icon.texture.uvRect( 108, 0, 124, 16 ) );
break;
case CHALLENGE_OFF:
icon.frame( icon.texture.uvRect( 78, 16, 102, 40 ) );
break;
case CHALLENGE_ON:
icon.frame( icon.texture.uvRect( 102, 16, 126, 40 ) );
break;
case RESUME:
icon.frame( icon.texture.uvRect( 13, 53, 24, 64 ) );
break;
@@ -54,30 +54,30 @@ public class ItemSlot extends Button {
private static final String TXT_STRENGTH = ":%d";
private static final String TXT_TYPICAL_STR = "%d?";
private static final String TXT_KEY_DEPTH = "\u007F%d";
private static final String TXT_KEY_DEPTH = "\u007F%d";
private static final String TXT_LEVEL = "%+d";
private static final String TXT_CURSED = "";//"-";
private static final String TXT_CURSED = "";//"-";
// Special "virtual items"
// Special "virtual items"
public static final Item CHEST = new Item() {
public int image() { return ItemSpriteSheet.CHEST; };
};
public static final Item LOCKED_CHEST = new Item() {
public int image() { return ItemSpriteSheet.LOCKED_CHEST; };
};
public static final Item CRYSTAL_CHEST = new Item() {
public int image() { return ItemSpriteSheet.CRYSTAL_CHEST; };
};
public static final Item CRYSTAL_CHEST = new Item() {
public int image() { return ItemSpriteSheet.CRYSTAL_CHEST; };
};
public static final Item TOMB = new Item() {
public int image() { return ItemSpriteSheet.TOMB; };
};
public static final Item SKELETON = new Item() {
public int image() { return ItemSpriteSheet.BONES; };
};
public static final Item REMAINS = new Item() {
public int image() { return ItemSpriteSheet.REMAINS; };
};
public static final Item REMAINS = new Item() {
public int image() { return ItemSpriteSheet.REMAINS; };
};
public ItemSlot() {
super();
@@ -162,8 +162,8 @@ public class ItemSlot extends Button {
} else {
topRight.text( Utils.format( TXT_TYPICAL_STR, isArmor ?
((Armor)item).typicalSTR() :
topRight.text( Utils.format( TXT_TYPICAL_STR, isArmor ?
((Armor)item).typicalSTR() :
((MeleeWeapon)item).typicalSTR() ) );
topRight.hardlight( WARNING );
@@ -171,19 +171,19 @@ public class ItemSlot extends Button {
topRight.measure();
} else if (item instanceof Key && !(item instanceof SkeletonKey)) {
topRight.text(Utils.format(TXT_KEY_DEPTH, ((Key) item).depth));
topRight.measure();
} else {
topRight.text(Utils.format(TXT_KEY_DEPTH, ((Key) item).depth));
topRight.measure();
} else {
topRight.text( null );
}
int level = item.visiblyUpgraded();
int level = item.visiblyUpgraded();
if (level != 0) {
bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED );
bottomRight.measure();
bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED );
bottomRight.measure();
bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED );
} else if (item instanceof Scroll || item instanceof Potion) {
if (item instanceof Scroll) bottomRight.text(((Scroll) item).initials());
@@ -216,14 +216,14 @@ public class ItemSlot extends Button {
bottomRight.alpha( alpha );
}
public void showParams( boolean TL, boolean TR, boolean BR ) {
if (TL) add( topLeft );
else remove( topLeft );
public void showParams( boolean TL, boolean TR, boolean BR ) {
if (TL) add( topLeft );
else remove( topLeft );
if (TR) add( topRight );
else remove( topRight );
if (TR) add( topRight );
else remove( topRight );
if (BR) add( bottomRight );
else remove( bottomRight );
}
if (BR) add( bottomRight );
else remove( bottomRight );
}
}
@@ -66,10 +66,10 @@ public class LootIndicator extends Tag {
Item item =
heap.type == Heap.Type.CHEST || heap.type == Heap.Type.MIMIC ? ItemSlot.CHEST :
heap.type == Heap.Type.LOCKED_CHEST ? ItemSlot.LOCKED_CHEST :
heap.type == Heap.Type.CRYSTAL_CHEST ? ItemSlot.CRYSTAL_CHEST :
heap.type == Heap.Type.CRYSTAL_CHEST ? ItemSlot.CRYSTAL_CHEST :
heap.type == Heap.Type.TOMB ? ItemSlot.TOMB :
heap.type == Heap.Type.SKELETON ? ItemSlot.SKELETON :
heap.type == Heap.Type.REMAINS ? ItemSlot.REMAINS :
heap.type == Heap.Type.REMAINS ? ItemSlot.REMAINS :
heap.peek();
if (item != lastItem || item.quantity() != lastQuantity) {
lastItem = item;
@@ -59,11 +59,11 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
reset();
}
public static void reset() {
instance = new QuickSlotButton[4];
public static void reset() {
instance = new QuickSlotButton[4];
lastTarget = null;
}
lastTarget = null;
}
@Override
protected void createChildren() {
@@ -94,7 +94,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
icon.resetColor();
}
};
slot.showParams( true, false, true );
slot.showParams( true, false, true );
add( slot );
crossB = Icons.TARGET.get();
@@ -90,9 +90,9 @@ public class RedButton extends Button {
layout();
}
public void textColor( int value ) {
text.hardlight( value );
}
public void textColor( int value ) {
text.hardlight( value );
}
public void icon( Image icon ) {
if (this.icon != null) {
@@ -4,52 +4,49 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.watabou.noosa.Image;
/**
* Created by Evan on 21/01/2015.
*/
public class ResumeIndicator extends Tag {
private Image icon;
private Image icon;
public ResumeIndicator() {
super(0xCDD5C0);
public ResumeIndicator() {
super(0xCDD5C0);
setSize( 24, 24 );
setSize( 24, 24 );
visible = false;
visible = false;
}
}
@Override
protected void createChildren() {
super.createChildren();
@Override
protected void createChildren() {
super.createChildren();
icon = Icons.get( Icons.RESUME );
add( icon );
}
icon = Icons.get( Icons.RESUME );
add( icon );
}
@Override
protected void layout() {
super.layout();
@Override
protected void layout() {
super.layout();
icon.x = PixelScene.align( PixelScene.uiCamera, x+1 + (width - icon.width) / 2 );
icon.y = PixelScene.align( PixelScene.uiCamera, y + (height - icon.height) / 2 );
}
icon.x = PixelScene.align( PixelScene.uiCamera, x+1 + (width - icon.width) / 2 );
icon.y = PixelScene.align( PixelScene.uiCamera, y + (height - icon.height) / 2 );
}
@Override
protected void onClick() {
Dungeon.hero.resume();
}
@Override
protected void onClick() {
Dungeon.hero.resume();
}
@Override
public void update() {
if (!Dungeon.hero.isAlive())
visible = false;
else if (visible != (Dungeon.hero.lastAction != null)){
visible = Dungeon.hero.lastAction != null;
if (visible)
flash();
}
super.update();
}
@Override
public void update() {
if (!Dungeon.hero.isAlive())
visible = false;
else if (visible != (Dungeon.hero.lastAction != null)){
visible = Dungeon.hero.lastAction != null;
if (visible)
flash();
}
super.update();
}
}
@@ -84,7 +84,7 @@ public class ScrollPane extends Component {
return content;
}
public void onClick( float x, float y ) {
public void onClick( float x, float y ) {
}
public class TouchController extends TouchArea {
@@ -114,7 +114,7 @@ public class ScrollPane extends Component {
private PointF lastPos = new PointF();
@Override
protected void onDrag( Touch t ) {
protected void onDrag( Touch t ) {
if (dragging) {
Camera c = content.camera;
@@ -134,7 +134,7 @@ public class ScrollPane extends Component {
}
lastPos.set( t.current );
lastPos.set( t.current );
} else if (PointF.distance( t.current, t.start ) > dragThreshold) {
@@ -142,6 +142,6 @@ public class ScrollPane extends Component {
lastPos.set( t.current );
}
}
}
}
}
@@ -40,208 +40,208 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
public class StatusPane extends Component {
private NinePatch shield;
private Image avatar;
private Emitter blood;
private NinePatch shield;
private Image avatar;
private Emitter blood;
private int lastTier = 0;
private int lastTier = 0;
private Image hp;
private Image exp;
private Image hp;
private Image exp;
private int lastLvl = -1;
private int lastKeys = -1;
private int lastLvl = -1;
private int lastKeys = -1;
private BitmapText level;
private BitmapText depth;
private BitmapText keys;
private BitmapText level;
private BitmapText depth;
private BitmapText keys;
private DangerIndicator danger;
private BuffIndicator buffs;
private Compass compass;
private DangerIndicator danger;
private BuffIndicator buffs;
private Compass compass;
private MenuButton btnMenu;
private MenuButton btnMenu;
@Override
protected void createChildren() {
@Override
protected void createChildren() {
shield = new NinePatch( Assets.STATUS, 80, 0, 30 + 18, 0 );
add( shield );
shield = new NinePatch( Assets.STATUS, 80, 0, 30 + 18, 0 );
add( shield );
add( new TouchArea( 0, 1, 31, 31 ) {
@Override
protected void onClick( Touch touch ) {
Image sprite = Dungeon.hero.sprite;
if (!sprite.isVisible()) {
Camera.main.focusOn( sprite );
}
GameScene.show( new WndHero() );
};
} );
add( new TouchArea( 0, 1, 31, 31 ) {
@Override
protected void onClick( Touch touch ) {
Image sprite = Dungeon.hero.sprite;
if (!sprite.isVisible()) {
Camera.main.focusOn( sprite );
}
GameScene.show( new WndHero() );
};
} );
btnMenu = new MenuButton();
add( btnMenu );
btnMenu = new MenuButton();
add( btnMenu );
avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
add( avatar );
avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
add( avatar );
blood = new Emitter();
blood.pos( avatar );
blood.pour( BloodParticle.FACTORY, 0.3f );
blood.autoKill = false;
blood.on = false;
add( blood );
blood = new Emitter();
blood.pos( avatar );
blood.pour( BloodParticle.FACTORY, 0.3f );
blood.autoKill = false;
blood.on = false;
add( blood );
compass = new Compass( Dungeon.level.exit );
add( compass );
compass = new Compass( Dungeon.level.exit );
add( compass );
hp = new Image( Assets.HP_BAR );
add( hp );
hp = new Image( Assets.HP_BAR );
add( hp );
exp = new Image( Assets.XP_BAR );
add( exp );
exp = new Image( Assets.XP_BAR );
add( exp );
level = new BitmapText( PixelScene.font1x );
level.hardlight( 0xFFEBA4 );
add( level );
level = new BitmapText( PixelScene.font1x );
level.hardlight( 0xFFEBA4 );
add( level );
depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
depth.hardlight( 0xCACFC2 );
depth.measure();
add( depth );
depth = new BitmapText( Integer.toString( Dungeon.depth ), PixelScene.font1x );
depth.hardlight( 0xCACFC2 );
depth.measure();
add( depth );
Dungeon.hero.belongings.countIronKeys();
keys = new BitmapText( PixelScene.font1x );
keys.hardlight( 0xCACFC2 );
add( keys );
Dungeon.hero.belongings.countIronKeys();
keys = new BitmapText( PixelScene.font1x );
keys.hardlight( 0xCACFC2 );
add( keys );
danger = new DangerIndicator();
add( danger );
danger = new DangerIndicator();
add( danger );
buffs = new BuffIndicator( Dungeon.hero );
add( buffs );
}
buffs = new BuffIndicator( Dungeon.hero );
add( buffs );
}
@Override
protected void layout() {
@Override
protected void layout() {
height = 32;
height = 32;
shield.size( width, shield.height );
shield.size( width, shield.height );
avatar.x = PixelScene.align( camera(), shield.x + 15 - avatar.width / 2 );
avatar.y = PixelScene.align( camera(), shield.y + 16 - avatar.height / 2 );
avatar.x = PixelScene.align( camera(), shield.x + 15 - avatar.width / 2 );
avatar.y = PixelScene.align( camera(), shield.y + 16 - avatar.height / 2 );
compass.x = avatar.x + avatar.width / 2 - compass.origin.x;
compass.y = avatar.y + avatar.height / 2 - compass.origin.y;
compass.x = avatar.x + avatar.width / 2 - compass.origin.x;
compass.y = avatar.y + avatar.height / 2 - compass.origin.y;
hp.x = 30;
hp.y = 3;
hp.x = 30;
hp.y = 3;
depth.x = width - 24 - depth.width() - 18;
depth.y = 6;
depth.x = width - 24 - depth.width() - 18;
depth.y = 6;
keys.y = 6;
keys.y = 6;
danger.setPos( width - danger.width(), 18 );
danger.setPos( width - danger.width(), 18 );
buffs.setPos( 31, 9 );
buffs.setPos( 31, 9 );
btnMenu.setPos( width - btnMenu.width(), 1 );
}
btnMenu.setPos( width - btnMenu.width(), 1 );
}
@Override
public void update() {
super.update();
@Override
public void update() {
super.update();
float health = (float)Dungeon.hero.HP / Dungeon.hero.HT;
float health = (float)Dungeon.hero.HP / Dungeon.hero.HT;
if (health == 0) {
avatar.tint( 0x000000, 0.6f );
blood.on = false;
} else if (health < 0.25f) {
avatar.tint( 0xcc0000, 0.4f );
blood.on = true;
} else {
avatar.resetColor();
blood.on = false;
}
if (health == 0) {
avatar.tint( 0x000000, 0.6f );
blood.on = false;
} else if (health < 0.25f) {
avatar.tint( 0xcc0000, 0.4f );
blood.on = true;
} else {
avatar.resetColor();
blood.on = false;
}
hp.scale.x = health;
exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();
hp.scale.x = health;
exp.scale.x = (width / exp.width) * Dungeon.hero.exp / Dungeon.hero.maxExp();
if (Dungeon.hero.lvl != lastLvl) {
if (Dungeon.hero.lvl != lastLvl) {
if (lastLvl != -1) {
Emitter emitter = (Emitter)recycle( Emitter.class );
emitter.revive();
emitter.pos( 27, 27 );
emitter.burst( Speck.factory( Speck.STAR ), 12 );
}
if (lastLvl != -1) {
Emitter emitter = (Emitter)recycle( Emitter.class );
emitter.revive();
emitter.pos( 27, 27 );
emitter.burst( Speck.factory( Speck.STAR ), 12 );
}
lastLvl = Dungeon.hero.lvl;
level.text( Integer.toString( lastLvl ) );
level.measure();
level.x = PixelScene.align( 27.0f - level.width() / 2 );
level.y = PixelScene.align( 27.5f - level.baseLine() / 2 );
}
lastLvl = Dungeon.hero.lvl;
level.text( Integer.toString( lastLvl ) );
level.measure();
level.x = PixelScene.align( 27.0f - level.width() / 2 );
level.y = PixelScene.align( 27.5f - level.baseLine() / 2 );
}
int k = IronKey.curDepthQuantity;
if (k != lastKeys) {
lastKeys = k;
keys.text( Integer.toString( lastKeys ) );
keys.measure();
keys.x = width - 8 - keys.width() - 18;
}
int k = IronKey.curDepthQuantity;
if (k != lastKeys) {
lastKeys = k;
keys.text( Integer.toString( lastKeys ) );
keys.measure();
keys.x = width - 8 - keys.width() - 18;
}
int tier = Dungeon.hero.tier();
if (tier != lastTier) {
lastTier = tier;
avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
}
}
int tier = Dungeon.hero.tier();
if (tier != lastTier) {
lastTier = tier;
avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
}
}
private static class MenuButton extends Button {
private static class MenuButton extends Button {
private Image image;
private Image image;
public MenuButton() {
super();
public MenuButton() {
super();
width = image.width + 4;
height = image.height + 4;
}
width = image.width + 4;
height = image.height + 4;
}
@Override
protected void createChildren() {
super.createChildren();
@Override
protected void createChildren() {
super.createChildren();
image = new Image( Assets.STATUS, 114, 3, 12, 11 );
add( image );
}
image = new Image( Assets.STATUS, 114, 3, 12, 11 );
add( image );
}
@Override
protected void layout() {
super.layout();
@Override
protected void layout() {
super.layout();
image.x = x + 2;
image.y = y + 2;
}
image.x = x + 2;
image.y = y + 2;
}
@Override
protected void onTouchDown() {
image.brightness( 1.5f );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override
protected void onTouchDown() {
image.brightness( 1.5f );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override
protected void onTouchUp() {
image.resetColor();
}
@Override
protected void onTouchUp() {
image.resetColor();
}
@Override
protected void onClick() {
GameScene.show( new WndGame() );
}
}
@Override
protected void onClick() {
GameScene.show( new WndGame() );
}
}
}
@@ -66,7 +66,7 @@ public class Toast extends Component {
bg.y = y;
bg.size( width, height );
close.setPos(
close.setPos(
bg.x + bg.width() - bg.marginHor() / 2 - MARGIN_HOR - close.width(),
y + (height - close.height()) / 2 );
@@ -184,8 +184,8 @@ public class Toolbar extends Component {
}
public void pickup( Item item ) {
pickedUp.reset( item,
btnInventory.centerX(),
pickedUp.reset( item,
btnInventory.centerX(),
btnInventory.centerY() );
}
@@ -240,7 +240,7 @@ public class Toolbar extends Component {
}
GameScene.show( new WndInfoCell( cell ) );
}
}
@Override
public String prompt() {
return "Select a cell to examine";
@@ -342,16 +342,16 @@ public class Toolbar extends Component {
originToCenter();
active =
visible =
active =
visible =
false;
}
public void reset( Item item, float dstX, float dstY ) {
view( item );
active =
visible =
active =
visible =
true;
this.dstX = dstX - ItemSprite.SIZE / 2;
@@ -369,13 +369,13 @@ public class Toolbar extends Component {
if ((left -= Game.elapsed) <= 0) {
visible =
active =
visible =
active =
false;
if (emitter != null) emitter.on = false;
} else {
float p = left / DURATION;
float p = left / DURATION;
scale.set( (float)Math.sqrt( p ) );
float offset = DISTANCE * p;
x = dstX - offset;
@@ -39,11 +39,11 @@ public class Window extends Group implements Signal.Listener<Key> {
protected int height;
protected TouchArea blocker;
protected ShadowBox shadow;
protected NinePatch chrome;
protected ShadowBox shadow;
protected NinePatch chrome;
public static final int TITLE_COLOR = 0xFFFF44;
public static final int SHPX_COLOR = 0x33BB33;
public static final int SHPX_COLOR = 0x33BB33;
public Window() {
this( 0, 0, Chrome.get( Chrome.Type.WINDOW ) );
@@ -59,8 +59,8 @@ public class Window extends Group implements Signal.Listener<Key> {
blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
@Override
protected void onClick( Touch touch ) {
if (!Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
if (!Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
(int)touch.current.y )) {
onBackPressed();
@@ -75,22 +75,22 @@ public class Window extends Group implements Signal.Listener<Key> {
this.width = width;
this.height = height;
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add( shadow );
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add( shadow );
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height - camera.height * camera.zoom) / 2;
@@ -109,7 +109,7 @@ public class Window extends Group implements Signal.Listener<Key> {
this.width = w;
this.height = h;
chrome.size(
chrome.size(
width + chrome.marginHor(),
height + chrome.marginVer() );
@@ -138,10 +138,10 @@ public class Window extends Group implements Signal.Listener<Key> {
if (key.pressed) {
switch (key.code) {
case Keys.BACK:
onBackPressed();
onBackPressed();
break;
case Keys.MENU:
onMenuPressed();
onMenuPressed();
break;
}
}