Merging Source v1.7.2: UI changes

This commit is contained in:
Evan Debenham 2014-10-18 21:30:38 -04:00
parent 9f9e117c95
commit 735af276c8
7 changed files with 347 additions and 206 deletions

View File

@ -29,14 +29,19 @@ public class Archs extends Component {
private SkinnedBlock arcsBg; private SkinnedBlock arcsBg;
private SkinnedBlock arcsFg; private SkinnedBlock arcsFg;
private static float offsB = 0;
private static float offsF = 0;
public boolean reversed = false; public boolean reversed = false;
@Override @Override
protected void createChildren() { protected void createChildren() {
arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG ); arcsBg = new SkinnedBlock( 1, 1, Assets.ARCS_BG );
arcsBg.offsetTo( 0, offsB );
add( arcsBg ); add( arcsBg );
arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG ); arcsFg = new SkinnedBlock( 1, 1, Assets.ARCS_FG );
arcsFg.offsetTo( 0, offsF );
add( arcsFg ); add( arcsFg );
} }
@ -61,5 +66,8 @@ public class Archs extends Component {
arcsBg.offset( 0, shift ); arcsBg.offset( 0, shift );
arcsFg.offset( 0, shift * 2 ); arcsFg.offset( 0, shift * 2 );
offsB = arcsBg.offsetY();
offsF = arcsFg.offsetY();
} }
} }

View File

