v2.4.0: improved badge save/display logic when game is ended
This commit is contained in:
@@ -1000,21 +1000,11 @@ public class Badges {
|
|||||||
displayBadge( badge );
|
displayBadge( badge );
|
||||||
}
|
}
|
||||||
|
|
||||||
//necessary in order to display the happy end badge in the surface scene
|
|
||||||
public static void silentValidateHappyEnd() {
|
|
||||||
if (!local.contains( Badge.HAPPY_END )){
|
|
||||||
local.add( Badge.HAPPY_END );
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!local.contains( Badge.HAPPY_END_REMAINS ) && Dungeon.hero.belongings.getItem(RemainsItem.class) != null){
|
|
||||||
local.add( Badge.HAPPY_END_REMAINS );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void validateHappyEnd() {
|
public static void validateHappyEnd() {
|
||||||
displayBadge( Badge.HAPPY_END );
|
displayBadge( Badge.HAPPY_END );
|
||||||
if (local.contains(Badge.HAPPY_END_REMAINS)) {
|
|
||||||
displayBadge(Badge.HAPPY_END_REMAINS);
|
if( Dungeon.hero.belongings.getItem(RemainsItem.class) != null ){
|
||||||
|
displayBadge( Badge.HAPPY_END_REMAINS );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,7 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.levels;
|
package com.shatteredpixel.shatteredpixeldungeon.levels;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost;
|
||||||
@@ -154,9 +152,6 @@ public class SewerLevel extends RegularLevel {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Statistics.ascended = true;
|
Statistics.ascended = true;
|
||||||
Badges.silentValidateHappyEnd();
|
|
||||||
Dungeon.win( Amulet.class );
|
|
||||||
Dungeon.deleteGame( GamesInProgress.curSlot, true );
|
|
||||||
Game.switchScene( SurfaceScene.class );
|
Game.switchScene( SurfaceScene.class );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
|
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
|
||||||
@@ -78,6 +79,7 @@ public class AmuletScene extends PixelScene {
|
|||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
Dungeon.win( Amulet.class );
|
Dungeon.win( Amulet.class );
|
||||||
Dungeon.deleteGame( GamesInProgress.curSlot, true );
|
Dungeon.deleteGame( GamesInProgress.curSlot, true );
|
||||||
|
Badges.saveGlobal();
|
||||||
btnExit.enable(false);
|
btnExit.enable(false);
|
||||||
btnStay.enable(false);
|
btnStay.enable(false);
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -24,8 +24,10 @@ 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.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.Ratmogrify;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.remains.RemainsItem;
|
import com.shatteredpixel.shatteredpixeldungeon.items.remains.RemainsItem;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
|
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
|
||||||
@@ -266,6 +268,9 @@ public class SurfaceScene extends PixelScene {
|
|||||||
add( gameOver );
|
add( gameOver );
|
||||||
|
|
||||||
Badges.validateHappyEnd();
|
Badges.validateHappyEnd();
|
||||||
|
Dungeon.win( Amulet.class );
|
||||||
|
Dungeon.deleteGame( GamesInProgress.curSlot, true );
|
||||||
|
Badges.saveGlobal();
|
||||||
|
|
||||||
fadeIn();
|
fadeIn();
|
||||||
}
|
}
|
||||||
@@ -287,8 +292,6 @@ public class SurfaceScene extends PixelScene {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Badges.saveGlobal();
|
|
||||||
|
|
||||||
Camera.remove( viewport );
|
Camera.remove( viewport );
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user