v1.2.1: added a new game and menu button after game over
This commit is contained in:
parent
4fc020d6e3
commit
061a28dd4b
|
@ -1758,7 +1758,13 @@ public class Hero extends Char {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Game.runOnRenderThread(new Callback() {
|
||||||
|
@Override
|
||||||
|
public void call() {
|
||||||
GameScene.gameOver();
|
GameScene.gameOver();
|
||||||
|
Sample.INSTANCE.play( Assets.Sounds.DEATH );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (cause instanceof Hero.Doom) {
|
if (cause instanceof Hero.Doom) {
|
||||||
((Hero.Doom)cause).onDeath();
|
((Hero.Doom)cause).onDeath();
|
||||||
|
|
|
@ -24,7 +24,9 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
|
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
|
@ -90,6 +92,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ResumeIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.ResumeIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RightClickMenu;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RightClickMenu;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.StatusPane;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Tag;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Tag;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Toast;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Toast;
|
||||||
|
@ -104,6 +107,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoItem;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoMob;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoMob;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoPlant;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoTrap;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoTrap;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndKeyBindings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndResurrect;
|
||||||
|
@ -583,6 +587,8 @@ public class GameScene extends PixelScene {
|
||||||
}
|
}
|
||||||
if (ankh != null) {
|
if (ankh != null) {
|
||||||
add(new WndResurrect(ankh));
|
add(new WndResurrect(ankh));
|
||||||
|
} else {
|
||||||
|
gameOver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,8 +890,11 @@ public class GameScene extends PixelScene {
|
||||||
|
|
||||||
private void showBanner( Banner banner ) {
|
private void showBanner( Banner banner ) {
|
||||||
banner.camera = uiCamera;
|
banner.camera = uiCamera;
|
||||||
|
|
||||||
|
float offset = Camera.main.centerOffset.y;
|
||||||
banner.x = align( uiCamera, (uiCamera.width - banner.width) / 2 );
|
banner.x = align( uiCamera, (uiCamera.width - banner.width) / 2 );
|
||||||
banner.y = align( uiCamera, (uiCamera.height - banner.height) / 3 );
|
banner.y = align( uiCamera, (uiCamera.height - banner.height) / 2 - banner.height/2 - 16 - offset );
|
||||||
|
|
||||||
addToFront( banner );
|
addToFront( banner );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,7 +1193,53 @@ public class GameScene extends PixelScene {
|
||||||
gameOver.show( 0x000000, 1f );
|
gameOver.show( 0x000000, 1f );
|
||||||
scene.showBanner( gameOver );
|
scene.showBanner( gameOver );
|
||||||
|
|
||||||
Sample.INSTANCE.play( Assets.Sounds.DEATH );
|
StyledButton restart = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(StartScene.class, "new"), 9){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
InterlevelScene.noStory = true;
|
||||||
|
GamesInProgress.selectedClass = Dungeon.hero.heroClass;
|
||||||
|
GamesInProgress.curSlot = GamesInProgress.firstEmpty();
|
||||||
|
ShatteredPixelDungeon.switchScene(HeroSelectScene.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
bg.alpha(gameOver.am);
|
||||||
|
icon.alpha(gameOver.am);
|
||||||
|
text.alpha(gameOver.am);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
restart.camera = uiCamera;
|
||||||
|
restart.icon(Icons.get(Icons.ENTER));
|
||||||
|
float offset = Camera.main.centerOffset.y;
|
||||||
|
restart.setSize(Math.max(80, restart.reqWidth()), 20);
|
||||||
|
restart.setPos(
|
||||||
|
align(uiCamera, (restart.camera.width - restart.width()) / 2),
|
||||||
|
align(uiCamera, (restart.camera.height - restart.height()) / 2 + restart.height()/2 + 16 - offset)
|
||||||
|
);
|
||||||
|
scene.add(restart);
|
||||||
|
|
||||||
|
StyledButton menu = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(WndKeyBindings.class, "menu"), 9){
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
GameScene.show(new WndGame());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
bg.alpha(gameOver.am);
|
||||||
|
icon.alpha(gameOver.am);
|
||||||
|
text.alpha(gameOver.am);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
menu.camera = uiCamera;
|
||||||
|
menu.icon(Icons.get(Icons.PREFS));
|
||||||
|
menu.setSize(Math.max(80, menu.reqWidth()), 20);
|
||||||
|
menu.setPos(
|
||||||
|
align(uiCamera, (menu.camera.width - menu.width()) / 2),
|
||||||
|
restart.bottom() + 2
|
||||||
|
);
|
||||||
|
scene.add(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void bossSlain() {
|
public static void bossSlain() {
|
||||||
|
|
|
@ -295,8 +295,9 @@ public class PixelScene extends Scene {
|
||||||
public void call() {
|
public void call() {
|
||||||
BadgeBanner banner = BadgeBanner.show( badge.image );
|
BadgeBanner banner = BadgeBanner.show( badge.image );
|
||||||
banner.camera = uiCamera;
|
banner.camera = uiCamera;
|
||||||
|
float offset = Camera.main.centerOffset.y;
|
||||||
banner.x = align( banner.camera, (banner.camera.width - banner.width) / 2 );
|
banner.x = align( banner.camera, (banner.camera.width - banner.width) / 2 );
|
||||||
banner.y = align( banner.camera, (banner.camera.height - banner.height) / 3 );
|
banner.y = align( uiCamera, (uiCamera.height - banner.height) / 2 - banner.height/2 - 16 - offset );
|
||||||
Scene s = Game.scene();
|
Scene s = Game.scene();
|
||||||
if (s != null) s.add( banner );
|
if (s != null) s.add( banner );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user