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
@@ -35,21 +35,21 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
public class AboutScene extends PixelScene {
private static final String TTL_SHPX = "Shattered Pixel Dungeon";
private static final String TTL_SHPX = "Shattered Pixel Dungeon";
private static final String TXT_SHPX =
"Design, Code, & Graphics: Evan\n\n" +
"Shattered Pixel is Evan's online home, check it out:";
private static final String TXT_SHPX =
"Design, Code, & Graphics: Evan\n\n" +
"Shattered Pixel is Evan's online home, check it out:";
private static final String LNK_SHPX = "ShatteredPixel.com";
private static final String LNK_SHPX = "ShatteredPixel.com";
private static final String TTL_WATA = "Original Pixel Dungeon";
private static final String TTL_WATA = "Original Pixel Dungeon";
private static final String TXT_WATA =
"Code & Graphics: Watabou\n" +
"Music: Cube_Code\n\n" +
"Visit Watabou for more info:";
"Code & Graphics: Watabou\n" +
"Music: Cube_Code\n\n" +
"Visit Watabou for more info:";
private static final String LNK_WATA = "pixeldungeon.watabou.ru";
@@ -61,65 +61,65 @@ public class AboutScene extends PixelScene {
final float colTop = (Camera.main.height / 2) - (ShatteredPixelDungeon.landscape() ? 30 : 90);
final float wataOffset = ShatteredPixelDungeon.landscape() ? colWidth : 0;
Image shpx = Icons.SHPX.get();
shpx.x = align( (colWidth - shpx.width()) / 2 );
shpx.y = align( colTop );
add( shpx );
Image shpx = Icons.SHPX.get();
shpx.x = align( (colWidth - shpx.width()) / 2 );
shpx.y = align( colTop );
add( shpx );
new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20;
new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20;
BitmapTextMultiline shpxtitle = createMultiline( TTL_SHPX, 8 );
shpxtitle.maxWidth = (int) Math.min( colWidth, 120 );
shpxtitle.measure();
shpxtitle.hardlight( Window.SHPX_COLOR );
add( shpxtitle );
BitmapTextMultiline shpxtitle = createMultiline( TTL_SHPX, 8 );
shpxtitle.maxWidth = (int) Math.min( colWidth, 120 );
shpxtitle.measure();
shpxtitle.hardlight( Window.SHPX_COLOR );
add( shpxtitle );
shpxtitle.x = align( (colWidth - shpxtitle.width()) / 2 );
shpxtitle.y = align( shpx.y + shpx.height + 5 );
shpxtitle.x = align( (colWidth - shpxtitle.width()) / 2 );
shpxtitle.y = align( shpx.y + shpx.height + 5 );
BitmapTextMultiline shpxtext = createMultiline( TXT_SHPX, 8 );
shpxtext.maxWidth = shpxtitle.maxWidth;
shpxtext.measure();
add( shpxtext );
BitmapTextMultiline shpxtext = createMultiline( TXT_SHPX, 8 );
shpxtext.maxWidth = shpxtitle.maxWidth;
shpxtext.measure();
add( shpxtext );
shpxtext.x = align( (colWidth - shpxtext.width()) / 2 );
shpxtext.y = align( shpxtitle.y + shpxtitle.height() + 12 );
shpxtext.x = align( (colWidth - shpxtext.width()) / 2 );
shpxtext.y = align( shpxtitle.y + shpxtitle.height() + 12 );
BitmapTextMultiline shpxlink = createMultiline( LNK_SHPX, 8 );
shpxlink.maxWidth = shpxtitle.maxWidth;
shpxlink.measure();
shpxlink.hardlight( Window.SHPX_COLOR );
add( shpxlink );
BitmapTextMultiline shpxlink = createMultiline( LNK_SHPX, 8 );
shpxlink.maxWidth = shpxtitle.maxWidth;
shpxlink.measure();
shpxlink.hardlight( Window.SHPX_COLOR );
add( shpxlink );
shpxlink.x = shpxtext.x;
shpxlink.y = shpxtext.y + shpxtext.height();
shpxlink.x = shpxtext.x;
shpxlink.y = shpxtext.y + shpxtext.height();
TouchArea shpxhotArea = new TouchArea( shpxlink ) {
@Override
protected void onClick( Touch touch ) {
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://shatteredpixel.tumblr.com") );
Game.instance.startActivity( intent );
}
};
add( shpxhotArea );
TouchArea shpxhotArea = new TouchArea( shpxlink ) {
@Override
protected void onClick( Touch touch ) {
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://shatteredpixel.tumblr.com") );
Game.instance.startActivity( intent );
}
};
add( shpxhotArea );
Image wata = Icons.WATA.get();
wata.x = align( wataOffset + (colWidth - wata.width()) / 2 );
wata.y = align( ShatteredPixelDungeon.landscape() ?
colTop:
shpxlink.y + wata.height + 20);
add( wata );
Image wata = Icons.WATA.get();
wata.x = align( wataOffset + (colWidth - wata.width()) / 2 );
wata.y = align( ShatteredPixelDungeon.landscape() ?
colTop:
shpxlink.y + wata.height + 20);
add( wata );
new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20;
new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20;
BitmapTextMultiline wataTitle = createMultiline( TTL_WATA, 8 );
wataTitle.maxWidth = (int) Math.min( colWidth, 120 );
wataTitle.measure();
wataTitle.hardlight(Window.TITLE_COLOR);
add( wataTitle );
BitmapTextMultiline wataTitle = createMultiline( TTL_WATA, 8 );
wataTitle.maxWidth = (int) Math.min( colWidth, 120 );
wataTitle.measure();
wataTitle.hardlight(Window.TITLE_COLOR);
add( wataTitle );
wataTitle.x = align( wataOffset + (colWidth - wataTitle.width()) / 2 );
wataTitle.y = align( wata.y + wata.height + 11 );
wataTitle.x = align( wataOffset + (colWidth - wataTitle.width()) / 2 );
wataTitle.y = align( wata.y + wata.height + 11 );
BitmapTextMultiline wataText = createMultiline( TXT_WATA, 8 );
wataText.maxWidth = wataTitle.maxWidth;
@@ -152,9 +152,9 @@ public class AboutScene extends PixelScene {
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
fadeIn();
}
@@ -39,7 +39,7 @@ public class AmuletScene extends PixelScene {
private static final float SMALL_GAP = 2;
private static final float LARGE_GAP = 8;
private static final String TXT =
private static final String TXT =
"You finally hold it in your hands, the Amulet of Yendor. Using its power " +
"you can take over the world or bring peace and prosperity to people or whatever. " +
"Anyway, your life will change forever and this game will end here. " +
@@ -67,7 +67,7 @@ public class AmuletScene extends PixelScene {
RedButton btnExit = new RedButton( TXT_EXIT ) {
@Override
protected void onClick() {
Dungeon.win( ResultDescriptions.WIN );
Dungeon.win( ResultDescriptions.WIN );
Dungeon.deleteGame( Dungeon.hero.heroClass, true );
Game.switchScene( noText ? TitleScene.class : RankingsScene.class );
}
@@ -47,8 +47,8 @@ public class CellSelector extends TouchArea {
} else {
select( ((DungeonTilemap)target).screenToTile(
(int)touch.current.x,
select( ((DungeonTilemap)target).screenToTile(
(int)touch.current.x,
(int)touch.current.y ) );
}
}
@@ -90,8 +90,8 @@ public class CellSelector extends TouchArea {
dragging = false;
} else if (t != touch) {
reset();
}
reset();
}
}
@Override
@@ -111,7 +111,7 @@ public class CellSelector extends TouchArea {
another = null;
lastPos.set( touch.current );
}
}
}
private boolean dragging = false;
private PointF lastPos = new PointF();
@@ -124,9 +124,9 @@ public class CellSelector extends TouchArea {
if (pinching) {
float curSpan = PointF.distance( touch.current, another.current );
camera.zoom( GameMath.gate(
PixelScene.minZoom,
startZoom * curSpan / startSpan,
camera.zoom( GameMath.gate(
PixelScene.minZoom,
startZoom * curSpan / startSpan,
PixelScene.maxZoom ) );
} else {
@@ -138,11 +138,11 @@ public class CellSelector extends TouchArea {
} else if (dragging) {
camera.scroll.offset( PointF.diff( lastPos, t.current ).invScale( camera.zoom ) );
lastPos.set( t.current );
}
lastPos.set( t.current );
}
}
}
}
public void cancel() {
@@ -153,24 +153,24 @@ public class CellSelector extends TouchArea {
GameScene.ready();
}
@Override
public void reset() {
super.reset();
another = null;
if (pinching){
pinching = false;
@Override
public void reset() {
super.reset();
another = null;
if (pinching){
pinching = false;
int zoom = Math.round( camera.zoom );
camera.zoom( zoom );
ShatteredPixelDungeon.zoom((int) (zoom - PixelScene.defaultZoom));
}
}
int zoom = Math.round( camera.zoom );
camera.zoom( zoom );
ShatteredPixelDungeon.zoom((int) (zoom - PixelScene.defaultZoom));
}
}
public void enable(boolean value){
if (enabled != value){
enabled = value;
}
}
public void enable(boolean value){
if (enabled != value){
enabled = value;
}
}
public interface Listener {
void onSelect( Integer cell );
@@ -142,8 +142,8 @@ public class GameScene extends PixelScene {
terrain = new Group();
add( terrain );
water = new SkinnedBlock(
Level.WIDTH * DungeonTilemap.SIZE,
water = new SkinnedBlock(
Level.WIDTH * DungeonTilemap.SIZE,
Level.HEIGHT * DungeonTilemap.SIZE,
Dungeon.level.waterTex() );
terrain.add( water );
@@ -265,7 +265,7 @@ public class GameScene extends PixelScene {
GLog.i( TXT_WELCOME_BACK, Dungeon.depth );
else
GLog.i( TXT_WELCOME, Dungeon.depth );
Sample.INSTANCE.play( Assets.SND_DESCEND );
Sample.INSTANCE.play( Assets.SND_DESCEND );
switch (Dungeon.level.feeling) {
case CHASM:
GLog.w( TXT_CHASM );
@@ -281,7 +281,7 @@ public class GameScene extends PixelScene {
break;
default:
}
if (Dungeon.level instanceof RegularLevel &&
if (Dungeon.level instanceof RegularLevel &&
((RegularLevel)Dungeon.level).secretDoors > Random.IntRange( 3, 4 )) {
GLog.w( TXT_SECRETS );
}
@@ -337,7 +337,7 @@ public class GameScene extends PixelScene {
} else if (item instanceof Plant.Seed) {
Dungeon.level.plant( (Plant.Seed)item, pos );
} else if (item instanceof Honeypot) {
Dungeon.level.drop(((Honeypot) item).shatter(null, pos), pos);
Dungeon.level.drop(((Honeypot) item).shatter(null, pos), pos);
} else {
Dungeon.level.drop( item, pos );
}
@@ -353,7 +353,7 @@ public class GameScene extends PixelScene {
freezeEmitters = false;
scene = null;
scene = null;
Badges.saveGlobal();
super.destroy();
@@ -387,19 +387,19 @@ public class GameScene extends PixelScene {
if (tagAttack != attack.active || tagLoot != loot.visible || tagResume != resume.visible) {
boolean atkAppearing = attack.active && !tagAttack;
boolean lootAppearing = loot.visible && !tagLoot;
boolean resAppearing = resume.visible && !tagResume;
boolean atkAppearing = attack.active && !tagAttack;
boolean lootAppearing = loot.visible && !tagLoot;
boolean resAppearing = resume.visible && !tagResume;
tagAttack = attack.active;
tagLoot = loot.visible;
tagResume = resume.visible;
if (atkAppearing || lootAppearing || resAppearing)
layoutTags();
layoutTags();
}
cellSelector.enable(Dungeon.hero.ready);
cellSelector.enable(Dungeon.hero.ready);
}
private boolean tagAttack = false;
@@ -435,8 +435,8 @@ public class GameScene extends PixelScene {
}
public void brightness( boolean value ) {
water.rm = water.gm = water.bm =
tiles.rm = tiles.gm = tiles.bm =
water.rm = water.gm = water.bm =
tiles.rm = tiles.gm = tiles.bm =
value ? 1.5f : 1.0f;
if (value) {
fog.am = +2f;
@@ -705,9 +705,9 @@ public class GameScene extends PixelScene {
private static final CellSelector.Listener defaultCellListener = new CellSelector.Listener() {
@Override
public void onSelect( Integer cell ) {
if (Dungeon.hero.handle( cell )) {
Dungeon.hero.next();
}
if (Dungeon.hero.handle( cell )) {
Dungeon.hero.next();
}
}
@Override
public String prompt() {
@@ -46,9 +46,9 @@ public class InterlevelScene extends PixelScene {
private static final String TXT_FALLING = "Falling...";
private static final String ERR_FILE_NOT_FOUND = "Save file not found. If this error persists after restarting, " +
"it may mean this save game is corrupted. Sorry about that.";
"it may mean this save game is corrupted. Sorry about that.";
private static final String ERR_IO = "Cannot read save file. If this error persists after restarting, " +
"it may mean this save game is corrupted. Sorry about that.";
"it may mean this save game is corrupted. Sorry about that.";
public static enum Mode {
DESCEND, ASCEND, CONTINUE, RESURRECT, RETURN, FALL
@@ -59,7 +59,7 @@ public class InterlevelScene extends PixelScene {
public static int returnPos;
public static boolean noStory = false;
public static boolean fallIntoPit;
private enum Phase {
@@ -101,7 +101,7 @@ public class InterlevelScene extends PixelScene {
message = PixelScene.createText( text, 9 );
message.measure();
message.x = (Camera.main.width - message.width()) / 2;
message.x = (Camera.main.width - message.width()) / 2;
message.y = (Camera.main.height - message.height()) / 2;
add( message );
@@ -201,7 +201,7 @@ public class InterlevelScene extends PixelScene {
Game.switchScene( StartScene.class );
};
} );
error = null;
error = null;
}
break;
}
@@ -209,7 +209,7 @@ public class InterlevelScene extends PixelScene {
private void descend() throws IOException {
Actor.fixTime();
Actor.fixTime();
if (Dungeon.hero == null) {
Dungeon.init();
if (noStory) {
@@ -232,7 +232,7 @@ public class InterlevelScene extends PixelScene {
private void fall() throws IOException {
Actor.fixTime();
Actor.fixTime();
Dungeon.saveLevel();
Level level;
@@ -280,7 +280,7 @@ public class InterlevelScene extends PixelScene {
private void resurrect() throws IOException {
Actor.fixTime();
Actor.fixTime();
if (Dungeon.level.locked) {
Dungeon.hero.resurrect( Dungeon.depth );
@@ -23,13 +23,13 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
public class IntroScene extends PixelScene {
private static final String TEXT =
"Many heroes have ventured into the dungeon before you from the city above. Some " +
"have returned with treasures and magical artifacts, most have never been heard from again.\n\n" +
"None, however, have ventured to the bottom and retrieved the Amulet of Yendor, " +
"which is said to be guarded by an ancient evil in the depths. " +
"Even now dark energy radiates from below, making its way up into the city.\n\n" +
"You consider yourself ready for the challenge. Most importantly, " +
"you feel that fortune smiles upon you. It's time to start your own adventure!";
"Many heroes have ventured into the dungeon before you from the city above. Some " +
"have returned with treasures and magical artifacts, most have never been heard from again.\n\n" +
"None, however, have ventured to the bottom and retrieved the Amulet of Yendor, " +
"which is said to be guarded by an ancient evil in the depths. " +
"Even now dark energy radiates from below, making its way up into the city.\n\n" +
"You consider yourself ready for the challenge. Most importantly, " +
"you feel that fortune smiles upon you. It's time to start your own adventure!";
@Override
public void create() {
@@ -88,10 +88,10 @@ public class PixelScene extends Scene {
Game.width / (defaultZoom + 1) >= minWidth &&
Game.height / (defaultZoom + 1) >= minHeight) {
defaultZoom++;
}
}
}
minZoom = 1;
maxZoom = defaultZoom * 2;
maxZoom = defaultZoom * 2;
Camera.reset( new PixelCamera( defaultZoom ) );
@@ -103,31 +103,31 @@ public class PixelScene extends Scene {
if (font1x == null) {
// 3x5 (6)
font1x = Font.colorMarked(
font1x = Font.colorMarked(
BitmapCache.get( Assets.FONTS1X ), 0x00000000, BitmapText.Font.LATIN_FULL );
font1x.baseLine = 6;
font1x.tracking = -1;
// 5x8 (10)
font15x = Font.colorMarked(
font15x = Font.colorMarked(
BitmapCache.get( Assets.FONTS15X ), 12, 0x00000000, BitmapText.Font.LATIN_FULL );
font15x.baseLine = 9;
font15x.tracking = -1;
// 6x10 (12)
font2x = Font.colorMarked(
font2x = Font.colorMarked(
BitmapCache.get( Assets.FONTS2X ), 14, 0x00000000, BitmapText.Font.LATIN_FULL );
font2x.baseLine = 11;
font2x.tracking = -1;
// 7x12 (15)
font25x = Font.colorMarked(
font25x = Font.colorMarked(
BitmapCache.get( Assets.FONTS25X ), 17, 0x00000000, BitmapText.Font.LATIN_FULL );
font25x.baseLine = 13;
font25x.tracking = -1;
// 9x15 (18)
font3x = Font.colorMarked(
font3x = Font.colorMarked(
BitmapCache.get( Assets.FONTS3X ), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
font3x.baseLine = 17;
font3x.tracking = -2;
@@ -248,14 +248,14 @@ public class PixelScene extends Scene {
v.y = align( c, v.y );
}
public static boolean noFade = false;
protected void fadeIn() {
if (noFade) {
noFade = false;
} else {
fadeIn( 0xFF000000, false );
}
}
public static boolean noFade = false;
protected void fadeIn() {
if (noFade) {
noFade = false;
} else {
fadeIn( 0xFF000000, false );
}
}
protected void fadeIn( int color, boolean light ) {
add( new Fader( color, light ) );
@@ -316,10 +316,10 @@ public class PixelScene extends Scene {
private static class PixelCamera extends Camera {
public PixelCamera( float zoom ) {
super(
(int)(Game.width - Math.ceil( Game.width / zoom ) * zoom) / 2,
(int)(Game.height - Math.ceil( Game.height / zoom ) * zoom) / 2,
(int)Math.ceil( Game.width / zoom ),
super(
(int)(Game.width - Math.ceil( Game.width / zoom ) * zoom) / 2,
(int)(Game.height - Math.ceil( Game.height / zoom ) * zoom) / 2,
(int)Math.ceil( Game.width / zoom ),
(int)Math.ceil( Game.height / zoom ), zoom );
}
@@ -105,30 +105,30 @@ public class RankingsScene extends PixelScene {
}
if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
BitmapText label = PixelScene.createText( TXT_TOTAL, 8 );
label.hardlight( 0xCCCCCC );
label.measure();
add( label );
BitmapText label = PixelScene.createText( TXT_TOTAL, 8 );
label.hardlight( 0xCCCCCC );
label.measure();
add( label );
BitmapText won = PixelScene.createText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 );
won.hardlight( Window.SHPX_COLOR );
won.measure();
add( won );
BitmapText won = PixelScene.createText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 );
won.hardlight( Window.SHPX_COLOR );
won.measure();
add( won );
BitmapText total = PixelScene.createText( "/" + Rankings.INSTANCE.totalNumber, 8 );
total.hardlight( 0xCCCCCC );
total.measure();
total.x = align( (w - total.width()) / 2 );
total.y = align( top + pos * rowHeight + GAP );
add( total );
BitmapText total = PixelScene.createText( "/" + Rankings.INSTANCE.totalNumber, 8 );
total.hardlight( 0xCCCCCC );
total.measure();
total.x = align( (w - total.width()) / 2 );
total.y = align( top + pos * rowHeight + GAP );
add( total );
float tw = label.width() + won.width() + total.width();
label.x = align( (w - tw) / 2 );
won.x = label.x + label.width();
total.x = won.x + won.width();
label.y = won.y = total.y = align( h - label.height() - GAP );
float tw = label.width() + won.width() + total.width();
label.x = align( (w - tw) / 2 );
won.x = label.x + label.width();
total.x = won.x + won.width();
label.y = won.y = total.y = align( h - label.height() - GAP );
}
}
} else {
@@ -141,16 +141,16 @@ public class RankingsScene extends PixelScene {
}
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
fadeIn();
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
}
public static class Record extends Button {
@@ -50,480 +50,480 @@ import com.watabou.utils.Callback;
public class StartScene extends PixelScene {
private static final float BUTTON_HEIGHT = 24;
private static final float GAP = 2;
private static final float BUTTON_HEIGHT = 24;
private static final float GAP = 2;
private static final String TXT_LOAD = "Load Game";
private static final String TXT_NEW = "New Game";
private static final String TXT_LOAD = "Load Game";
private static final String TXT_NEW = "New Game";
private static final String TXT_ERASE = "Erase current game";
private static final String TXT_DPTH_LVL = "Depth: %d, level: %d";
private static final String TXT_ERASE = "Erase current game";
private static final String TXT_DPTH_LVL = "Depth: %d, level: %d";
private static final String TXT_REALLY = "Do you really want to start new game?";
private static final String TXT_WARNING = "Your current game progress will be erased.";
private static final String TXT_YES = "Yes, start new game";
private static final String TXT_NO = "No, return to main menu";
private static final String TXT_UNLOCK = "To unlock this character class, slay the 3rd boss with any other class";
private static final String TXT_WIN_THE_GAME =
"To unlock \"Challenges\", win the game with any character class.";
private static final float WIDTH_P = 116;
private static final float HEIGHT_P = 220;
private static final float WIDTH_L = 224;
private static final float HEIGHT_L = 124;
private static HashMap<HeroClass, ClassShield> shields = new HashMap<HeroClass, ClassShield>();
private float buttonX;
private float buttonY;
private GameButton btnLoad;
private GameButton btnNewGame;
private boolean huntressUnlocked;
private Group unlock;
public static HeroClass curClass;
@Override
public void create() {
super.create();
Badges.loadGlobal();
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
float width, height;
if (ShatteredPixelDungeon.landscape()) {
width = WIDTH_L;
height = HEIGHT_L;
} else {
width = WIDTH_P;
height = HEIGHT_P;
}
float left = (w - width) / 2;
float top = (h - height) / 2;
float bottom = h - top;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
Image title = BannerSprites.get( Type.SELECT_YOUR_HERO );
title.x = align( (w - title.width()) / 2 );
title.y = align( top );
add( title );
buttonX = left;
buttonY = bottom - BUTTON_HEIGHT;
btnNewGame = new GameButton( TXT_NEW ) {
@Override
protected void onClick() {
if (GamesInProgress.check( curClass ) != null) {
StartScene.this.add( new WndOptions( TXT_REALLY, TXT_WARNING, TXT_YES, TXT_NO ) {
@Override
protected void onSelect( int index ) {
if (index == 0) {
startNewGame();
}
}
} );
} else {
startNewGame();
}
}
};
add( btnNewGame );
btnLoad = new GameButton( TXT_LOAD ) {
@Override
protected void onClick() {
InterlevelScene.mode = InterlevelScene.Mode.CONTINUE;
Game.switchScene( InterlevelScene.class );
}
};
add( btnLoad );
float centralHeight = buttonY - title.y - title.height();
HeroClass[] classes = {
HeroClass.WARRIOR, HeroClass.MAGE, HeroClass.ROGUE, HeroClass.HUNTRESS
};
for (HeroClass cl : classes) {
ClassShield shield = new ClassShield( cl );
shields.put( cl, shield );
add( shield );
}
if (ShatteredPixelDungeon.landscape()) {
float shieldW = width / 4;
float shieldH = Math.min( centralHeight, shieldW );
top = title.y + title.height + (centralHeight - shieldH) / 2;
for (int i=0; i < classes.length; i++) {
ClassShield shield = shields.get( classes[i] );
shield.setRect( left + i * shieldW, top, shieldW, shieldH );
}
ChallengeButton challenge = new ChallengeButton();
challenge.setPos(
w/2 - challenge.width()/2,
top + shieldH/2 - challenge.height()/2 );
add( challenge );
} else {
float shieldW = width / 2;
float shieldH = Math.min( centralHeight / 2, shieldW * 1.2f );
top = title.y + title.height() + centralHeight / 2 - shieldH;
for (int i=0; i < classes.length; i++) {
ClassShield shield = shields.get( classes[i] );
shield.setRect(
left + (i % 2) * shieldW,
top + (i / 2) * shieldH,
shieldW, shieldH );
}
ChallengeButton challenge = new ChallengeButton();
challenge.setPos(
w/2 - challenge.width()/2,
top + shieldH - challenge.height()/2 );
add( challenge );
}
unlock = new Group();
add( unlock );
if (!(huntressUnlocked = Badges.isUnlocked( Badges.Badge.BOSS_SLAIN_3 ))) {
BitmapTextMultiline text = PixelScene.createMultiline( TXT_UNLOCK, 9 );
text.maxWidth = (int)width;
text.measure();
float pos = (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2;
for (BitmapText line : text.new LineSplitter().split()) {
line.measure();
line.hardlight( 0xFFFF00 );
line.x = PixelScene.align( w / 2 - line.width() / 2 );
line.y = PixelScene.align( pos );
unlock.add( line );
pos += line.height();
}
}
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
curClass = null;
updateClass( HeroClass.values()[ShatteredPixelDungeon.lastClass()] );
fadeIn();
Badges.loadingListener = new Callback() {
@Override
public void call() {
if (Game.scene() == StartScene.this) {
ShatteredPixelDungeon.switchNoFade( StartScene.class );
}
}
};
}
@Override
public void destroy() {
Badges.saveGlobal();
Badges.loadingListener = null;
super.destroy();
}
private void updateClass( HeroClass cl ) {
if (curClass == cl) {
add( new WndClass( cl ) );
return;
}
if (curClass != null) {
shields.get( curClass ).highlight( false );
}
shields.get( curClass = cl ).highlight( true );
if (cl != HeroClass.HUNTRESS || huntressUnlocked) {
private static final String TXT_REALLY = "Do you really want to start new game?";
private static final String TXT_WARNING = "Your current game progress will be erased.";
private static final String TXT_YES = "Yes, start new game";
private static final String TXT_NO = "No, return to main menu";
private static final String TXT_UNLOCK = "To unlock this character class, slay the 3rd boss with any other class";
private static final String TXT_WIN_THE_GAME =
"To unlock \"Challenges\", win the game with any character class.";
private static final float WIDTH_P = 116;
private static final float HEIGHT_P = 220;
private static final float WIDTH_L = 224;
private static final float HEIGHT_L = 124;
private static HashMap<HeroClass, ClassShield> shields = new HashMap<HeroClass, ClassShield>();
private float buttonX;
private float buttonY;
private GameButton btnLoad;
private GameButton btnNewGame;
private boolean huntressUnlocked;
private Group unlock;
public static HeroClass curClass;
@Override
public void create() {
super.create();
Badges.loadGlobal();
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
float width, height;
if (ShatteredPixelDungeon.landscape()) {
width = WIDTH_L;
height = HEIGHT_L;
} else {
width = WIDTH_P;
height = HEIGHT_P;
}
float left = (w - width) / 2;
float top = (h - height) / 2;
float bottom = h - top;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
Image title = BannerSprites.get( Type.SELECT_YOUR_HERO );
title.x = align( (w - title.width()) / 2 );
title.y = align( top );
add( title );
buttonX = left;
buttonY = bottom - BUTTON_HEIGHT;
btnNewGame = new GameButton( TXT_NEW ) {
@Override
protected void onClick() {
if (GamesInProgress.check( curClass ) != null) {
StartScene.this.add( new WndOptions( TXT_REALLY, TXT_WARNING, TXT_YES, TXT_NO ) {
@Override
protected void onSelect( int index ) {
if (index == 0) {
startNewGame();
}
}
} );
} else {
startNewGame();
}
}
};
add( btnNewGame );
btnLoad = new GameButton( TXT_LOAD ) {
@Override
protected void onClick() {
InterlevelScene.mode = InterlevelScene.Mode.CONTINUE;
Game.switchScene( InterlevelScene.class );
}
};
add( btnLoad );
float centralHeight = buttonY - title.y - title.height();
HeroClass[] classes = {
HeroClass.WARRIOR, HeroClass.MAGE, HeroClass.ROGUE, HeroClass.HUNTRESS
};
for (HeroClass cl : classes) {
ClassShield shield = new ClassShield( cl );
shields.put( cl, shield );
add( shield );
}
if (ShatteredPixelDungeon.landscape()) {
float shieldW = width / 4;
float shieldH = Math.min( centralHeight, shieldW );
top = title.y + title.height + (centralHeight - shieldH) / 2;
for (int i=0; i < classes.length; i++) {
ClassShield shield = shields.get( classes[i] );
shield.setRect( left + i * shieldW, top, shieldW, shieldH );
}
ChallengeButton challenge = new ChallengeButton();
challenge.setPos(
w/2 - challenge.width()/2,
top + shieldH/2 - challenge.height()/2 );
add( challenge );
} else {
float shieldW = width / 2;
float shieldH = Math.min( centralHeight / 2, shieldW * 1.2f );
top = title.y + title.height() + centralHeight / 2 - shieldH;
for (int i=0; i < classes.length; i++) {
ClassShield shield = shields.get( classes[i] );
shield.setRect(
left + (i % 2) * shieldW,
top + (i / 2) * shieldH,
shieldW, shieldH );
}
ChallengeButton challenge = new ChallengeButton();
challenge.setPos(
w/2 - challenge.width()/2,
top + shieldH - challenge.height()/2 );
add( challenge );
}
unlock = new Group();
add( unlock );
if (!(huntressUnlocked = Badges.isUnlocked( Badges.Badge.BOSS_SLAIN_3 ))) {
BitmapTextMultiline text = PixelScene.createMultiline( TXT_UNLOCK, 9 );
text.maxWidth = (int)width;
text.measure();
float pos = (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2;
for (BitmapText line : text.new LineSplitter().split()) {
line.measure();
line.hardlight( 0xFFFF00 );
line.x = PixelScene.align( w / 2 - line.width() / 2 );
line.y = PixelScene.align( pos );
unlock.add( line );
pos += line.height();
}
}
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
curClass = null;
updateClass( HeroClass.values()[ShatteredPixelDungeon.lastClass()] );
fadeIn();
Badges.loadingListener = new Callback() {
@Override
public void call() {
if (Game.scene() == StartScene.this) {
ShatteredPixelDungeon.switchNoFade( StartScene.class );
}
}
};
}
@Override
public void destroy() {
Badges.saveGlobal();
Badges.loadingListener = null;
super.destroy();
}
private void updateClass( HeroClass cl ) {
if (curClass == cl) {
add( new WndClass( cl ) );
return;
}
if (curClass != null) {
shields.get( curClass ).highlight( false );
}
shields.get( curClass = cl ).highlight( true );
if (cl != HeroClass.HUNTRESS || huntressUnlocked) {
unlock.visible = false;
unlock.visible = false;
GamesInProgress.Info info = GamesInProgress.check( curClass );
if (info != null) {
GamesInProgress.Info info = GamesInProgress.check( curClass );
if (info != null) {
btnLoad.visible = true;
btnLoad.secondary( Utils.format( TXT_DPTH_LVL, info.depth, info.level ), info.challenges );
btnNewGame.visible = true;
btnNewGame.secondary( TXT_ERASE, false );
btnLoad.visible = true;
btnLoad.secondary( Utils.format( TXT_DPTH_LVL, info.depth, info.level ), info.challenges );
btnNewGame.visible = true;
btnNewGame.secondary( TXT_ERASE, false );
float w = (Camera.main.width - GAP) / 2 - buttonX;
float w = (Camera.main.width - GAP) / 2 - buttonX;
btnLoad.setRect(
buttonX, buttonY, w, BUTTON_HEIGHT );
btnNewGame.setRect(
btnLoad.right() + GAP, buttonY, w, BUTTON_HEIGHT );
btnLoad.setRect(
buttonX, buttonY, w, BUTTON_HEIGHT );
btnNewGame.setRect(
btnLoad.right() + GAP, buttonY, w, BUTTON_HEIGHT );
} else {
btnLoad.visible = false;
} else {
btnLoad.visible = false;
btnNewGame.visible = true;
btnNewGame.secondary( null, false );
btnNewGame.setRect( buttonX, buttonY, Camera.main.width - buttonX * 2, BUTTON_HEIGHT );
}
btnNewGame.visible = true;
btnNewGame.secondary( null, false );
btnNewGame.setRect( buttonX, buttonY, Camera.main.width - buttonX * 2, BUTTON_HEIGHT );
}
} else {
} else {
unlock.visible = true;
btnLoad.visible = false;
btnNewGame.visible = false;
unlock.visible = true;
btnLoad.visible = false;
btnNewGame.visible = false;
}
}
}
}
private void startNewGame() {
private void startNewGame() {
Dungeon.hero = null;
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
Dungeon.hero = null;
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
if (ShatteredPixelDungeon.intro()) {
ShatteredPixelDungeon.intro( false );
Game.switchScene( IntroScene.class );
} else {
Game.switchScene( InterlevelScene.class );
}
}
if (ShatteredPixelDungeon.intro()) {
ShatteredPixelDungeon.intro( false );
Game.switchScene( IntroScene.class );
} else {
Game.switchScene( InterlevelScene.class );
}
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
}
@Override
protected void onBackPressed() {
ShatteredPixelDungeon.switchNoFade( TitleScene.class );
}
private static class GameButton extends RedButton {
private static class GameButton extends RedButton {
private static final int SECONDARY_COLOR_N = 0xCACFC2;
private static final int SECONDARY_COLOR_H = 0xFFFF88;
private static final int SECONDARY_COLOR_N = 0xCACFC2;
private static final int SECONDARY_COLOR_H = 0xFFFF88;
private BitmapText secondary;
private BitmapText secondary;
public GameButton( String primary ) {
super( primary );
public GameButton( String primary ) {
super( primary );
this.secondary.text( null );
}
this.secondary.text( null );
}
@Override
protected void createChildren() {
super.createChildren();
@Override
protected void createChildren() {
super.createChildren();
secondary = createText( 6 );
add( secondary );
}
secondary = createText( 6 );
add( secondary );
}
@Override
protected void layout() {
super.layout();
@Override
protected void layout() {
super.layout();
if (secondary.text().length() > 0) {
text.y = align( y + (height - text.height() - secondary.baseLine()) / 2 );
if (secondary.text().length() > 0) {
text.y = align( y + (height - text.height() - secondary.baseLine()) / 2 );
secondary.x = align( x + (width - secondary.width()) / 2 );
secondary.y = align( text.y + text.height() );
} else {
text.y = align( y + (height - text.baseLine()) / 2 );
}
}
secondary.x = align( x + (width - secondary.width()) / 2 );
secondary.y = align( text.y + text.height() );
} else {
text.y = align( y + (height - text.baseLine()) / 2 );
}
}
public void secondary( String text, boolean highlighted ) {
secondary.text( text );
secondary.measure();
public void secondary( String text, boolean highlighted ) {
secondary.text( text );
secondary.measure();
secondary.hardlight( highlighted ? SECONDARY_COLOR_H : SECONDARY_COLOR_N );
}
}
secondary.hardlight( highlighted ? SECONDARY_COLOR_H : SECONDARY_COLOR_N );
}
}
private class ClassShield extends Button {
private class ClassShield extends Button {
private static final float MIN_BRIGHTNESS = 0.6f;
private static final float MIN_BRIGHTNESS = 0.6f;
private static final int BASIC_NORMAL = 0x444444;
private static final int BASIC_HIGHLIGHTED = 0xCACFC2;
private static final int BASIC_NORMAL = 0x444444;
private static final int BASIC_HIGHLIGHTED = 0xCACFC2;
private static final int MASTERY_NORMAL = 0x666644;
private static final int MASTERY_HIGHLIGHTED= 0xFFFF88;
private static final int MASTERY_NORMAL = 0x666644;
private static final int MASTERY_HIGHLIGHTED= 0xFFFF88;
private static final int WIDTH = 24;
private static final int HEIGHT = 32;
private static final float SCALE = 1.75f;
private static final int WIDTH = 24;
private static final int HEIGHT = 32;
private static final float SCALE = 1.75f;
private HeroClass cl;
private HeroClass cl;
private Image avatar;
private BitmapText name;
private Emitter emitter;
private Image avatar;
private BitmapText name;
private Emitter emitter;
private float brightness;
private float brightness;
private int normal;
private int highlighted;
private int normal;
private int highlighted;
public ClassShield( HeroClass cl ) {
super();
public ClassShield( HeroClass cl ) {
super();
this.cl = cl;
this.cl = cl;
avatar.frame( cl.ordinal() * WIDTH, 0, WIDTH, HEIGHT );
avatar.scale.set( SCALE );
avatar.frame( cl.ordinal() * WIDTH, 0, WIDTH, HEIGHT );
avatar.scale.set( SCALE );
if (Badges.isUnlocked( cl.masteryBadge() )) {
normal = MASTERY_NORMAL;
highlighted = MASTERY_HIGHLIGHTED;
} else {
normal = BASIC_NORMAL;
highlighted = BASIC_HIGHLIGHTED;
}
if (Badges.isUnlocked( cl.masteryBadge() )) {
normal = MASTERY_NORMAL;
highlighted = MASTERY_HIGHLIGHTED;
} else {
normal = BASIC_NORMAL;
highlighted = BASIC_HIGHLIGHTED;
}
name.text( cl.name() );
name.measure();
name.hardlight( normal );
name.text( cl.name() );
name.measure();
name.hardlight( normal );
brightness = MIN_BRIGHTNESS;
updateBrightness();
}
brightness = MIN_BRIGHTNESS;
updateBrightness();
}
@Override
protected void createChildren() {
@Override
protected void createChildren() {
super.createChildren();
super.createChildren();
avatar = new Image( Assets.AVATARS );
add( avatar );
avatar = new Image( Assets.AVATARS );
add( avatar );
name = PixelScene.createText( 9 );
add( name );
name = PixelScene.createText( 9 );
add( name );
emitter = new Emitter();
add( emitter );
}
emitter = new Emitter();
add( emitter );
}
@Override
protected void layout() {
@Override
protected void layout() {
super.layout();
super.layout();
avatar.x = align( x + (width - avatar.width()) / 2 );
avatar.y = align( y + (height - avatar.height() - name.height()) / 2 );
avatar.x = align( x + (width - avatar.width()) / 2 );
avatar.y = align( y + (height - avatar.height() - name.height()) / 2 );
name.x = align( x + (width - name.width()) / 2 );
name.y = avatar.y + avatar.height() + SCALE;
name.x = align( x + (width - name.width()) / 2 );
name.y = avatar.y + avatar.height() + SCALE;
emitter.pos( avatar.x, avatar.y, avatar.width(), avatar.height() );
}
emitter.pos( avatar.x, avatar.y, avatar.width(), avatar.height() );
}
@Override
protected void onTouchDown() {
@Override
protected void onTouchDown() {
emitter.revive();
emitter.start( Speck.factory( Speck.LIGHT ), 0.05f, 7 );
emitter.revive();
emitter.start( Speck.factory( Speck.LIGHT ), 0.05f, 7 );
Sample.INSTANCE.play( Assets.SND_CLICK, 1, 1, 1.2f );
updateClass( cl );
}
Sample.INSTANCE.play( Assets.SND_CLICK, 1, 1, 1.2f );
updateClass( cl );
}
@Override
public void update() {
super.update();
@Override
public void update() {
super.update();
if (brightness < 1.0f && brightness > MIN_BRIGHTNESS) {
if ((brightness -= Game.elapsed) <= MIN_BRIGHTNESS) {
brightness = MIN_BRIGHTNESS;
}
updateBrightness();
}
}
if (brightness < 1.0f && brightness > MIN_BRIGHTNESS) {
if ((brightness -= Game.elapsed) <= MIN_BRIGHTNESS) {
brightness = MIN_BRIGHTNESS;
}
updateBrightness();
}
}
public void highlight( boolean value ) {
if (value) {
brightness = 1.0f;
name.hardlight( highlighted );
} else {
brightness = 0.999f;
name.hardlight( normal );
}
public void highlight( boolean value ) {
if (value) {
brightness = 1.0f;
name.hardlight( highlighted );
} else {
brightness = 0.999f;
name.hardlight( normal );
}
updateBrightness();
}
updateBrightness();
}
private void updateBrightness() {
avatar.gm = avatar.bm = avatar.rm = avatar.am = brightness;
}
}
private void updateBrightness() {
avatar.gm = avatar.bm = avatar.rm = avatar.am = brightness;
}
}
private class ChallengeButton extends Button {
private class ChallengeButton extends Button {
private Image image;
private Image image;
public ChallengeButton() {
super();
public ChallengeButton() {
super();
width = image.width;
height = image.height;
width = image.width;
height = image.height;
image.am = Badges.isUnlocked( Badges.Badge.VICTORY ) ? 1.0f : 0.5f;
}
image.am = Badges.isUnlocked( Badges.Badge.VICTORY ) ? 1.0f : 0.5f;
}
@Override
protected void createChildren() {
@Override
protected void createChildren() {
super.createChildren();
super.createChildren();
image = Icons.get( ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF );
add( image );
}
image = Icons.get( ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF );
add( image );
}
@Override
protected void layout() {
@Override
protected void layout() {
super.layout();
super.layout();
image.x = align( x );
image.y = align( y );
}
image.x = align( x );
image.y = align( y );
}
@Override
protected void onClick() {
if (Badges.isUnlocked( Badges.Badge.VICTORY )) {
StartScene.this.add(new WndChallenges(ShatteredPixelDungeon.challenges(), true) {
public void onBackPressed() {
super.onBackPressed();
image.copy( Icons.get( ShatteredPixelDungeon.challenges() > 0 ?
Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) );
};
} );
} else {
StartScene.this.add( new WndMessage( TXT_WIN_THE_GAME ) );
}
}
@Override
protected void onClick() {
if (Badges.isUnlocked( Badges.Badge.VICTORY )) {
StartScene.this.add(new WndChallenges(ShatteredPixelDungeon.challenges(), true) {
public void onBackPressed() {
super.onBackPressed();
image.copy( Icons.get( ShatteredPixelDungeon.challenges() > 0 ?
Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) );
};
} );
} else {
StartScene.this.add( new WndMessage( TXT_WIN_THE_GAME ) );
}
}
@Override
protected void onTouchDown() {
Sample.INSTANCE.play( Assets.SND_CLICK );
}
}
@Override
protected void onTouchDown() {
Sample.INSTANCE.play( Assets.SND_CLICK );
}
}
}
@@ -242,8 +242,8 @@ public class SurfaceScene extends PixelScene {
script.camera( camera() );
script.uModel.valueM4( matrix );
script.lighting(
rm, gm, bm, am,
script.lighting(
rm, gm, bm, am,
ra, ga, ba, aa );
script.drawQuad( verticesBuffer );
@@ -50,14 +50,14 @@ public class TitleScene extends PixelScene {
int gameversion = ShatteredPixelDungeon.version();
int gameversion = ShatteredPixelDungeon.version();
if (gameversion != Game.versionCode) {
//new intro, make older players see it again.
if (gameversion < 9)
ShatteredPixelDungeon.intro(true);
Game.switchScene(WelcomeScene.class);
}
if (gameversion != Game.versionCode) {
//new intro, make older players see it again.
if (gameversion < 9)
ShatteredPixelDungeon.intro(true);
Game.switchScene(WelcomeScene.class);
}
Music.INSTANCE.play( Assets.THEME, true );
Music.INSTANCE.volume( 1f );
@@ -104,7 +104,7 @@ public class TitleScene extends PixelScene {
DashboardItem btnBadges = new DashboardItem( TXT_BADGES, 3 ) {
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( BadgesScene.class );
ShatteredPixelDungeon.switchNoFade( BadgesScene.class );
}
};
add( btnBadges );
@@ -112,7 +112,7 @@ public class TitleScene extends PixelScene {
DashboardItem btnAbout = new DashboardItem( TXT_ABOUT, 1 ) {
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( AboutScene.class );
ShatteredPixelDungeon.switchNoFade( AboutScene.class );
}
};
add( btnAbout );
@@ -120,7 +120,7 @@ public class TitleScene extends PixelScene {
DashboardItem btnPlay = new DashboardItem( TXT_PLAY, 0 ) {
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( StartScene.class );
ShatteredPixelDungeon.switchNoFade( StartScene.class );
}
};
add( btnPlay );
@@ -128,7 +128,7 @@ public class TitleScene extends PixelScene {
DashboardItem btnHighscores = new DashboardItem( TXT_HIGHSCORES, 2 ) {
@Override
protected void onClick() {
ShatteredPixelDungeon.switchNoFade( RankingsScene.class );
ShatteredPixelDungeon.switchNoFade( RankingsScene.class );
}
};
add( btnHighscores );
@@ -146,28 +146,28 @@ public class TitleScene extends PixelScene {
btnHighscores.setPos( w / 2, btnPlay.top() );
}
BitmapText source = new BitmapText( "PD v 1.7.5", font1x );
source.measure();
source.hardlight( 0x444444 );
source.x = w - source.width();
source.y = h - source.height();
add( source );
BitmapText source = new BitmapText( "PD v 1.7.5", font1x );
source.measure();
source.hardlight( 0x444444 );
source.x = w - source.width();
source.y = h - source.height();
add( source );
BitmapText version = new BitmapText( "v " + Game.version + "", font1x );
version.measure();
version.hardlight( 0xCCCCCC );
version.x = w - version.width();
version.y = h - version.height() - source.height();
BitmapText version = new BitmapText( "v " + Game.version + "", font1x );
version.measure();
version.hardlight( 0xCCCCCC );
version.x = w - version.width();
version.y = h - version.height() - source.height();
add( version );
add( version );
PrefsButton btnPrefs = new PrefsButton();
btnPrefs.setPos( 0, 0 );
add( btnPrefs );
ExitButton btnExit = new ExitButton();
btnExit.setPos( w - btnExit.width(), 0 );
add( btnExit );
ExitButton btnExit = new ExitButton();
btnExit.setPos( w - btnExit.width(), 0 );
add( btnExit );
fadeIn();
}
@@ -17,219 +17,219 @@ import com.watabou.noosa.ui.Component;
//TODO: update this class with relevant info as new versions come out.
public class WelcomeScene extends PixelScene {
private static final String TTL_Welcome = "Welcome!";
private static final String TTL_Welcome = "Welcome!";
private static final String TTL_Update = "v0.3.0: The Wand Rework!";
private static final String TTL_Update = "v0.3.0: The Wand Rework!";
private static final String TTL_Future = "Wait What?";
private static final String TTL_Future = "Wait What?";
private static final String TXT_Welcome =
"Shattered Pixel Dungeon is a rework/expansion of Watabou's Pixel Dungeon.\n\n"+
"The goal is to enhance the game by improving existing content and adding tonnes of new stuff!\n\n"+
"Shattered Pixel Dungeon is being constantly updated, so expect more new content soon!\n\n"+
"Happy Dungeoneering!";
private static final String TXT_Welcome =
"Shattered Pixel Dungeon is a rework/expansion of Watabou's Pixel Dungeon.\n\n"+
"The goal is to enhance the game by improving existing content and adding tonnes of new stuff!\n\n"+
"Shattered Pixel Dungeon is being constantly updated, so expect more new content soon!\n\n"+
"Happy Dungeoneering!";
private static final String TXT_Update =
"v0.3.0d:\n" +
"- Various bugfixes\n" +
"\n" +
"v0.3.0c:\n" +
"- Lots of under-the-hood changes\n" +
"(let me know if you run into any bugs)\n" +
"- Many bugfixes\n" +
"Rebalances:\n" +
"- Wand of Corruption & Venom rebalanced.\n" +
"- Mages staff now has +1 max charges\n" +
"- Mage now partially IDs wands on use\n" +
"- Magic missile wand reduced to 3 max charges\n" +
"- Warlock gets more recharge from food\n" +
"- Battlemage only recharges his staff\n" +
"- Many battlemage effects tweaked\n" +
"- Yog Dzewa now heals 1hp per turn\n" +
"\n" +
"v0.3.0b & v0.3.0a:\n" +
"- Fixed many bugs\n" +
"- Buffed mage and huntress base damages to compensate for increased rat numbers on floor 1.\n" +
"\n" +
"v0.3.0:\n" +
"Mage reworked!:\n" +
"- No longer starts with knuckledusters or a wand\n" +
"- Can no longer equip wands\n" +
"- Now starts with a unique mages staff, empowered with magic missile to start.\n" +
"- Battlemage reworked, staff now deals bonus effects when used as a melee weapon.\n" +
"- Warlock reworked, gains more health and fullness from gaining exp, but food no longer restores hunger.\n" +
"\n" +
"General Wand Changes:\n" +
"- Wand types are now known by default.\n" +
"- Wands now each have unique sprites.\n" +
"- Wands now cap at 10 charges instead of 9\n" +
"- Wands now recharge faster the more charges are missing, for all classes.\n" +
"- Self-targeting with wands is no longer possible.\n" +
"- Wand recharge effects now give charge over time, instead of instantly.\n" +
"- Wands can now be cursed!\n" +
"\n" +
"All wands have been reworked!\n" +
"\n" +
"Removed wands:\n" +
"- Flock\n" +
"- Blink\n" +
"- Teleportation\n" +
"- Avalanche\n" +
"\n" +
"Reworked wands:\n" +
"- Magic Missile\n" +
"- Lightning\n" +
"- Disintegration\n" +
"- Fireblast (previously Firebolt)\n" +
"- Venom (previously poison)\n" +
"- Frost (previously Slowing)\n" +
"- Blast Wave (previously Telekinesis)\n" +
"- Corruption (previously Amok)\n" +
"- Regrowth\n" +
"\n" +
"New Wands:\n" +
"- Prismatic Light\n" +
"- Transfusion\n" +
"\n" +
"New Artifacts:\n" +
"- Ethereal Chains\n" +
"- Lloyd's Beacon\n" +
"\n" +
"Misc. Balance changes:\n" +
"- Blessed Ankhs now revive at 1/4hp, but also grant initiative.\n" +
"- Alchemist's Toolkit removed (will be reworked)\n" +
"- Chalice of blood nerfed, now regens less hp at high levels.\n" +
"- Cape of Thorns buffed, now absorbs all damage, but only deflects adjacent attacks.\n" +
"- Sandals of nature adjusted, now give more seeds, less dew.\n" +
"- Hunger no longer increases while fighting bosses.\n" +
"- Floor 1 now spawns 10 rats every time, exactly enough to level up.\n" +
"- Scrolls of recharging and mirror image are now more common.\n" +
"- Mimics are now less common, stronger, & give better loot.\n" +
"\n" +
"UI tweaks:\n" +
"- New app icon!\n" +
"- Shading added to main game interface\n" +
"- Buffs now have descriptions, tap their icons!\n" +
"- Visual indicator added for surprising enemies";
private static final String TXT_Update =
"v0.3.0d:\n" +
"- Various bugfixes\n" +
"\n" +
"v0.3.0c:\n" +
"- Lots of under-the-hood changes\n" +
"(let me know if you run into any bugs)\n" +
"- Many bugfixes\n" +
"Rebalances:\n" +
"- Wand of Corruption & Venom rebalanced.\n" +
"- Mages staff now has +1 max charges\n" +
"- Mage now partially IDs wands on use\n" +
"- Magic missile wand reduced to 3 max charges\n" +
"- Warlock gets more recharge from food\n" +
"- Battlemage only recharges his staff\n" +
"- Many battlemage effects tweaked\n" +
"- Yog Dzewa now heals 1hp per turn\n" +
"\n" +
"v0.3.0b & v0.3.0a:\n" +
"- Fixed many bugs\n" +
"- Buffed mage and huntress base damages to compensate for increased rat numbers on floor 1.\n" +
"\n" +
"v0.3.0:\n" +
"Mage reworked!:\n" +
"- No longer starts with knuckledusters or a wand\n" +
"- Can no longer equip wands\n" +
"- Now starts with a unique mages staff, empowered with magic missile to start.\n" +
"- Battlemage reworked, staff now deals bonus effects when used as a melee weapon.\n" +
"- Warlock reworked, gains more health and fullness from gaining exp, but food no longer restores hunger.\n" +
"\n" +
"General Wand Changes:\n" +
"- Wand types are now known by default.\n" +
"- Wands now each have unique sprites.\n" +
"- Wands now cap at 10 charges instead of 9\n" +
"- Wands now recharge faster the more charges are missing, for all classes.\n" +
"- Self-targeting with wands is no longer possible.\n" +
"- Wand recharge effects now give charge over time, instead of instantly.\n" +
"- Wands can now be cursed!\n" +
"\n" +
"All wands have been reworked!\n" +
"\n" +
"Removed wands:\n" +
"- Flock\n" +
"- Blink\n" +
"- Teleportation\n" +
"- Avalanche\n" +
"\n" +
"Reworked wands:\n" +
"- Magic Missile\n" +
"- Lightning\n" +
"- Disintegration\n" +
"- Fireblast (previously Firebolt)\n" +
"- Venom (previously poison)\n" +
"- Frost (previously Slowing)\n" +
"- Blast Wave (previously Telekinesis)\n" +
"- Corruption (previously Amok)\n" +
"- Regrowth\n" +
"\n" +
"New Wands:\n" +
"- Prismatic Light\n" +
"- Transfusion\n" +
"\n" +
"New Artifacts:\n" +
"- Ethereal Chains\n" +
"- Lloyd's Beacon\n" +
"\n" +
"Misc. Balance changes:\n" +
"- Blessed Ankhs now revive at 1/4hp, but also grant initiative.\n" +
"- Alchemist's Toolkit removed (will be reworked)\n" +
"- Chalice of blood nerfed, now regens less hp at high levels.\n" +
"- Cape of Thorns buffed, now absorbs all damage, but only deflects adjacent attacks.\n" +
"- Sandals of nature adjusted, now give more seeds, less dew.\n" +
"- Hunger no longer increases while fighting bosses.\n" +
"- Floor 1 now spawns 10 rats every time, exactly enough to level up.\n" +
"- Scrolls of recharging and mirror image are now more common.\n" +
"- Mimics are now less common, stronger, & give better loot.\n" +
"\n" +
"UI tweaks:\n" +
"- New app icon!\n" +
"- Shading added to main game interface\n" +
"- Buffs now have descriptions, tap their icons!\n" +
"- Visual indicator added for surprising enemies";
private static final String TXT_Future =
"It seems that your current saves are from a future version of Shattered Pixel Dungeon!\n\n"+
"Either you're messing around with older versions of the app, or something has gone buggy.\n\n"+
"Regardless, tread with caution! Your saves may contain things which don't exist in this version, "+
"this could cause some very weird errors to occur.";
private static final String TXT_Future =
"It seems that your current saves are from a future version of Shattered Pixel Dungeon!\n\n"+
"Either you're messing around with older versions of the app, or something has gone buggy.\n\n"+
"Regardless, tread with caution! Your saves may contain things which don't exist in this version, "+
"this could cause some very weird errors to occur.";
private static final String LNK = "https://play.google.com/store/apps/details?id=com.shatteredpixel.shatteredpixeldungeon";
private static final String LNK = "https://play.google.com/store/apps/details?id=com.shatteredpixel.shatteredpixeldungeon";
@Override
public void create() {
super.create();
@Override
public void create() {
super.create();
final int gameversion = ShatteredPixelDungeon.version();
final int gameversion = ShatteredPixelDungeon.version();
BitmapTextMultiline title;
BitmapTextMultiline text;
BitmapTextMultiline title;
BitmapTextMultiline text;
if (gameversion == 0) {
if (gameversion == 0) {
text = createMultiline(TXT_Welcome, 8);
title = createMultiline(TTL_Welcome, 16);
text = createMultiline(TXT_Welcome, 8);
title = createMultiline(TTL_Welcome, 16);
} else if (gameversion <= Game.versionCode) {
} else if (gameversion <= Game.versionCode) {
text = createMultiline(TXT_Update, 6 );
title = createMultiline(TTL_Update, 9 );
text = createMultiline(TXT_Update, 6 );
title = createMultiline(TTL_Update, 9 );
} else {
} else {
text = createMultiline( TXT_Future, 8 );
title = createMultiline( TTL_Future, 16 );
text = createMultiline( TXT_Future, 8 );
title = createMultiline( TTL_Future, 16 );
}
}
int w = Camera.main.width;
int h = Camera.main.height;
int w = Camera.main.width;
int h = Camera.main.height;
int pw = w - 10;
int ph = h - 50;
int pw = w - 10;
int ph = h - 50;
title.maxWidth = pw;
title.measure();
title.hardlight(Window.SHPX_COLOR);
title.maxWidth = pw;
title.measure();
title.hardlight(Window.SHPX_COLOR);
title.x = align( (w - title.width()) / 2 );
title.y = align( 8 );
add( title );
title.x = align( (w - title.width()) / 2 );
title.y = align( 8 );
add( title );
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.size( pw, ph );
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add( panel );
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.size( pw, ph );
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add( panel );
ScrollPane list = new ScrollPane( new Component() );
add( list );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight());
list.scrollTo( 0, 0 );
ScrollPane list = new ScrollPane( new Component() );
add( list );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight());
list.scrollTo( 0, 0 );
Component content = list.content();
content.clear();
Component content = list.content();
content.clear();
text.maxWidth = (int) panel.innerWidth();
text.measure();
text.maxWidth = (int) panel.innerWidth();
text.measure();
content.add(text);
content.add(text);
content.setSize( panel.innerWidth(), text.height() );
content.setSize( panel.innerWidth(), text.height() );
RedButton okay = new RedButton("Okay!") {
@Override
protected void onClick() {
RedButton okay = new RedButton("Okay!") {
@Override
protected void onClick() {
if (gameversion <= 32){
//removes all bags bought badge from pre-0.2.4 saves.
Badges.disown(Badges.Badge.ALL_BAGS_BOUGHT);
Badges.saveGlobal();
if (gameversion <= 32){
//removes all bags bought badge from pre-0.2.4 saves.
Badges.disown(Badges.Badge.ALL_BAGS_BOUGHT);
Badges.saveGlobal();
//imports new ranking data for pre-0.2.3 saves.
if (gameversion <= 29){
Rankings.INSTANCE.load();
Rankings.INSTANCE.save();
}
}
//imports new ranking data for pre-0.2.3 saves.
if (gameversion <= 29){
Rankings.INSTANCE.load();
Rankings.INSTANCE.save();
}
}
ShatteredPixelDungeon.version(Game.versionCode);
Game.switchScene(TitleScene.class);
}
};
ShatteredPixelDungeon.version(Game.versionCode);
Game.switchScene(TitleScene.class);
}
};
/*
okay.setRect(text.x, text.y + text.height() + 5, 55, 18);
add(okay);
/*
okay.setRect(text.x, text.y + text.height() + 5, 55, 18);
add(okay);
RedButton changes = new RedButton("Changes") {
@Override
protected void onClick() {
parent.add(new WndChanges());
}
};
RedButton changes = new RedButton("Changes") {
@Override
protected void onClick() {
parent.add(new WndChanges());
}
};
changes.setRect(text.x + 65, text.y + text.height() + 5, 55, 18);
add(changes);*/
changes.setRect(text.x + 65, text.y + text.height() + 5, 55, 18);
add(changes);*/
okay.setRect((w - pw) / 2, h - 22, pw, 18);
add(okay);
okay.setRect((w - pw) / 2, h - 22, pw, 18);
add(okay);
Archs archs = new Archs();
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
Archs archs = new Archs();
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
fadeIn();
}
fadeIn();
}
}