v0.8.2: moved supporter window into its own scene
This commit is contained in:
parent
41357d9608
commit
4950e49a9a
core/src/main
assets/messages/scenes
java/com/shatteredpixel/shatteredpixeldungeon/scenes
|
@ -64,6 +64,11 @@ scenes.rankingsscene.no_info=No additional information
|
|||
scenes.startscene.title=Games in Progress
|
||||
scenes.startscene.new=New Game
|
||||
|
||||
scenes.supporterscene.title=Support the Game
|
||||
scenes.supporterscene.supporter_link=Go to Patreon
|
||||
scenes.supporterscene$supportermessage.patreon=Shattered Pixel Dungeon is a completely free game, which means that I depend on support from generous players in order to keep making it.\n\nIf you're interested in supporting me, the best way to do so is through Patreon. Patreon gives me a consistent income source, and allows me to give something back to those who support me!\n\nPatrons get exclusive blog posts every week which let them know about what I'm working on before anyone else!\n\nYou can take a look at my Patreon page for the most up to date information about benefits, Thank you for your consideration!
|
||||
scenes.supporterscene$supportermessage.patreon_english=Note that Patreon rewards are only available in English.
|
||||
|
||||
scenes.surfacescene.exit=Game Over
|
||||
|
||||
scenes.titlescene.play=Play
|
||||
|
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* 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.scenes;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.StyledButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
public class SupporterScene extends PixelScene {
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
super.create();
|
||||
|
||||
uiCamera.visible = false;
|
||||
|
||||
int w = Camera.main.width;
|
||||
int h = Camera.main.height;
|
||||
|
||||
int elementWidth = PixelScene.landscape() ? 200 : 120;
|
||||
|
||||
Archs archs = new Archs();
|
||||
archs.setSize(w, h);
|
||||
add(archs);
|
||||
|
||||
ExitButton btnExit = new ExitButton();
|
||||
btnExit.setPos(w - btnExit.width(), 0);
|
||||
add(btnExit);
|
||||
|
||||
RenderedTextBlock title = PixelScene.renderTextBlock(Messages.get(this, "title"), 9);
|
||||
title.hardlight(Window.TITLE_COLOR);
|
||||
title.setPos(
|
||||
(w - title.width()) / 2f,
|
||||
(20 - title.height()) / 2f
|
||||
);
|
||||
align(title);
|
||||
add(title);
|
||||
|
||||
SupporterMessage msg = new SupporterMessage();
|
||||
msg.setSize(elementWidth, 0);
|
||||
add(msg);
|
||||
|
||||
StyledButton link = new StyledButton(Chrome.Type.GREY_BUTTON_TR, Messages.get(this, "supporter_link"));
|
||||
link.icon(Icons.get(Icons.GOLD));
|
||||
link.textColor(Window.TITLE_COLOR);
|
||||
link.setSize(elementWidth, 20);
|
||||
add(link);
|
||||
|
||||
float elementHeight = msg.height() + link.height() + 2;
|
||||
|
||||
float top = 16 + (h - 16 - elementHeight)/2f;
|
||||
float left = (w-elementWidth)/2f;
|
||||
|
||||
msg.setPos(left, top);
|
||||
align(msg);
|
||||
|
||||
link.setPos(left, msg.bottom()+2);
|
||||
align(link);
|
||||
|
||||
}
|
||||
|
||||
private static class SupporterMessage extends Component {
|
||||
|
||||
NinePatch bg;
|
||||
RenderedTextBlock text;
|
||||
|
||||
@Override
|
||||
protected void createChildren() {
|
||||
bg = Chrome.get(Chrome.Type.GREY_BUTTON_TR);
|
||||
add(bg);
|
||||
|
||||
String message = Messages.get(this, "patreon");
|
||||
if (Messages.lang() != Languages.ENGLISH){
|
||||
message += "\n\n" + Messages.get(this, "patreon_english");
|
||||
}
|
||||
|
||||
text = PixelScene.renderTextBlock(message, 6);
|
||||
add(text);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void layout() {
|
||||
bg.x = x;
|
||||
bg.y = y;
|
||||
|
||||
text.maxWidth((int)width - bg.marginHor());
|
||||
text.setPos(x + bg.marginLeft(), y + bg.marginTop());
|
||||
|
||||
height = (text.bottom()) - y;
|
||||
|
||||
height += bg.marginBottom();
|
||||
|
||||
bg.size(width, height);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -338,19 +338,7 @@ public class TitleScene extends PixelScene {
|
|||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
WndOptions wnd = new WndOptions(Messages.get(TitleScene.class, "support"),
|
||||
Messages.get(TitleScene.class, "patreon_body"),
|
||||
Messages.get(TitleScene.class, "patreon_button")){
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0){
|
||||
DeviceCompat.openURI("https://www.patreon.com/ShatteredPixel");
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
parent.add(wnd);
|
||||
ShatteredPixelDungeon.switchNoFade(SupporterScene.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user