@ -66,6 +66,7 @@ public class BuffIndicator extends Component {
public static final int MAGIC_SLEEP = 30; public static final int MAGIC_SLEEP = 30;
public static final int THORNS = 31; public static final int THORNS = 31;
public static final int FORESIGHT = 32; public static final int FORESIGHT = 32;
public static final int VERTIGO = 33;
public static final int SIZE = 7; public static final int SIZE = 7;

View File

@ -76,7 +76,7 @@ public class DangerIndicator extends Tag {
int v = Dungeon.hero.visibleEnemies(); int v = Dungeon.hero.visibleEnemies();
if (v != lastNumber) { if (v != lastNumber) {
lastNumber = v; lastNumber = v;
if (visible = (lastNumber > 0)) { if (visible = lastNumber > 0) {
number.text( Integer.toString( lastNumber ) ); number.text( Integer.toString( lastNumber ) );
number.measure(); number.measure();
placeNumber(); placeNumber();

View File

@ -1,7 +1,74 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2014 Oleg Dolya
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.ui; package com.shatteredpixel.shatteredpixeldungeon.ui;
/** import com.watabou.noosa.Game;
* Created by Evan on 18/10/2014. import com.watabou.noosa.Image;
*/ import com.watabou.noosa.audio.Sample;
public class ExitButton { 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 {
private Image image;
public ExitButton() {
super();
width = image.width;
height = image.height;
}
@Override
protected void createChildren() {
super.createChildren();
image = Icons.EXIT.get();
add( image );
}
@Override
protected void layout() {
super.layout();
image.x = x;
image.y = y;
}
@Override
protected void onTouchDown() {
image.brightness( 1.5f );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override
protected void onTouchUp() {
image.resetColor();
}
@Override
protected void onClick() {
if (Game.scene() instanceof TitleScene) {
Game.instance.finish();
} else {
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
}
}
} }

View File

@ -48,7 +48,10 @@ public enum Icons {
SCROLL_HOLDER, SCROLL_HOLDER,
WAND_HOLSTER, WAND_HOLSTER,
CHECKED, CHECKED,
UNCHECKED; UNCHECKED,
EXIT,
CHALLENGE_OFF,
CHALLENGE_ON;
public Image get() { public Image get() {
return get( this ); return get( this );
@ -135,6 +138,15 @@ public enum Icons {
case UNCHECKED: case UNCHECKED:
icon.frame( icon.texture.uvRect( 66, 12, 78, 24 ) ); icon.frame( icon.texture.uvRect( 66, 12, 78, 24 ) );
break; break;
case EXIT:
icon.frame( icon.texture.uvRect( 98, 0, 114, 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;
} }
return icon; return icon;
} }

View File

@ -47,7 +47,6 @@ public class ItemSlot extends Button {
private static final String TXT_TYPICAL_STR = "%d?"; private static final String TXT_TYPICAL_STR = "%d?";
private static final String TXT_LEVEL = "%+d"; private static final String TXT_LEVEL = "%+d";
private static final String TXT_CURSED = "";
// Special items for containers // Special items for containers
public static final Item CHEST = new Item() { public static final Item CHEST = new Item() {
@ -164,7 +163,7 @@ public class ItemSlot extends Button {
int level = item.visiblyUpgraded(); int level = item.visiblyUpgraded();
if (level != 0 || (item.cursed && item.cursedKnown)) { if (level != 0 || (item.cursed && item.cursedKnown)) {
bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : TXT_CURSED ); bottomRight.text( item.levelKnown ? Utils.format( TXT_LEVEL, level ) : "" );
bottomRight.measure(); bottomRight.measure();
bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED ); bottomRight.hardlight( level > 0 ? UPGRADED : DEGRADED );
} else { } else {

View File

@ -23,7 +23,9 @@ import com.watabou.noosa.Camera;
import com.watabou.noosa.Image; import com.watabou.noosa.Image;
import com.watabou.noosa.NinePatch; import com.watabou.noosa.NinePatch;
import com.watabou.noosa.TouchArea; import com.watabou.noosa.TouchArea;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.ui.Button;
import com.watabou.noosa.ui.Component; import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
@ -33,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGame;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero; import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
public class StatusPane extends Component { public class StatusPane extends Component {
@ -58,10 +61,12 @@ public class StatusPane extends Component {
private BuffIndicator buffs; private BuffIndicator buffs;
private Compass compass; private Compass compass;
private MenuButton btnMenu;
@Override @Override
protected void createChildren() { protected void createChildren() {
shield = new NinePatch( Assets.STATUS, 80, 0, 30, 0 ); shield = new NinePatch( Assets.STATUS, 80, 0, 30 + 18, 0 );
add( shield ); add( shield );
add( new TouchArea( 0, 1, 30, 30 ) { add( new TouchArea( 0, 1, 30, 30 ) {
@ -75,6 +80,9 @@ public class StatusPane extends Component {
}; };
} ); } );
btnMenu = new MenuButton();
add( btnMenu );
avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier ); avatar = HeroSprite.avatar( Dungeon.hero.heroClass, lastTier );
add( avatar ); add( avatar );
@ -134,7 +142,7 @@ public class StatusPane extends Component {
hp.x = 30; hp.x = 30;
hp.y = 3; hp.y = 3;
depth.x = width - 24 - depth.width(); depth.x = width - 24 - depth.width() - 18;
depth.y = 6; depth.y = 6;
keys.y = 6; keys.y = 6;
@ -144,6 +152,8 @@ public class StatusPane extends Component {
loot.setPos( width - loot.width(), danger.bottom() + 2 ); loot.setPos( width - loot.width(), danger.bottom() + 2 );
buffs.setPos( 32, 11 ); buffs.setPos( 32, 11 );
btnMenu.setPos( width - btnMenu.width(), 1 );
} }
@Override @Override
@ -182,12 +192,12 @@ public class StatusPane extends Component {
level.y = PixelScene.align( 27.5f - level.baseLine() / 2 ); level.y = PixelScene.align( 27.5f - level.baseLine() / 2 );
} }
int k = IronKey.curDepthQunatity; int k = IronKey.curDepthQuantity;
if (k != lastKeys) { if (k != lastKeys) {
lastKeys = k; lastKeys = k;
keys.text( Integer.toString( lastKeys ) ); keys.text( Integer.toString( lastKeys ) );
keys.measure(); keys.measure();
keys.x = width - 8 - keys.width(); keys.x = width - 8 - keys.width() - 18;
} }
int tier = Dungeon.hero.tier(); int tier = Dungeon.hero.tier();
@ -196,4 +206,48 @@ public class StatusPane extends Component {
avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) ); avatar.copy( HeroSprite.avatar( Dungeon.hero.heroClass, tier ) );
} }
} }
private static class MenuButton extends Button {
private Image image;
public MenuButton() {
super();
width = image.width + 4;
height = image.height + 4;
}
@Override
protected void createChildren() {
super.createChildren();
image = new Image( Assets.STATUS, 114, 3, 12, 11 );
add( image );
}
@Override
protected void layout() {
super.layout();
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 onTouchUp() {
image.resetColor();
}
@Override
protected void onClick() {
GameScene.show( new WndGame() );
}
}
} }