From 30e1947f182312706d6ce4321c4a66fd7dae0227 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 1 Feb 2016 16:20:31 -0500 Subject: [PATCH] v0.3.4: layout improvements to new welcome scene --- .../scenes/WelcomeScene.java | 96 ++++++++++++------- 1 file changed, 60 insertions(+), 36 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index 8666233a9..7f0f51940 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -75,49 +75,36 @@ public class WelcomeScene extends PixelScene { signs.y = title.y; add( signs ); - RedButton okay = new RedButton("Continue"){ - - { - bg.brightness(0.4f); - } - - @Override - protected void onTouchDown() { - bg.brightness(0.5f); - Sample.INSTANCE.play( Assets.SND_CLICK ); - } - + DarkRedButton okay = new DarkRedButton("Continue"){ @Override protected void onClick() { super.onClick(); - - if (previousVersion <= 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 (previousVersion <= 29){ - Rankings.INSTANCE.load(); - Rankings.INSTANCE.save(); - } - } - - - ShatteredPixelDungeon.version(ShatteredPixelDungeon.versionCode); + updateVersion(previousVersion); ShatteredPixelDungeon.switchScene(TitleScene.class); } - - @Override - protected void onTouchUp() { - super.onTouchUp(); - bg.brightness(0.4f); - } }; - okay.setRect(title.x, h-22, title.width(), 20); - okay.textColor(0xBBBB33); - add(okay); + if (previousVersion != 0){ + DarkRedButton changes = new DarkRedButton("Changelist"){ + @Override + protected void onClick() { + super.onClick(); + updateVersion(previousVersion); + ShatteredPixelDungeon.switchScene(ChangesScene.class); + } + }; + okay.setRect(title.x, h-20, (title.width()/2)-2, 16); + okay.textColor(0xBBBB33); + add(okay); + + changes.setRect(okay.right()+2, h-20, (title.width()/2)-2, 16); + changes.textColor(0xBBBB33); + add(changes); + } else { + okay.setRect(title.x, h-20, title.width(), 16); + okay.textColor(0xBBBB33); + add(okay); + } RenderedTextMultiline text = PixelScene.renderMultiline(6); if (previousVersion == 0) { @@ -132,9 +119,46 @@ public class WelcomeScene extends PixelScene { } + private void updateVersion(int previousVersion){ + if (previousVersion <= 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 (previousVersion <= 29){ + Rankings.INSTANCE.load(); + Rankings.INSTANCE.save(); + } + } + ShatteredPixelDungeon.version(ShatteredPixelDungeon.versionCode); + } + private void placeTorch( float x, float y ) { Fireball fb = new Fireball(); fb.setPos( x, y ); add( fb ); } + + private class DarkRedButton extends RedButton{ + { + bg.brightness(0.4f); + } + + DarkRedButton(String text){ + super(text); + } + + @Override + protected void onTouchDown() { + bg.brightness(0.5f); + Sample.INSTANCE.play( Assets.SND_CLICK ); + } + + @Override + protected void onTouchUp() { + super.onTouchUp(); + bg.brightness(0.4f); + } + } }