v0.3.4: externalized window strings

This commit is contained in:
Evan Debenham
2015-12-31 14:52:11 -05:00
committed by Evan Debenham
parent 46aa324eff
commit 0ca46e72cc
22 changed files with 374 additions and 409 deletions
@@ -20,21 +20,22 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.NinePatch;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.NinePatch;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Component;
public class WndBlacksmith extends Window {
@@ -49,14 +50,6 @@ public class WndBlacksmith extends Window {
private ItemButton btnItem2;
private RedButton btnReforge;
private static final String TXT_PROMPT =
"Ok, a deal is a deal, dat's what I can do for you: I can reforge " +
"2 items and turn them into one of a better quality.";
private static final String TXT_SELECT =
"Select an item to reforge";
private static final String TXT_REFORGE =
"Reforge them";
public WndBlacksmith( Blacksmith troll, Hero hero ) {
super();
@@ -67,7 +60,7 @@ public class WndBlacksmith extends Window {
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_PROMPT, 6 );
BitmapTextMultiline message = PixelScene.createMultiline( Messages.get(this, "prompt"), 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
@@ -77,7 +70,7 @@ public class WndBlacksmith extends Window {
@Override
protected void onClick() {
btnPressed = btnItem1;
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, TXT_SELECT );
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, Messages.get(this, "select") );
}
};
btnItem1.setRect( (WIDTH - BTN_GAP) / 2 - BTN_SIZE, message.y + message.height() + BTN_GAP, BTN_SIZE, BTN_SIZE );
@@ -87,13 +80,13 @@ public class WndBlacksmith extends Window {
@Override
protected void onClick() {
btnPressed = btnItem2;
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, TXT_SELECT );
GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, Messages.get(this, "select") );
}
};
btnItem2.setRect( btnItem1.right() + BTN_GAP, btnItem1.top(), BTN_SIZE, BTN_SIZE );
add( btnItem2 );
btnReforge = new RedButton( TXT_REFORGE ) {
btnReforge = new RedButton( Messages.get(this, "reforge") ) {
@Override
protected void onClick() {
Blacksmith.upgrade( btnItem1.item, btnItem2.item );
@@ -20,20 +20,20 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import java.util.ArrayList;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.ui.Component;
import java.util.ArrayList;
public class WndCatalogus extends WndTabbed {
@@ -45,16 +45,10 @@ public class WndCatalogus extends WndTabbed {
private static final int ITEM_HEIGHT = 18;
private static final int TAB_WIDTH = 50;
private static final String TXT_POTIONS = "Potions";
private static final String TXT_SCROLLS = "Scrolls";
private static final String TXT_TITLE = "Catalogus";
private BitmapText txtTitle;
private ScrollPane list;
private ArrayList<ListItem> items = new ArrayList<WndCatalogus.ListItem>();
private ArrayList<ListItem> items = new ArrayList<>();
private static boolean showPotions = true;
@@ -68,7 +62,7 @@ public class WndCatalogus extends WndTabbed {
resize( WIDTH_P, HEIGHT_P );
}
txtTitle = PixelScene.createText( TXT_TITLE, 9 );
txtTitle = PixelScene.createText( Messages.get(this, "title"), 9 );
txtTitle.hardlight( Window.TITLE_COLOR );
txtTitle.measure();
add( txtTitle );
@@ -89,14 +83,14 @@ public class WndCatalogus extends WndTabbed {
boolean showPotions = WndCatalogus.showPotions;
Tab[] tabs = {
new LabeledTab( TXT_POTIONS ) {
new LabeledTab( Messages.get(this, "potions") ) {
protected void select( boolean value ) {
super.select( value );
WndCatalogus.showPotions = value;
updateList();
};
},
new LabeledTab( TXT_SCROLLS ) {
new LabeledTab( Messages.get(this, "scrolls") ) {
protected void select( boolean value ) {
super.select( value );
WndCatalogus.showPotions = !value;
@@ -115,7 +109,7 @@ public class WndCatalogus extends WndTabbed {
private void updateList() {
txtTitle.text( Utils.format( TXT_TITLE, showPotions ? TXT_POTIONS : TXT_SCROLLS ) );
txtTitle.text( Messages.get(this, "title", showPotions ? Messages.get(this, "potions") : Messages.get(this, "scrolls") ) );
txtTitle.measure();
txtTitle.x = (width - txtTitle.width()) / 2;
@@ -20,15 +20,15 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import java.util.ArrayList;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.BitmapText;
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.BitmapText;
import java.util.ArrayList;
public class WndChallenges extends Window {
@@ -37,8 +37,6 @@ public class WndChallenges extends Window {
private static final int BTN_HEIGHT = 18;
private static final int GAP = 1;
private static final String TITLE = "Challenges";
private boolean editable;
private ArrayList<CheckBox> boxes;
@@ -48,7 +46,7 @@ public class WndChallenges extends Window {
this.editable = editable;
BitmapText title = PixelScene.createText( TITLE, 9 );
BitmapText title = PixelScene.createText( Messages.get(this, "title"), 9 );
title.hardlight( TITLE_COLOR );
title.measure();
title.x = (WIDTH - title.width()) / 2;
@@ -20,20 +20,17 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Highlighter;
public class WndChooseWay extends Window {
private static final String TXT_MESSAGE = "Which way will you follow?";
private static final String TXT_CANCEL = "I'll decide later";
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 18;
private static final float GAP = 2;
@@ -49,7 +46,7 @@ public class WndChooseWay extends Window {
add( titlebar );
HighlightedText hl = new HighlightedText( 6 );
hl.text( way1.desc() + "\n\n" + way2.desc() + "\n\n" + TXT_MESSAGE, WIDTH );
hl.text( way1.desc() + "\n\n" + way2.desc() + "\n\n" + Messages.get(this, "message"), WIDTH );
hl.setPos( titlebar.left(), titlebar.bottom() + GAP );
add( hl );
@@ -73,7 +70,7 @@ public class WndChooseWay extends Window {
btnWay2.setRect( btnWay1.right() + GAP, btnWay1.top(), btnWay1.width(), BTN_HEIGHT );
add( btnWay2 );
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
RedButton btnCancel = new RedButton( Messages.get(this, "cancel") ) {
@Override
protected void onClick() {
hide();
@@ -20,20 +20,19 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Group;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Group;
public class WndClass extends WndTabbed {
private static final String TXT_MASTERY = "Mastery";
private static final int WIDTH = 110;
private static final int TAB_WIDTH = 50;
@@ -60,7 +59,7 @@ public class WndClass extends WndTabbed {
tabMastery = new MasteryTab();
add( tabMastery );
tab = new RankingTab( TXT_MASTERY, tabMastery );
tab = new RankingTab( Messages.get(this, "mastery"), tabMastery );
add( tab );
resize(
@@ -20,14 +20,13 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
public class WndError extends WndTitledMessage {
private static final String TXT_TITLE = "ERROR";
public WndError( String message ) {
super( Icons.WARNING.get(), TXT_TITLE, message );
super( Icons.WARNING.get(), Messages.get(WndError.class, "title"), message );
}
}
@@ -20,27 +20,22 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import java.io.IOException;
import com.shatteredpixel.shatteredpixeldungeon.ui.*;
import com.watabou.noosa.Game;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.RankingsScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.Game;
import java.io.IOException;
public class WndGame extends Window {
private static final String TXT_SETTINGS = "Settings";
private static final String TXT_CHALLEGES = "Challenges";
private static final String TXT_RANKINGS = "Rankings";
private static final String TXT_START = "Start New Game";
private static final String TXT_MENU = "Main Menu";
private static final String TXT_EXIT = "Exit Game";
private static final String TXT_RETURN = "Return to Game";
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 20;
private static final int GAP = 2;
@@ -51,7 +46,7 @@ public class WndGame extends Window {
super();
addButton(new RedButton("Settings") {
addButton( new RedButton( Messages.get(this, "settings") ) {
@Override
protected void onClick() {
hide();
@@ -61,7 +56,7 @@ public class WndGame extends Window {
// Challenges window
if (Dungeon.challenges > 0) {
addButton( new RedButton( TXT_CHALLEGES ) {
addButton( new RedButton( Messages.get(this, "challenges") ) {
@Override
protected void onClick() {
hide();
@@ -74,7 +69,7 @@ public class WndGame extends Window {
if (!Dungeon.hero.isAlive()) {
RedButton btnStart;
addButton( btnStart = new RedButton( TXT_START ) {
addButton( btnStart = new RedButton( Messages.get(this, "start") ) {
@Override
protected void onClick() {
Dungeon.hero = null;
@@ -86,7 +81,7 @@ public class WndGame extends Window {
} );
btnStart.icon( Icons.get( Dungeon.hero.heroClass ) );
addButton( new RedButton( TXT_RANKINGS ) {
addButton( new RedButton( Messages.get(this, "rankings") ) {
@Override
protected void onClick() {
InterlevelScene.mode = InterlevelScene.Mode.DESCEND;
@@ -97,7 +92,7 @@ public class WndGame extends Window {
addButtons(
// Main menu
new RedButton(TXT_MENU) {
new RedButton( Messages.get(this, "menu") ) {
@Override
protected void onClick() {
try {
@@ -109,7 +104,7 @@ public class WndGame extends Window {
}
},
// Quit
new RedButton( TXT_EXIT ) {
new RedButton( Messages.get(this, "exit") ) {
@Override
protected void onClick() {
Game.instance.finish();
@@ -118,7 +113,7 @@ public class WndGame extends Window {
);
// Cancel
addButton( new RedButton( TXT_RETURN ) {
addButton( new RedButton( Messages.get(this, "return") ) {
@Override
protected void onClick() {
hide();
@@ -20,9 +20,17 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import java.util.Locale;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.gltextures.SmartTexture;
import com.watabou.gltextures.TextureCache;
@@ -30,31 +38,13 @@ import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Group;
import com.watabou.noosa.Image;
import com.watabou.noosa.TextureFilm;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.ui.Button;
import java.util.Locale;
public class WndHero extends WndTabbed {
private static final String TXT_STATS = "Stats";
private static final String TXT_BUFFS = "Buffs";
private static final String TXT_EXP = "Experience";
private static final String TXT_STR = "Strength";
private static final String TXT_HEALTH = "Health";
private static final String TXT_GOLD = "Gold Collected";
private static final String TXT_DEPTH = "Maximum Depth";
private static final int WIDTH = 100;
private static final int TAB_WIDTH = 40;
private StatsTab stats;
private BuffsTab buffs;
@@ -75,13 +65,13 @@ public class WndHero extends WndTabbed {
buffs = new BuffsTab();
add( buffs );
add( new LabeledTab( TXT_STATS ) {
add( new LabeledTab( Messages.get(this, "stats") ) {
protected void select( boolean value ) {
super.select( value );
stats.visible = stats.active = selected;
};
} );
add( new LabeledTab( TXT_BUFFS ) {
add( new LabeledTab( Messages.get(this, "buffs") ) {
protected void select( boolean value ) {
super.select( value );
buffs.visible = buffs.active = selected;
@@ -96,11 +86,7 @@ public class WndHero extends WndTabbed {
}
private class StatsTab extends Group {
private static final String TXT_TITLE = "Level %d %s";
private static final String TXT_CATALOGUS = "Catalogus";
private static final String TXT_JOURNAL = "Journal";
private static final int GAP = 5;
private float pos;
@@ -111,22 +97,22 @@ public class WndHero extends WndTabbed {
IconTitle title = new IconTitle();
title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
title.label(Utils.format( TXT_TITLE, hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ), 9);
title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) );
title.color(Window.SHPX_COLOR);
title.setRect( 0, 0, WIDTH, 0 );
add(title);
RedButton btnCatalogus = new RedButton( TXT_CATALOGUS ) {
RedButton btnCatalogs = new RedButton( Messages.get(this, "catalogs") ) {
@Override
protected void onClick() {
hide();
GameScene.show( new WndCatalogus() );
}
};
btnCatalogus.setRect( 0, title.height(), btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2 );
add( btnCatalogus );
btnCatalogs.setRect( 0, title.height(), btnCatalogs.reqWidth() + 2, btnCatalogs.reqHeight() + 2 );
add( btnCatalogs );
RedButton btnJournal = new RedButton( TXT_JOURNAL ) {
RedButton btnJournal = new RedButton( Messages.get(this, "journal") ) {
@Override
protected void onClick() {
hide();
@@ -134,20 +120,20 @@ public class WndHero extends WndTabbed {
}
};
btnJournal.setRect(
btnCatalogus.right() + 1, btnCatalogus.top(),
btnCatalogs.right() + 1, btnCatalogs.top(),
btnJournal.reqWidth() + 2, btnJournal.reqHeight() + 2 );
add( btnJournal );
pos = btnCatalogus.bottom() + GAP;
pos = btnCatalogs.bottom() + GAP;
statSlot( TXT_STR, hero.STR() );
statSlot( TXT_HEALTH, hero.HP + "/" + hero.HT );
statSlot( TXT_EXP, hero.exp + "/" + hero.maxExp() );
statSlot( Messages.get(this, "str"), hero.STR() );
statSlot( Messages.get(this, "health"), hero.HP + "/" + hero.HT );
statSlot( Messages.get(this, "exp"), hero.exp + "/" + hero.maxExp() );
pos += GAP;
statSlot( TXT_GOLD, Statistics.goldCollected );
statSlot( TXT_DEPTH, Statistics.deepestFloor );
statSlot( Messages.get(this, "gold"), Statistics.goldCollected );
statSlot( Messages.get(this, "depth"), Statistics.deepestFloor );
pos += GAP;
}
@@ -20,27 +20,21 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.BitmapTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.DwarfToken;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapTextMultiline;
public class WndImp extends Window {
private static final String TXT_MESSAGE =
"Oh yes! You are my hero!\n" +
"Regarding your reward, I don't have cash with me right now, but I have something better for you. " +
"This is my family heirloom ring: my granddad took it off a dead paladin's finger.";
private static final String TXT_REWARD = "Take the ring";
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 20;
private static final int GAP = 2;
@@ -55,13 +49,13 @@ public class WndImp extends Window {
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
BitmapTextMultiline message = PixelScene.createMultiline( Messages.get(this, "message"), 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnReward = new RedButton( TXT_REWARD ) {
RedButton btnReward = new RedButton( Messages.get(this, "reward") ) {
@Override
protected void onClick() {
takeReward( imp, tokens, Imp.Quest.reward );
@@ -20,16 +20,16 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Image;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Image;
public class WndInfoCell extends Window {
@@ -37,8 +37,6 @@ public class WndInfoCell extends Window {
private static final int WIDTH = 120;
private static final String TXT_NOTHING = "There is nothing here.";
public WndInfoCell( int cell ) {
super();
@@ -99,7 +97,7 @@ public class WndInfoCell extends Window {
}
}
info.text( desc.length() > 0 ? desc.toString() : TXT_NOTHING );
info.text( desc );
info.maxWidth = WIDTH;
info.measure();
info.x = titlebar.left();
@@ -21,40 +21,22 @@
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.watabou.noosa.BitmapTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapTextMultiline;
public class WndInfoItem extends Window {
private static final String TTL_CHEST = "Chest";
private static final String TTL_LOCKED_CHEST = "Locked chest";
private static final String TTL_CRYSTAL_CHEST = "Crystal chest";
private static final String TTL_TOMB = "Tomb";
private static final String TTL_SKELETON = "Skeletal remains";
private static final String TTL_REMAINS = "Heroes remains";
private static final String TXT_WONT_KNOW = "You won't know what's inside until you open it!";
private static final String TXT_NEED_KEY = TXT_WONT_KNOW + " But to open it you need a golden key.";
private static final String TXT_INSIDE = "You can see %s inside, but to open the chest you need a golden key.";
private static final String TXT_OWNER =
"This ancient tomb may contain something useful, " +
"but its owner will most certainly object to checking.";
private static final String TXT_SKELETON =
"This is all that's left of some unfortunate adventurer. " +
"Maybe it's worth checking for any valuables.";
private static final String TXT_REMAINS =
"This is all that's left from one of your predecessors. " +
"Maybe it's worth checking for any valuables.";
private static final float GAP = 2;
private static final int WIDTH_P = 120;
@@ -82,30 +64,30 @@ public class WndInfoItem extends Window {
String info;
if (heap.type == Type.CHEST || heap.type == Type.MIMIC) {
title = TTL_CHEST;
info = TXT_WONT_KNOW;
title = Messages.get(this, "chest");
info = Messages.get(this, "wont_know");
} else if (heap.type == Type.TOMB) {
title = TTL_TOMB;
info = TXT_OWNER;
title = Messages.get(this, "tomb");
info = Messages.get(this, "owner");
} else if (heap.type == Type.SKELETON) {
title = TTL_SKELETON;
info = TXT_SKELETON;
title = Messages.get(this, "skeleton");
info = Messages.get(this, "skeleton_desc");
} else if (heap.type == Type.REMAINS) {
title = TTL_REMAINS;
info = TXT_REMAINS;
title = Messages.get(this, "remains");
info = Messages.get(this, "remains_desc");
} else if (heap.type == Type.CRYSTAL_CHEST) {
title = TTL_CRYSTAL_CHEST;
title = Messages.get(this, "crystal_chest");
if (heap.peek() instanceof Artifact)
info = Utils.format( TXT_INSIDE, "an artifact" );
info = Messages.get(this, "inside", Messages.get(this, "artifact") );
else if (heap.peek() instanceof Wand)
info = Utils.format( TXT_INSIDE, "a wand" );
info = Messages.get(this, "inside", Messages.get(this, "wand") );
else if (heap.peek() instanceof Ring)
info = Utils.format( TXT_INSIDE, "a ring" );
info = Messages.get(this, "inside", Messages.get(this, "ring") );
else
info = Utils.format( TXT_INSIDE, Utils.indefinite( heap.peek().name() ) );
info = Messages.get(this, "inside", Utils.indefinite( heap.peek().name() ) );
} else {
title = TTL_LOCKED_CHEST;
info = TXT_NEED_KEY;
title = Messages.get(this, "locked_chest");
info = Messages.get(this, "need_key");
}
fillFields( heap.image(), heap.glowing(), TITLE_COLOR, title, info );
@@ -20,8 +20,8 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite;
public class WndInfoTrap extends WndTitledMessage {
@@ -29,8 +29,8 @@ public class WndInfoTrap extends WndTitledMessage {
public WndInfoTrap(Trap trap) {
super(new TrapSprite( trap.color + (trap.shape * 16) ),
(!trap.active ? "Inactive " : "") + trap.name,
(!trap.active ? "This trap is inactive, and can no longer be triggered.\n\n" : "") + trap.desc());
trap.name,
(!trap.active ? Messages.get(WndInfoTrap.class, "inactive") : "") + trap.desc());
}
@@ -20,18 +20,19 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import java.util.Collections;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Component;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Journal;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Image;
import com.watabou.noosa.ui.Component;
import java.util.Collections;
public class WndJournal extends Window {
@@ -41,8 +42,6 @@ public class WndJournal extends Window {
private static final int ITEM_HEIGHT = 18;
private static final String TXT_TITLE = "Journal";
private BitmapText txtTitle;
private ScrollPane list;
@@ -51,7 +50,7 @@ public class WndJournal extends Window {
super();
resize( WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P );
txtTitle = PixelScene.createText( TXT_TITLE, 9 );
txtTitle = PixelScene.createText( Messages.get(this, "title"), 9 );
txtTitle.hardlight( Window.TITLE_COLOR );
txtTitle.measure();
txtTitle.x = (WIDTH - txtTitle.width()) / 2;
@@ -20,22 +20,13 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import java.util.Locale;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.ColorBlock;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Button;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.BadgesList;
@@ -45,20 +36,21 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.ColorBlock;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Button;
import java.util.Locale;
public class WndRanking extends WndTabbed {
private static final String TXT_ERROR = "Unable to load additional information";
private static final String TXT_STATS = "Stats";
private static final String TXT_ITEMS = "Items";
private static final String TXT_BADGES = "Badges";
private static final int WIDTH = 115;
private static final int HEIGHT = 144;
private static final int TAB_WIDTH = 40;
private Thread thread;
private String error = null;
@@ -76,7 +68,7 @@ public class WndRanking extends WndTabbed {
Badges.loadGlobal();
Dungeon.loadGame( gameFile );
} catch (Exception e ) {
error = TXT_ERROR;
error = Messages.get(WndRanking.class, "error");
}
}
};
@@ -101,15 +93,15 @@ public class WndRanking extends WndTabbed {
createControls();
} else {
hide();
Game.scene().add( new WndError( TXT_ERROR ) );
Game.scene().add( new WndError( error ) );
}
}
}
private void createControls() {
String[] labels =
{TXT_STATS, TXT_ITEMS, TXT_BADGES};
{Messages.get(this, "stats"), Messages.get(this, "items"), Messages.get(this, "badges")};
Group[] pages =
{new StatsTab(), new ItemsTab(), new BadgesTab()};
@@ -147,24 +139,7 @@ public class WndRanking extends WndTabbed {
private class StatsTab extends Group {
private int GAP = 4;
private static final String TXT_TITLE = "Level %d %s";
private static final String TXT_CHALLENGES = "Challenges";
private static final String TXT_HEALTH = "Health";
private static final String TXT_STR = "Strength";
private static final String TXT_DURATION = "Game Duration";
private static final String TXT_DEPTH = "Maximum Depth";
private static final String TXT_ENEMIES = "Mobs Killed";
private static final String TXT_GOLD = "Gold Collected";
private static final String TXT_FOOD = "Food Eaten";
private static final String TXT_ALCHEMY = "Potions Cooked";
private static final String TXT_ANKHS = "Ankhs Used";
public StatsTab() {
super();
@@ -174,7 +149,7 @@ public class WndRanking extends WndTabbed {
IconTitle title = new IconTitle();
title.icon( HeroSprite.avatar( Dungeon.hero.heroClass, Dungeon.hero.tier() ) );
title.label( Utils.format( TXT_TITLE, Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
title.label( Messages.get(this, "title", Dungeon.hero.lvl, heroClass ).toUpperCase( Locale.ENGLISH ) );
title.color(Window.SHPX_COLOR);
title.setRect( 0, 0, WIDTH, 0 );
add( title );
@@ -182,7 +157,7 @@ public class WndRanking extends WndTabbed {
float pos = title.bottom();
if (Dungeon.challenges > 0) {
RedButton btnCatalogus = new RedButton( TXT_CHALLENGES ) {
RedButton btnCatalogus = new RedButton( Messages.get(this, "challenges") ) {
@Override
protected void onClick() {
Game.scene().add( new WndChallenges( Dungeon.challenges, false ) );
@@ -196,24 +171,24 @@ public class WndRanking extends WndTabbed {
pos += GAP + GAP;
pos = statSlot( this, TXT_STR, Integer.toString( Dungeon.hero.STR ), pos );
pos = statSlot( this, TXT_HEALTH, Integer.toString( Dungeon.hero.HT ), pos );
pos = statSlot( this, Messages.get(this, "str"), Integer.toString( Dungeon.hero.STR ), pos );
pos = statSlot( this, Messages.get(this, "health"), Integer.toString( Dungeon.hero.HT ), pos );
pos += GAP;
pos = statSlot( this, TXT_DURATION, Integer.toString( (int)Statistics.duration ), pos );
pos = statSlot( this, Messages.get(this, "duration"), Integer.toString( (int)Statistics.duration ), pos );
pos += GAP;
pos = statSlot( this, TXT_DEPTH, Integer.toString( Statistics.deepestFloor ), pos );
pos = statSlot( this, TXT_ENEMIES, Integer.toString( Statistics.enemiesSlain ), pos );
pos = statSlot( this, TXT_GOLD, Integer.toString( Statistics.goldCollected ), pos );
pos = statSlot( this, Messages.get(this, "depth"), Integer.toString( Statistics.deepestFloor ), pos );
pos = statSlot( this, Messages.get(this, "enemies"), Integer.toString( Statistics.enemiesSlain ), pos );
pos = statSlot( this, Messages.get(this, "gold"), Integer.toString( Statistics.goldCollected ), pos );
pos += GAP;
pos = statSlot( this, TXT_FOOD, Integer.toString( Statistics.foodEaten ), pos );
pos = statSlot( this, TXT_ALCHEMY, Integer.toString( Statistics.potionsCooked ), pos );
pos = statSlot( this, TXT_ANKHS, Integer.toString( Statistics.ankhsUsed ), pos );
pos = statSlot( this, Messages.get(this, "food"), Integer.toString( Statistics.foodEaten ), pos );
pos = statSlot( this, Messages.get(this, "alchemy"), Integer.toString( Statistics.potionsCooked ), pos );
pos = statSlot( this, Messages.get(this, "ankhs"), Integer.toString( Statistics.ankhsUsed ), pos );
}
private float statSlot( Group parent, String label, String value, float pos ) {
@@ -20,24 +20,21 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Game;
import com.shatteredpixel.shatteredpixeldungeon.Rankings;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Ankh;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Game;
public class WndResurrect extends Window {
private static final String TXT_MESSAGE = "You died, but you were given another chance to win this dungeon. Will you take it?";
private static final String TXT_YES = "Yes, I will fight!";
private static final String TXT_NO = "No, I give up";
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 20;
private static final float GAP = 2;
@@ -58,13 +55,13 @@ public class WndResurrect extends Window {
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
BitmapTextMultiline message = PixelScene.createMultiline( TXT_MESSAGE, 6 );
BitmapTextMultiline message = PixelScene.createMultiline( Messages.get(this, "message"), 6 );
message.maxWidth = WIDTH;
message.measure();
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnYes = new RedButton( TXT_YES ) {
RedButton btnYes = new RedButton( Messages.get(this, "yes") ) {
@Override
protected void onClick() {
hide();
@@ -78,7 +75,7 @@ public class WndResurrect extends Window {
btnYes.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT );
add( btnYes );
RedButton btnNo = new RedButton( TXT_NO ) {
RedButton btnNo = new RedButton( Messages.get(this, "no") ) {
@Override
protected void onClick() {
hide();
@@ -36,23 +36,6 @@ import com.watabou.noosa.BitmapTextMultiline;
public class WndSadGhost extends Window {
private static final String TXT_RAT =
"Thank you, that horrid rat is slain and I can finally rest..." +
"I wonder what twisted magic created such a foul creature...\n\n";
private static final String TXT_GNOLL =
"Thank you, that scheming gnoll is slain and I can finally rest..." +
"I wonder what twisted magic made it so smart...\n\n";
private static final String TXT_CRAB =
"Thank you, that giant crab is slain and I can finally rest..." +
"I wonder what twisted magic allowed it to live so long...\n\n";
private static final String TXT_GIVEITEM=
"Please take one of these items, they are useless to me now... " +
"Maybe they will help you in your journey...\n\n" +
"Also... There is an item lost in this dungeon that is very dear to me..." +
"If you ever... find my... rose......";
private static final String TXT_WEAPON = "Ghost's weapon";
private static final String TXT_ARMOR = "Ghost's armor";
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 20;
private static final float GAP = 2;
@@ -66,23 +49,22 @@ public class WndSadGhost extends Window {
switch (type){
case 1:default:
titlebar.icon( new FetidRatSprite() );
titlebar.label( "DEFEATED FETID RAT" );
message = PixelScene.createMultiline( TXT_RAT+TXT_GIVEITEM, 6 );
titlebar.label( Messages.get(this, "rat_title") );
message = PixelScene.createMultiline( Messages.get(this, "rat")+Messages.get(this, "give_item"), 6 );
break;
case 2:
titlebar.icon( new GnollTricksterSprite() );
titlebar.label( "DEFEATED GNOLL TRICKSTER" );
message = PixelScene.createMultiline( TXT_GNOLL+TXT_GIVEITEM, 6 );
titlebar.label( Messages.get(this, "gnoll_title") );
message = PixelScene.createMultiline( Messages.get(this, "gnoll")+Messages.get(this, "give_item"), 6 );
break;
case 3:
titlebar.icon( new GreatCrabSprite());
titlebar.label( "DEFEATED GREAT CRAB" );
message = PixelScene.createMultiline( TXT_CRAB+TXT_GIVEITEM, 6 );
titlebar.label( Messages.get(this, "crab_title") );
message = PixelScene.createMultiline( Messages.get(this, "crab")+Messages.get(this, "give_item"), 6 );
break;
}
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
@@ -91,7 +73,7 @@ public class WndSadGhost extends Window {
message.y = titlebar.bottom() + GAP;
add( message );
RedButton btnWeapon = new RedButton( TXT_WEAPON ) {
RedButton btnWeapon = new RedButton( Messages.get(this, "weapon") ) {
@Override
protected void onClick() {
selectReward( ghost, Ghost.Quest.weapon );
@@ -101,7 +83,7 @@ public class WndSadGhost extends Window {
add( btnWeapon );
if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) {
RedButton btnArmor = new RedButton(TXT_ARMOR) {
RedButton btnArmor = new RedButton( Messages.get(this, "armor") ) {
@Override
protected void onClick() {
selectReward(ghost, Ghost.Quest.armor);
@@ -126,7 +108,7 @@ public class WndSadGhost extends Window {
Dungeon.level.drop( reward, ghost.pos ).sprite.drop();
}
ghost.yell( "Farewell, adventurer!" );
ghost.yell( Messages.get(this, "farewell") );
ghost.die( null );
Ghost.Quest.complete();
@@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
@@ -35,8 +36,6 @@ import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample;
public class WndSettings extends WndTabbed {
private static final String TXT_SWITCH_PORT = "Switch to portrait";
private static final String TXT_SWITCH_LAND = "Switch to landscape";
private static final int WIDTH = 112;
private static final int HEIGHT = 112;
@@ -61,7 +60,7 @@ public class WndSettings extends WndTabbed {
audio = new AudioTab();
add( audio );
add( new LabeledTab("Screen"){
add( new LabeledTab(Messages.get(this, "screen")){
@Override
protected void select(boolean value) {
super.select(value);
@@ -69,7 +68,7 @@ public class WndSettings extends WndTabbed {
}
});
add( new LabeledTab("UI"){
add( new LabeledTab(Messages.get(this, "ui")){
@Override
protected void select(boolean value) {
super.select(value);
@@ -77,7 +76,7 @@ public class WndSettings extends WndTabbed {
}
});
add( new LabeledTab("Audio"){
add( new LabeledTab(Messages.get(this, "audio")){
@Override
protected void select(boolean value) {
super.select(value);
@@ -98,7 +97,7 @@ public class WndSettings extends WndTabbed {
public ScreenTab() {
super();
OptionSlider scale = new OptionSlider("Display Scale",
OptionSlider scale = new OptionSlider(Messages.get(this, "scale"),
(int)Math.ceil(2* Game.density)+ "X",
PixelScene.maxDefaultZoom + "X",
(int)Math.ceil(2* Game.density),
@@ -119,7 +118,8 @@ public class WndSettings extends WndTabbed {
scale.setRect(0, 0, 0, 0);
}
OptionSlider brightness = new OptionSlider("Brightness", "Dark", "Bright", -2, 4) {
OptionSlider brightness = new OptionSlider(Messages.get(this, "brightness"),
Messages.get(this, "dark"), Messages.get(this, "bright"), -2, 4) {
@Override
protected void onChange() {
ShatteredPixelDungeon.brightness(getSelectedValue());
@@ -129,7 +129,7 @@ public class WndSettings extends WndTabbed {
brightness.setRect(0, scale.bottom() + GAP_SML, WIDTH, SLIDER_HEIGHT);
add(brightness);
CheckBox chkImmersive = new CheckBox( "Hide Software Keys" ) {
CheckBox chkImmersive = new CheckBox( Messages.get(this, "soft_keys") ) {
@Override
protected void onClick() {
super.onClick();
@@ -142,7 +142,9 @@ public class WndSettings extends WndTabbed {
add(chkImmersive);
RedButton btnOrientation = new RedButton( ShatteredPixelDungeon.landscape() ? TXT_SWITCH_PORT : TXT_SWITCH_LAND ) {
RedButton btnOrientation = new RedButton( ShatteredPixelDungeon.landscape() ?
Messages.get(this, "portrait")
: Messages.get(this, "landscape") ) {
@Override
protected void onClick() {
ShatteredPixelDungeon.landscape(!ShatteredPixelDungeon.landscape());
@@ -158,12 +160,12 @@ public class WndSettings extends WndTabbed {
public UITab(){
super();
BitmapText barDesc = PixelScene.createText("Toolbar Mode:", 9);
BitmapText barDesc = PixelScene.createText(Messages.get(this, "mode"), 9);
barDesc.measure();
barDesc.x = (WIDTH-barDesc.width())/2;
add(barDesc);
RedButton btnSplit = new RedButton("Split"){
RedButton btnSplit = new RedButton(Messages.get(this, "split")){
@Override
protected void onClick() {
ShatteredPixelDungeon.toolbarMode(Toolbar.Mode.SPLIT.name());
@@ -173,7 +175,7 @@ public class WndSettings extends WndTabbed {
btnSplit.setRect( 1, barDesc.y + barDesc.height(), 36, BTN_HEIGHT);
add(btnSplit);
RedButton btnGrouped = new RedButton("Group"){
RedButton btnGrouped = new RedButton(Messages.get(this, "group")){
@Override
protected void onClick() {
ShatteredPixelDungeon.toolbarMode(Toolbar.Mode.GROUP.name());
@@ -183,7 +185,7 @@ public class WndSettings extends WndTabbed {
btnGrouped.setRect( btnSplit.right()+1, barDesc.y + barDesc.height(), 36, BTN_HEIGHT);
add(btnGrouped);
RedButton btnCentered = new RedButton("Center"){
RedButton btnCentered = new RedButton(Messages.get(this, "center")){
@Override
protected void onClick() {
ShatteredPixelDungeon.toolbarMode(Toolbar.Mode.CENTER.name());
@@ -193,7 +195,7 @@ public class WndSettings extends WndTabbed {
btnCentered.setRect(btnGrouped.right()+1, barDesc.y + barDesc.height(), 36, BTN_HEIGHT);
add(btnCentered);
CheckBox chkFlipToolbar = new CheckBox("Flip Toolbar"){
CheckBox chkFlipToolbar = new CheckBox(Messages.get(this, "flip_toolbar")){
@Override
protected void onClick() {
super.onClick();
@@ -205,7 +207,7 @@ public class WndSettings extends WndTabbed {
chkFlipToolbar.checked(ShatteredPixelDungeon.flipToolbar());
add(chkFlipToolbar);
CheckBox chkFlipTags = new CheckBox("Flip Indicators"){
CheckBox chkFlipTags = new CheckBox(Messages.get(this, "flip_indicators")){
@Override
protected void onClick() {
super.onClick();
@@ -217,7 +219,7 @@ public class WndSettings extends WndTabbed {
chkFlipTags.checked(ShatteredPixelDungeon.flipTags());
add(chkFlipTags);
OptionSlider slots = new OptionSlider("Quickslots", "0", "4", 0, 4) {
OptionSlider slots = new OptionSlider(Messages.get(this, "quickslots"), "0", "4", 0, 4) {
@Override
protected void onChange() {
ShatteredPixelDungeon.quickSlots(getSelectedValue());
@@ -234,7 +236,7 @@ public class WndSettings extends WndTabbed {
private class AudioTab extends Group {
public AudioTab() {
OptionSlider musicVol = new OptionSlider("Music Volume", "0", "10", 0, 10) {
OptionSlider musicVol = new OptionSlider(Messages.get(this, "music_vol"), "0", "10", 0, 10) {
@Override
protected void onChange() {
Music.INSTANCE.volume(getSelectedValue()/10f);
@@ -245,7 +247,7 @@ public class WndSettings extends WndTabbed {
musicVol.setRect(0, 0, WIDTH, SLIDER_HEIGHT);
add(musicVol);
CheckBox musicMute = new CheckBox("Mute Music"){
CheckBox musicMute = new CheckBox(Messages.get(this, "music_mute")){
@Override
protected void onClick() {
super.onClick();
@@ -257,7 +259,7 @@ public class WndSettings extends WndTabbed {
add(musicMute);
OptionSlider SFXVol = new OptionSlider("SFX Volume", "0", "10", 0, 10) {
OptionSlider SFXVol = new OptionSlider(Messages.get(this, "sfx_vol"), "0", "10", 0, 10) {
@Override
protected void onChange() {
Sample.INSTANCE.volume(getSelectedValue()/10f);
@@ -268,7 +270,7 @@ public class WndSettings extends WndTabbed {
SFXVol.setRect(0, musicMute.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
add(SFXVol);
CheckBox btnSound = new CheckBox( "Mute SFX" ) {
CheckBox btnSound = new CheckBox( Messages.get(this, "sfx_mute") ) {
@Override
protected void onClick() {
super.onClick();
@@ -20,15 +20,16 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.input.Touchscreen.Touch;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Game;
import com.watabou.noosa.TouchArea;
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.watabou.utils.SparseArray;
public class WndStory extends Window {
@@ -44,41 +45,17 @@ public class WndStory extends Window {
public static final int ID_SEWERS = 0;
public static final int ID_PRISON = 1;
public static final int ID_CAVES = 2;
public static final int ID_METROPOLIS = 3;
public static final int ID_CITY = 3;
public static final int ID_HALLS = 4;
private static final SparseArray<String> CHAPTERS = new SparseArray<String>();
static {
CHAPTERS.put( ID_SEWERS,
"The Dungeon lies right beneath the City, its upper levels actually constitute the City's sewer system.\n\n " +
"As dark energy has crept up from below the usually harmless sewer creatures have become more and more " +
"dangerous. The city sends guard patrols down here to try and maintain safety for those above, but " +
"they are slowly failing.\n\n This place is dangerous, but at least the evil magic at work here is weak." );
CHAPTERS.put( ID_PRISON,
"Many years ago a prison was built here to house dangerous criminals. " +
"Tightly regulated and secure, convicts from all over the land were brought here to serve time.\n\n" +
"But soon dark miasma started to creep from below, twisting the minds of guard and prisoner alike.\n\n" +
"In response to the mounting chaos, the city sealed off the entire prison. " +
"Nobody knows what became of those who were left for dead within these walls..." );
CHAPTERS.put( ID_CAVES,
"The caves, which stretch down under the abandoned prison, are sparcely populated. They lie too deep to be exploited " +
"by the City and they are too poor in minerals to interest the dwarves. In the past there was a trade outpost " +
"somewhere here on the route between these two states, but it has perished since the decline of Dwarven Metropolis. " +
"Only omnipresent gnolls and subterranean animals dwell here now." );
CHAPTERS.put( ID_METROPOLIS,
"Dwarven Metropolis was once the greatest of dwarven city-states. In its heyday the mechanized army of dwarves " +
"has successfully repelled the invasion of the old god and his demon army. But it is said, that the returning warriors " +
"have brought seeds of corruption with them, and that victory was the beginning of the end for the underground kingdom." );
CHAPTERS.put( ID_HALLS,
"In the past these levels were the outskirts of Metropolis. After the costly victory in the war with the old god " +
"dwarves were too weakened to clear them of remaining demons. Gradually demons have tightened their grip on this place " +
"and now it's called Demon Halls.\n\n" +
"Very few adventurers have ever descended this far..." );
CHAPTERS.put( ID_SEWERS, "sewers" );
CHAPTERS.put( ID_PRISON, "prison" );
CHAPTERS.put( ID_CAVES, "caves" );
CHAPTERS.put( ID_CITY, "city" );
CHAPTERS.put( ID_HALLS, "halls" );
};
private BitmapTextMultiline tf;
@@ -127,7 +104,7 @@ public class WndStory extends Window {
return;
}
String text = CHAPTERS.get( id );
String text = Messages.get(WndStory.class, CHAPTERS.get( id ));
if (text != null) {
WndStory wnd = new WndStory( text );
if ((wnd.delay = 0.6f) > 0) {
@@ -20,17 +20,16 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.noosa.BitmapTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
@@ -38,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapTextMultiline;
public class WndTradeItem extends Window {
@@ -45,18 +45,6 @@ public class WndTradeItem extends Window {
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 16;
private static final String TXT_SALE = "FOR SALE: %s - %dg";
private static final String TXT_BUY = "Buy for %dg";
private static final String TXT_STEAL = "Steal with %d%% chance";
private static final String TXT_SELL = "Sell for %dg";
private static final String TXT_SELL_1 = "Sell 1 for %dg";
private static final String TXT_SELL_ALL = "Sell all for %dg";
private static final String TXT_CANCEL = "Never mind";
private static final String TXT_SOLD = "You've sold your %s for %dg";
private static final String TXT_BOUGHT = "You've bought %s for %dg";
private static final String TXT_STOLE = "You've stolen the %s";
private WndBag owner;
public WndTradeItem( final Item item, WndBag owner ) {
@@ -69,7 +57,7 @@ public class WndTradeItem extends Window {
if (item.quantity() == 1) {
RedButton btnSell = new RedButton( Utils.format( TXT_SELL, item.price() ) ) {
RedButton btnSell = new RedButton( Messages.get(this, "sell", item.price()) ) {
@Override
protected void onClick() {
sell( item );
@@ -84,7 +72,7 @@ public class WndTradeItem extends Window {
} else {
int priceAll= item.price();
RedButton btnSell1 = new RedButton( Utils.format( TXT_SELL_1, priceAll / item.quantity() ) ) {
RedButton btnSell1 = new RedButton( Messages.get(this, "sell_1", priceAll / item.quantity()) ) {
@Override
protected void onClick() {
sellOne( item );
@@ -93,7 +81,7 @@ public class WndTradeItem extends Window {
};
btnSell1.setRect( 0, pos + GAP, WIDTH, BTN_HEIGHT );
add( btnSell1 );
RedButton btnSellAll = new RedButton( Utils.format( TXT_SELL_ALL, priceAll ) ) {
RedButton btnSellAll = new RedButton( Messages.get(this, "sell_all", priceAll ) ) {
@Override
protected void onClick() {
sell( item );
@@ -107,7 +95,7 @@ public class WndTradeItem extends Window {
}
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
RedButton btnCancel = new RedButton( Messages.get(this, "cancel") ) {
@Override
protected void onClick() {
hide();
@@ -131,7 +119,7 @@ public class WndTradeItem extends Window {
if (canBuy) {
RedButton btnBuy = new RedButton( Utils.format( TXT_BUY, price ) ) {
RedButton btnBuy = new RedButton( Messages.get(this, "buy", price) ) {
@Override
protected void onClick() {
hide();
@@ -142,7 +130,7 @@ public class WndTradeItem extends Window {
btnBuy.enable( price <= Dungeon.gold );
add( btnBuy );
RedButton btnCancel = new RedButton( TXT_CANCEL ) {
RedButton btnCancel = new RedButton( Messages.get(this, "cancel") ) {
@Override
protected void onClick() {
hide();
@@ -152,13 +140,13 @@ public class WndTradeItem extends Window {
final MasterThievesArmband.Thievery thievery = Dungeon.hero.buff(MasterThievesArmband.Thievery.class);
if (thievery != null) {
final float chance = thievery.stealChance(price);
RedButton btnSteal = new RedButton(Utils.format(TXT_STEAL, Math.min(100, (int)(chance*100)))) {
RedButton btnSteal = new RedButton( Messages.get(this, "steal", Math.min(100, (int)(chance*100)))) {
@Override
protected void onClick() {
if(thievery.steal(price)){
Hero hero = Dungeon.hero;
Item item = heap.pickUp();
GLog.i( TXT_STOLE, item.name());
GLog.i( Messages.get(this, "stole", item.name()) );
hide();
if (!item.doPickUp( hero )) {
@@ -211,7 +199,7 @@ public class WndTradeItem extends Window {
IconTitle titlebar = new IconTitle();
titlebar.icon( new ItemSprite( item ) );
titlebar.label( forSale ?
Utils.format( TXT_SALE, item.toString(), price( item ) ) :
Messages.get(this, "sale", item.toString(), price( item ) ) :
Utils.capitalize( item.toString() ) );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
@@ -248,7 +236,7 @@ public class WndTradeItem extends Window {
int price = item.price();
new Gold( price ).doPickUp( hero );
GLog.i( TXT_SOLD, item.name(), price );
GLog.i( Messages.get(this, "sold"), item.name(), price );
}
private void sellOne( Item item ) {
@@ -263,7 +251,7 @@ public class WndTradeItem extends Window {
int price = item.price();
new Gold( price ).doPickUp( hero );
GLog.i( TXT_SOLD, item.name(), price );
GLog.i( Messages.get(this, "sold"), item.name(), price );
}
}
@@ -280,7 +268,7 @@ public class WndTradeItem extends Window {
int price = price( item );
Dungeon.gold -= price;
GLog.i( TXT_BOUGHT, item.name(), price );
GLog.i( Messages.get(this, "bought"), item.name(), price );
if (!item.doPickUp( hero )) {
Dungeon.level.drop( item, heap.pos ).sprite.drop();
@@ -20,38 +20,24 @@
*/
package com.shatteredpixel.shatteredpixeldungeon.windows;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry;
import com.watabou.noosa.BitmapTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Wandmaker;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.BitmapTextMultiline;
public class WndWandmaker extends Window {
private static final String TXT_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.";
private static final String TXT_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.";
private static final String TXT_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.";
private static final String TXT_FARAWELL = "Good luck in your quest, %s!";
private static final int WIDTH = 120;
private static final int BTN_HEIGHT = 20;
private static final float GAP = 2;
@@ -68,11 +54,11 @@ public class WndWandmaker extends Window {
String msg = "";
if (item instanceof CorpseDust){
msg = TXT_DUST;
msg = Messages.get(this, "dust");
} else if (item instanceof Embers){
msg = TXT_EMBER;
msg = Messages.get(this, "ember");
} else if (item instanceof Rotberry.Seed){
msg = TXT_BERRY;
msg = Messages.get(this, "berry");
}
BitmapTextMultiline message = PixelScene.createMultiline( msg, 6 );
@@ -115,7 +101,7 @@ public class WndWandmaker extends Window {
Dungeon.level.drop( reward, wandmaker.pos ).sprite.drop();
}
wandmaker.yell( Utils.format( TXT_FARAWELL, Dungeon.hero.givenName() ) );
wandmaker.yell( Messages.get(this, "farewell", Dungeon.hero.givenName()) );
wandmaker.destroy();
wandmaker.sprite.die();