v0.3.4: layout improvements to new welcome scene

This commit is contained in:
Evan Debenham 2016-02-01 16:20:31 -05:00
parent 1b28281f2c
commit 30e1947f18

View File

@ -75,50 +75,37 @@ public class WelcomeScene extends PixelScene {
signs.y = title.y; signs.y = title.y;
add( signs ); add( signs );
RedButton okay = new RedButton("Continue"){ DarkRedButton okay = new DarkRedButton("Continue"){
{
bg.brightness(0.4f);
}
@Override
protected void onTouchDown() {
bg.brightness(0.5f);
Sample.INSTANCE.play( Assets.SND_CLICK );
}
@Override @Override
protected void onClick() { protected void onClick() {
super.onClick(); super.onClick();
updateVersion(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);
ShatteredPixelDungeon.switchScene(TitleScene.class); ShatteredPixelDungeon.switchScene(TitleScene.class);
} }
@Override
protected void onTouchUp() {
super.onTouchUp();
bg.brightness(0.4f);
}
}; };
okay.setRect(title.x, h-22, title.width(), 20); 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); okay.textColor(0xBBBB33);
add(okay); 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); RenderedTextMultiline text = PixelScene.renderMultiline(6);
if (previousVersion == 0) { if (previousVersion == 0) {
text.text(TXT_Welcome, w - 20); text.text(TXT_Welcome, w - 20);
@ -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 ) { private void placeTorch( float x, float y ) {
Fireball fb = new Fireball(); Fireball fb = new Fireball();
fb.setPos( x, y ); fb.setPos( x, y );
add( fb ); 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);
}
}
} }