v0.3.4: implemented new welcome scene
This commit is contained in:
parent
d71e3dceee
commit
1b28281f2c
|
@ -40,7 +40,7 @@ import java.util.Locale;
|
|||
public class ShatteredPixelDungeon extends Game {
|
||||
|
||||
public ShatteredPixelDungeon() {
|
||||
super( TitleScene.class );
|
||||
super( WelcomeScene.class );
|
||||
|
||||
// 0.2.4
|
||||
com.watabou.utils.Bundle.addAlias(
|
||||
|
|
|
@ -22,19 +22,15 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
|||
|
||||
import android.opengl.GLES20;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.BannerSprites;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Fireball;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ChangesButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.LanguageButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHardNotification;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
|
@ -53,7 +49,6 @@ public class TitleScene extends PixelScene {
|
|||
|
||||
super.create();
|
||||
|
||||
|
||||
Music.INSTANCE.play( Assets.THEME, true );
|
||||
Music.INSTANCE.volume( ShatteredPixelDungeon.musicVol() / 10f );
|
||||
|
||||
|
@ -163,45 +158,6 @@ public class TitleScene extends PixelScene {
|
|||
ExitButton btnExit = new ExitButton();
|
||||
btnExit.setPos( w - btnExit.width(), 0 );
|
||||
add( btnExit );
|
||||
|
||||
int gameversion = ShatteredPixelDungeon.version();
|
||||
|
||||
if (gameversion != Game.versionCode) {
|
||||
if (gameversion < 65){
|
||||
//TODO special code for 0.3.2 update to notify people about mastery book changes. Remove when not needed
|
||||
Badges.loadGlobal();
|
||||
|
||||
if (Badges.isUnlocked(Badges.Badge.MASTERY_WARRIOR) ||
|
||||
Badges.isUnlocked(Badges.Badge.MASTERY_ROGUE) ||
|
||||
Badges.isUnlocked(Badges.Badge.MASTERY_MAGE) ||
|
||||
Badges.isUnlocked(Badges.Badge.MASTERY_HUNTRESS) ){
|
||||
add(new WndHardNotification(new ItemSprite(ItemSpriteSheet.MASTERY, null),
|
||||
"Mastery Book Changes",
|
||||
"v0.3.2 brings new prison content and some big balance changes to subclasses:\n" +
|
||||
"\n" +
|
||||
"_The Book of Mastery is no longer given at floor 1, it is only dropped by Tengu._\n" +
|
||||
"\n" +
|
||||
"There have been balance tweaks to accommodate this, so the difficulty should be similar.\n" +
|
||||
"\n" +
|
||||
"This change is necessary to allow for more interesting subclasses in the future, " +
|
||||
"apologies for any frustration.",
|
||||
"See All Changes", 10){
|
||||
@Override
|
||||
public void hide() {
|
||||
super.hide();
|
||||
Game.switchScene(ChangesScene.class);
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Game.switchScene(ChangesScene.class);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
Game.switchScene(ChangesScene.class);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fadeIn();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,140 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||
|
||||
/**
|
||||
* Created by Evan on 31/01/2016.
|
||||
*/
|
||||
public class WelcomeScene {
|
||||
import android.opengl.GLES20;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.BannerSprites;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Fireball;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
public class WelcomeScene extends PixelScene {
|
||||
|
||||
private static final String TXT_Welcome =
|
||||
"Shattered Pixel Dungeon is a roguelike RPG, with randomly generated enemies, levels, items, and traps!\n" +
|
||||
"\n" +
|
||||
"Each run is a new challenging experience, but be careful, death is permanent!\n" +
|
||||
"\n" +
|
||||
"Happy Dungeoneering!";
|
||||
|
||||
private static final String TXT_Update =
|
||||
"add something here on next update.";
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
super.create();
|
||||
|
||||
final int previousVersion = ShatteredPixelDungeon.version();
|
||||
|
||||
if (ShatteredPixelDungeon.versionCode == previousVersion) {
|
||||
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
|
||||
return;
|
||||
}
|
||||
|
||||
uiCamera.visible = false;
|
||||
|
||||
int w = Camera.main.width;
|
||||
int h = Camera.main.height;
|
||||
|
||||
Image title = BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON );
|
||||
title.brightness(0.5f);
|
||||
add( title );
|
||||
|
||||
float height = title.height +
|
||||
(ShatteredPixelDungeon.landscape() ? 48 : 96);
|
||||
|
||||
title.x = (w - title.width()) / 2;
|
||||
title.y = (h - height) / 2;
|
||||
|
||||
placeTorch(title.x + 18, title.y + 20);
|
||||
placeTorch(title.x + title.width - 18, title.y + 20);
|
||||
|
||||
Image signs = new Image( BannerSprites.get( BannerSprites.Type.PIXEL_DUNGEON_SIGNS ) ) {
|
||||
private float time = 0;
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
am = (float)Math.sin( -(time += Game.elapsed) );
|
||||
}
|
||||
@Override
|
||||
public void draw() {
|
||||
GLES20.glBlendFunc( GL10.GL_SRC_ALPHA, GL10.GL_ONE );
|
||||
super.draw();
|
||||
GLES20.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
};
|
||||
signs.x = title.x;
|
||||
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 );
|
||||
}
|
||||
|
||||
@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);
|
||||
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);
|
||||
|
||||
RenderedTextMultiline text = PixelScene.renderMultiline(6);
|
||||
if (previousVersion == 0) {
|
||||
text.text(TXT_Welcome, w - 20);
|
||||
} else {
|
||||
text.text(TXT_Update, w - 20);
|
||||
}
|
||||
float textSpace = h - title.y - (title.height() - 10) - okay.height() - 2;
|
||||
text.setPos(10, title.y+(title.height() - 10) + ((textSpace - text.height()) / 2));
|
||||
text.hardlight(0xAAAAAA);
|
||||
add(text);
|
||||
|
||||
}
|
||||
|
||||
private void placeTorch( float x, float y ) {
|
||||
Fireball fb = new Fireball();
|
||||
fb.setPos( x, y );
|
||||
add( fb );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user