v0.8.2: added a support prompt window after the player first beats Goo
This commit is contained in:
parent
0bb2056121
commit
b6990f149e
|
@ -66,10 +66,10 @@ scenes.startscene.title=Games in Progress
|
|||
scenes.startscene.new=New Game
|
||||
|
||||
scenes.supporterscene.title=Support the Game
|
||||
scenes.supporterscene.intro=I want Shattered Pixel Dungeon to be free of ads and invasive microtransations, which ruin so many mobile games. Instead, I'd rather ask players to support the game directly!
|
||||
scenes.supporterscene.patreon_msg=If you enjoy ShatteredPD and want to help me keep making it, please consider supporting me on _Patreon!_ Patreon gives me a steady income source, and lets me give supporters exclusive benefits!:\n_- Weekly mini-blogs_, with info about what I'm working on.\n_- Content Polls_, which directly affect content I'm developing.\n_- A Community Discord_, with a dev log and chat channels.\n_- More benefits to come_, as the Patreon community grows.\n\nYou can visit the Patreon page for more info. Thanks for your time, and happy dungeoneering!
|
||||
scenes.supporterscene.patreon_english=(Note that Patreon rewards are only available in English.)
|
||||
scenes.supporterscene.supporter_link=Go to Patreon Page
|
||||
scenes.supporterscene$supportermessage.intro=I want Shattered Pixel Dungeon to be free of ads and invasive microtransations, which ruin so many mobile games. Instead, I'd rather ask players to support the game directly!
|
||||
scenes.supporterscene$supportermessage.patreon_msg=If you enjoy ShatteredPD and want to help me keep making it, please consider supporting me on _Patreon!_ Patreon gives me a steady income source, and lets me give supporters exclusive benefits!:\n_- Weekly mini-blogs_, with info about what I'm working on.\n_- Content Polls_, which directly affect content I'm developing.\n_- A Community Discord_, with a dev log and chat channels.\n_- More benefits to come_, as the Patreon community grows.\n\nYou can visit the Patreon page for more info. Thank you for your support!
|
||||
scenes.supporterscene$supportermessage.patreon_english=(Note that Patreon rewards are only available in English.)
|
||||
|
||||
scenes.surfacescene.exit=Game Over
|
||||
|
||||
|
|
|
@ -188,6 +188,10 @@ windows.wndstory.caves=These sparsely populated caves stretch down under the aba
|
|||
windows.wndstory.city=The Dwarven Metropolis was once the greatest of all dwarven city-states. In its heyday the dwarves built wondrous machines of metal and magic that allowed their city to expand rapidly.\n\nThen, one day, the city gates were barred and nobody heard from the dwarves again. The few who escaped the city as it closed told stories of a mad warlock who stole the throne, and the terrible magic he had learned to harness.
|
||||
windows.wndstory.halls=These deep halls of the Dwarven Metropolis have been twisted by dark magic. In the past these regions played host to the Dwarf King's court of elite warlocks, but now they seem to have been taken over by something even more sinister...\n\nAll sorts of horrific demonic creatures inhabit these halls, being lead by some terrible dark power. If the King of Dwarves wasn't the source of the spreading corruption, whatever is down here must be.\n\nTread carefully, very few adventurers have ever descended this far...
|
||||
|
||||
windows.wndsupportprompt.title=A Message From The Developer
|
||||
windows.wndsupportprompt.intro=Hello, I hope you're enjoying Shattered Pixel Dungeon!
|
||||
windows.wndsupportprompt.close=Close
|
||||
|
||||
windows.wndtradeitem.buy=Buy for %dg
|
||||
windows.wndtradeitem.steal=Steal with %d%% chance
|
||||
windows.wndtradeitem.sell=Sell for %dg
|
||||
|
|
|
@ -160,7 +160,9 @@ public class SPDSettings extends GameSettings {
|
|||
public static final String KEY_LAST_CLASS = "last_class";
|
||||
public static final String KEY_CHALLENGES = "challenges";
|
||||
public static final String KEY_INTRO = "intro";
|
||||
|
||||
|
||||
public static final String KEY_SUPPORT_NAGGED= "support_nagged";
|
||||
|
||||
public static void intro( boolean value ) {
|
||||
put( KEY_INTRO, value );
|
||||
}
|
||||
|
@ -184,7 +186,15 @@ public class SPDSettings extends GameSettings {
|
|||
public static int challenges() {
|
||||
return getInt( KEY_CHALLENGES, 0, 0, Challenges.MAX_VALUE );
|
||||
}
|
||||
|
||||
|
||||
public static void supportNagged( boolean value ) {
|
||||
put( KEY_SUPPORT_NAGGED, value );
|
||||
}
|
||||
|
||||
public static boolean supportNagged() {
|
||||
return getBoolean(KEY_SUPPORT_NAGGED, false);
|
||||
}
|
||||
|
||||
//Audio
|
||||
|
||||
public static final String KEY_MUSIC = "music";
|
||||
|
@ -295,29 +305,29 @@ public class SPDSettings extends GameSettings {
|
|||
//returns the current time when none is stored, so historical news isn't seen as unread
|
||||
return getLong(KEY_NEWS_LAST_READ, Game.realTime);
|
||||
}
|
||||
|
||||
|
||||
//Window management (desktop only atm)
|
||||
|
||||
|
||||
public static final String KEY_WINDOW_WIDTH = "window_width";
|
||||
public static final String KEY_WINDOW_HEIGHT = "window_height";
|
||||
public static final String KEY_WINDOW_MAXIMIZED = "window_maximized";
|
||||
|
||||
|
||||
public static void windowResolution( Point p ){
|
||||
put(KEY_WINDOW_WIDTH, p.x);
|
||||
put(KEY_WINDOW_HEIGHT, p.y);
|
||||
}
|
||||
|
||||
|
||||
public static Point windowResolution(){
|
||||
return new Point(
|
||||
getInt( KEY_WINDOW_WIDTH, 960, 480, Integer.MAX_VALUE ),
|
||||
getInt( KEY_WINDOW_HEIGHT, 640, 320, Integer.MAX_VALUE )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static void windowMaximized( boolean value ){
|
||||
put( KEY_WINDOW_MAXIMIZED, value );
|
||||
}
|
||||
|
||||
|
||||
public static boolean windowMaximized(){
|
||||
return getBoolean( KEY_WINDOW_MAXIMIZED, false );
|
||||
}
|
||||
|
|
|
@ -21,7 +21,16 @@
|
|||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.items.keys;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndSupportPrompt;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.utils.Callback;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SkeletonKey extends Key {
|
||||
|
||||
|
@ -38,4 +47,24 @@ public class SkeletonKey extends Key {
|
|||
this.depth = depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doPickUp(Hero hero) {
|
||||
if(!SPDSettings.supportNagged()){
|
||||
try {
|
||||
Dungeon.saveAll();
|
||||
Game.runOnRenderThread(new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
ShatteredPixelDungeon.scene().add(new WndSupportPrompt());
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
ShatteredPixelDungeon.reportException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return super.doPickUp(hero);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,10 +114,10 @@ public class SupporterScene extends PixelScene {
|
|||
bg = Chrome.get(Chrome.Type.GREY_BUTTON_TR);
|
||||
add(bg);
|
||||
|
||||
String message = Messages.get(this, "intro");
|
||||
message += "\n\n" + Messages.get(this, "patreon_msg");
|
||||
String message = Messages.get(SupporterScene.class, "intro");
|
||||
message += "\n\n" + Messages.get(SupporterScene.class, "patreon_msg");
|
||||
if (Messages.lang() != Languages.ENGLISH) {
|
||||
message += "\n" + Messages.get(this, "patreon_english");
|
||||
message += "\n" + Messages.get(SupporterScene.class, "patreon_english");
|
||||
}
|
||||
message += "\n\n- Evan";
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2020 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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.SupporterScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.watabou.utils.DeviceCompat;
|
||||
|
||||
public class WndSupportPrompt extends WndTitledMessage {
|
||||
|
||||
public WndSupportPrompt(){
|
||||
super( new IconTitle(Icons.get(Icons.SHPX), Messages.get(WndSupportPrompt.class, "title")),
|
||||
Messages.get(WndSupportPrompt.class, "intro") + "\n\n" +
|
||||
Messages.get(SupporterScene.class, "patreon_msg") + "\n" +
|
||||
(Messages.lang() != Languages.ENGLISH ? Messages.get(SupporterScene.class, "patreon_english") + "\n\n" : "\n") +
|
||||
"- Evan");
|
||||
|
||||
float y = height;
|
||||
|
||||
RedButton link = new RedButton(Messages.get(SupporterScene.class, "supporter_link")){
|
||||
@Override
|
||||
protected void onClick() {
|
||||
super.onClick();
|
||||
String link = "https://www.patreon.com/ShatteredPixel";
|
||||
//tracking codes, so that the website knows where this pageview came from
|
||||
link += "?utm_source=shatteredpd";
|
||||
link += "&utm_medium=android";
|
||||
link += "&utm_campaign=supporter_prompt";
|
||||
DeviceCompat.openURI(link);
|
||||
SPDSettings.supportNagged(true);
|
||||
WndSupportPrompt.super.hide();
|
||||
}
|
||||
};
|
||||
link.setRect(0, y + 2, width, 18);
|
||||
add(link);
|
||||
|
||||
RedButton close = new RedButton(Messages.get(this, "close")){
|
||||
@Override
|
||||
protected void onClick() {
|
||||
super.onClick();
|
||||
SPDSettings.supportNagged(true);
|
||||
WndSupportPrompt.super.hide();
|
||||
}
|
||||
};
|
||||
close.setRect(0, link.bottom() + 2, width, 18);
|
||||
add(close);
|
||||
|
||||
resize(width, (int)close.bottom());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
//do nothing, have to close via the close button
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user