diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index 317a8a2e2..f3d1668a0 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -372,6 +372,16 @@ windows.wndupgrade.ring_boost=Ring Boost windows.wndupgrade.upgrade=Upgrade windows.wndupgrade.back=Back +windows.wndvictorycongrats.title=Victory! +windows.wndvictorycongrats.start_text=Congratulations on conquering the dungeon! You've unlocked some new features that are available when choosing a hero: +windows.wndvictorycongrats.challenges=You can now enable _challenges!_ These are optional modifiers to make the game more difficult in a variety of ways. +windows.wndvictorycongrats.custom_seeds=You can now enter _custom seeds!_ The same seed and game version always produce the same dungeon. +windows.wndvictorycongrats.dailies=You can now participate in _daily runs!_ Every day there's a new daily run that's the same for every player! +windows.wndvictorycongrats.thank_you=Thank you so much for playing Shattered Pixel Dungeon! +windows.wndvictorycongrats.support_prompt=If you haven't already, _please consider supporting the game._ Support from dedicated players lets the developer continue improving the game! +windows.wndvictorycongrats.support=Support +windows.wndvictorycongrats.close=Close + windows.wndwandmaker.dust=Oh, I see you have the dust! Don't worry about the wraiths, I can deal with them. As I promised, you can choose one of my high quality wands. windows.wndwandmaker.ember=Oh, I see you have the embers! I do hope the fire elemental wasn't too much trouble. As I promised, you can choose one of my high quality wands. windows.wndwandmaker.berry=Oh, I see you have the berry! I do hope the rotberry plant didn't trouble you too much. As I promised, you can choose one of my high quality wands. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java index 34daca432..f4cb5b215 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java @@ -230,6 +230,7 @@ public class SPDSettings extends GameSettings { public static final String KEY_INTRO = "intro"; public static final String KEY_SUPPORT_NAGGED= "support_nagged"; + public static final String KEY_VICTORY_NAGGED= "victory_nagged"; public static void intro( boolean value ) { put( KEY_INTRO, value ); @@ -279,6 +280,14 @@ public class SPDSettings extends GameSettings { return getBoolean(KEY_SUPPORT_NAGGED, false); } + public static void victoryNagged( boolean value ) { + put( KEY_VICTORY_NAGGED, value ); + } + + public static boolean victoryNagged() { + return getBoolean(KEY_VICTORY_NAGGED, false); + } + //Input public static final String KEY_CONTROLLER_SENS = "controller_sens"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java index 38d616576..53e71bdc9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/HeroSelectScene.java @@ -46,6 +46,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.shatteredpixel.shatteredpixeldungeon.windows.WndTextInput; import com.shatteredpixel.shatteredpixeldungeon.windows.WndTitledMessage; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndVictoryCongrats; import com.watabou.gltextures.TextureCache; import com.watabou.input.PointerEvent; import com.watabou.noosa.Camera; @@ -362,6 +363,11 @@ public class HeroSelectScene extends PixelScene { setSelectedHero(GamesInProgress.selectedClass); } + if (Badges.isUnlocked(Badges.Badge.VICTORY) && !SPDSettings.victoryNagged()) { + SPDSettings.victoryNagged(true); + add(new WndVictoryCongrats()); + } + fadeIn(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java index a66fd00c7..6838016b4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java @@ -22,8 +22,10 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Rankings; +import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; @@ -40,6 +42,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle; import com.shatteredpixel.shatteredpixeldungeon.windows.WndDailies; import com.shatteredpixel.shatteredpixeldungeon.windows.WndRanking; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndVictoryCongrats; import com.watabou.noosa.BitmapText; import com.watabou.noosa.Camera; import com.watabou.noosa.Image; @@ -164,6 +167,9 @@ public class RankingsScene extends PixelScene { if (Dungeon.daily){ addToFront(new WndDailies()); + } else if (Badges.isUnlocked(Badges.Badge.VICTORY) && !SPDSettings.victoryNagged()) { + SPDSettings.victoryNagged(true); + add(new WndVictoryCongrats()); } fadeIn(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index e88ff1f63..22e319adb 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Chrome; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress; @@ -42,6 +43,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.shatteredpixel.shatteredpixeldungeon.windows.WndSettings; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndVictoryCongrats; import com.watabou.glwrap.Blending; import com.watabou.noosa.BitmapText; import com.watabou.noosa.Camera; @@ -217,6 +219,12 @@ public class TitleScene extends PixelScene { add( btnExit ); } + Badges.loadGlobal(); + if (Badges.isUnlocked(Badges.Badge.VICTORY) && !SPDSettings.victoryNagged()) { + SPDSettings.victoryNagged(true); + add(new WndVictoryCongrats()); + } + fadeIn(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index ee3bc44a0..28598e865 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -243,11 +243,16 @@ public class WelcomeScene extends PixelScene { Badges.loadGlobal(); Journal.loadGlobal(); - //Dwarf King's final journal entry changed, set it as un-read if (previousVersion <= ShatteredPixelDungeon.v2_4_2){ + //Dwarf King's final journal entry changed, set it as un-read if (Document.HALLS_KING.isPageRead(Document.KING_ATTRITION)){ Document.HALLS_KING.unreadPage(Document.KING_ATTRITION); } + + //don't victory nag people who have already gotten a win in older versions + if (Badges.isUnlocked(Badges.Badge.VICTORY)){ + SPDSettings.victoryNagged(false); + } } //pre-unlock Duelist for those who already have a win diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndVictoryCongrats.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndVictoryCongrats.java new file mode 100644 index 000000000..94908b84c --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndVictoryCongrats.java @@ -0,0 +1,143 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.windows; + +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; +import com.shatteredpixel.shatteredpixeldungeon.scenes.SupporterScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; +import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; +import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; +import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.noosa.Image; + +public class WndVictoryCongrats extends Window { + + public WndVictoryCongrats(){ + int width = PixelScene.landscape() ? 180 : 120; + int height = 0; + + IconTitle title = new IconTitle( new ItemSprite(ItemSpriteSheet.AMULET), Messages.get(this, "title")); + title.setRect( 0, 0, width, 0 ); + add(title); + + RenderedTextBlock text = PixelScene.renderTextBlock( Messages.get(this, "start_text"), 6 ); + text.maxWidth( width ); + text.setPos( 0, title.bottom() + 4 ); + add( text ); + + height = (int)text.bottom() + 6; + + Image chalImg = Icons.CHALLENGE_COLOR.get(); + chalImg.y = height; + chalImg.x = (16-chalImg.width())/2f; + PixelScene.align(chalImg); + add(chalImg); + + RenderedTextBlock chalTxt = PixelScene.renderTextBlock(Messages.get(this, "challenges"), 6); + chalTxt.maxWidth(width - 16); + chalTxt.setPos(16, height); + add(chalTxt); + + if (chalTxt.height() > chalImg.height()){ + chalImg.y = chalImg.y + (chalTxt.height() - chalImg.height())/2f; + PixelScene.align(chalImg); + } + + height += Math.max(chalImg.height(), chalTxt.height()) + 6; + + Image seedImg = new ItemSprite(ItemSpriteSheet.SEED_SUNGRASS); + seedImg.y = height; + seedImg.x = (16-seedImg.width())/2f; + PixelScene.align(seedImg); + add(seedImg); + + RenderedTextBlock seedTxt = PixelScene.renderTextBlock(Messages.get(this, "custom_seeds"), 6); + seedTxt.maxWidth(width - 16); + seedTxt.setPos(16, height); + add(seedTxt); + + if (seedTxt.height() > seedImg.height()){ + seedImg.y = seedImg.y + (seedTxt.height() - seedImg.height())/2f; + PixelScene.align(seedImg); + } + + height += Math.max(seedImg.height(), seedTxt.height()) + 6; + + Image dailyImg = Icons.CALENDAR.get(); + dailyImg.hardlight(0.5f, 1f, 2f); + dailyImg.y = height; + dailyImg.x = (16-dailyImg.width())/2f; + PixelScene.align(dailyImg); + add(dailyImg); + + RenderedTextBlock dailyTxt = PixelScene.renderTextBlock(Messages.get(this, "dailies"), 6); + dailyTxt.maxWidth(width - 16); + dailyTxt.setPos(16, height); + add(dailyTxt); + + if (dailyTxt.height() > dailyImg.height()){ + dailyImg.y = dailyImg.y + (dailyTxt.height() - dailyImg.height())/2f; + PixelScene.align(dailyImg); + } + + height += Math.max(dailyImg.height(), dailyTxt.height()) + 6; + + RenderedTextBlock finalTxt = PixelScene.renderTextBlock(Messages.get(this, "thank_you") + " " + Messages.get(this, "support_prompt"), 6); + finalTxt.maxWidth(width); + finalTxt.setPos(0, height); + add(finalTxt); + + height = (int) finalTxt.bottom() + 4; + + RedButton btnSupport = new RedButton(Messages.get(this, "support")) { + @Override + protected void onClick() { + ShatteredPixelDungeon.switchScene(SupporterScene.class); + } + }; + btnSupport.icon(Icons.GOLD.get()); + btnSupport.setRect(0, height, width / 2, 18); + add(btnSupport); + + RedButton btnClose = new RedButton(Messages.get(this, "close")) { + @Override + protected void onClick() { + hide(); + } + }; + btnClose.icon(Icons.EXIT.get()); + btnClose.setRect(btnSupport.right() + 1, height, width / 2 - 1, 18); + add(btnClose); + + resize(width, (int)btnClose.bottom()); + + } + + @Override + public void onBackPressed() { + //do nothing + } +}