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,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);
}
}
}