From d8b74a3a0ed25a7d3bc6735a105cdd4f00a214d1 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 31 Dec 2015 02:23:01 -0500 Subject: [PATCH] v0.3.4 externalized most scene strings --- .../messages/messages.properties | 120 +++++++++++++----- .../scenes/AmuletScene.java | 16 +-- .../scenes/BadgesScene.java | 5 +- .../scenes/GameScene.java | 26 ++-- .../scenes/InterlevelScene.java | 51 ++------ .../scenes/IntroScene.java | 12 +- .../scenes/RankingsScene.java | 15 +-- .../scenes/StartScene.java | 39 ++---- .../scenes/SurfaceScene.java | 5 +- .../scenes/TitleScene.java | 24 ++-- 10 files changed, 145 insertions(+), 168 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/messages.properties b/src/com/shatteredpixel/shatteredpixeldungeon/messages/messages.properties index 77f233808..678a6e118 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/messages.properties +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/messages.properties @@ -1,3 +1,4 @@ +###actors actors.blobs.confusiongas.desc=A cloud of confusion gas is swirling here. actors.blobs.fire.desc=A fire is raging here. actors.blobs.foliage.desc=Shafts of light pierce the gloom of the underground garden. @@ -394,46 +395,16 @@ actors.char.def_verb=dodged +###items items.bags.bag.name=backpack items.wands.wandofregrowth$dewcatcher.name=Dewcatcher items.wands.wandofregrowth$dewcatcher.desc=Dewcatchers camouflage as grass to avoid attention, but their bulges of collected dew give them away. items.wands.wandofregrowth$seedpod.name=Seed Pod items.wands.wandofregrowth$seedpod.desc=Seed Pods look pretty, but the seeds they carry are actually stolen from other plants they kill with their roots. -plants.blandfruitbush.name=Blandfruit -plants.blandfruitbush.desc=Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like caked dust. The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked. -plants.blindweed.name=Blindweed -plants.blindweed.desc=Upon being touched a Blindweed perishes in a bright flash of light. The flash is strong enough to disorient for several seconds. -plants.dreamfoil.name=Dreamfoil -plants.dreamfoil.refreshed=You feel refreshed. -plants.dreamfoil.desc=The Dreamfoil's prickly flowers contain a chemical which is known for its properties as a strong neutralizing agent. Most weaker creatures are overwhelmed and knocked unconscious, which gives the plant its namesake. -plants.earthroot.name=Earthroot -plants.earthroot.desc=When a creature touches an Earthroot, its roots create a kind of immobile natural armor around it. -plants.earthroot$armor.name=Herbal armor -plants.earthroot$armor.desc=A kind of natural, immobile armor is protecting you. The armor forms plates of bark and twine, wrapping around your body.\n\nThis herbal armor will absorb 50%% of all physical damage you take, until it eventually runs out of durability and collapses. The armor is also immobile, if you attempt to move it will break apart and be lost.\n\nThe herbal armor can absorb %d more damage before breaking. -plants.fadeleaf.name=Fadeleaf -plants.fadeleaf.desc=Touching a Fadeleaf will teleport any creature to a random place on the current level. -plants.firebloom.name=Firebloom -plants.firebloom.desc=When something touches a Firebloom, it bursts into flames. -plants.icecap.name=Icecap -plants.icecap.desc=Upon being touched, an Icecap lets out a puff of freezing pollen. The freezing effect is much stronger if the environment is wet. -plants.plant$seed.seed_of=seed of %s -plants.plant$seed.ac_plant=PLANT -plants.plant$seed.info=Throw this seed to the place where you want to grow %s.\n\n%s -plants.rotberry.name=Rotberry -plants.rotberry.desc=The berries of a young rotberry shrub taste like sweet, sweet death.\n\nGiven several days, this rotberry shrub will grow into another rot heart. -plants.sorrowmoss.name=Sorrowmoss -plants.sorrowmoss.desc=A Sorrowmoss is a flower (not a moss) with razor-sharp petals, coated with a deadly venom. -plants.starflower.name=Starflower -plants.starflower.desc=An extremely rare plant, Starflower is said to grant holy power to whomever touches it. -plants.stormvine.name=Stormvine -plants.stormvine.desc=Gravity affects the Stormvine plant strangely, allowing its whispy blue tendrils to 'hang' on the air. Anything caught in the vine is affected by this, and becomes disoriented. -plants.sungrass.name=Sungrass -plants.sungrass.desc=Sungrass is renowned for its sap's slow but effective healing properties. -plants.sungrass$health.name=Herbal Healing -plants.sungrass$health.desc=Sungrass possesses excellent healing properties, though its not as fast as a potion of healing.\n\nYou are current slowly regenerating health from the sungrass plant. Taking damage while healing will reduce the healing effectiveness, and moving off the plant will break the healing effect.\n\nYou can heal for %d more health, or until your health is full. +###levels levels.features.alchemypot.select_seed=Select a seed to throw levels.features.alchemypot.pot=Alchemy Pot levels.features.alchemypot.fruit=Cook a Blandfruit @@ -627,10 +598,95 @@ levels.sewerlevel.bookshelf_desc=The bookshelf is packed with cheap useless book +###plants +plants.blandfruitbush.name=Blandfruit +plants.blandfruitbush.desc=Distant cousin of the Rotberry, the pear-shaped produce of the Blandfruit bush tastes like caked dust. The fruit is gross and unsubstantial but isn't poisonous. perhaps it could be cooked. +plants.blindweed.name=Blindweed +plants.blindweed.desc=Upon being touched a Blindweed perishes in a bright flash of light. The flash is strong enough to disorient for several seconds. +plants.dreamfoil.name=Dreamfoil +plants.dreamfoil.refreshed=You feel refreshed. +plants.dreamfoil.desc=The Dreamfoil's prickly flowers contain a chemical which is known for its properties as a strong neutralizing agent. Most weaker creatures are overwhelmed and knocked unconscious, which gives the plant its namesake. +plants.earthroot.name=Earthroot +plants.earthroot.desc=When a creature touches an Earthroot, its roots create a kind of immobile natural armor around it. +plants.earthroot$armor.name=Herbal armor +plants.earthroot$armor.desc=A kind of natural, immobile armor is protecting you. The armor forms plates of bark and twine, wrapping around your body.\n\nThis herbal armor will absorb 50%% of all physical damage you take, until it eventually runs out of durability and collapses. The armor is also immobile, if you attempt to move it will break apart and be lost.\n\nThe herbal armor can absorb %d more damage before breaking. +plants.fadeleaf.name=Fadeleaf +plants.fadeleaf.desc=Touching a Fadeleaf will teleport any creature to a random place on the current level. +plants.firebloom.name=Firebloom +plants.firebloom.desc=When something touches a Firebloom, it bursts into flames. +plants.icecap.name=Icecap +plants.icecap.desc=Upon being touched, an Icecap lets out a puff of freezing pollen. The freezing effect is much stronger if the environment is wet. +plants.plant$seed.seed_of=seed of %s +plants.plant$seed.ac_plant=PLANT +plants.plant$seed.info=Throw this seed to the place where you want to grow %s.\n\n%s +plants.rotberry.name=Rotberry +plants.rotberry.desc=The berries of a young rotberry shrub taste like sweet, sweet death.\n\nGiven several days, this rotberry shrub will grow into another rot heart. +plants.sorrowmoss.name=Sorrowmoss +plants.sorrowmoss.desc=A Sorrowmoss is a flower (not a moss) with razor-sharp petals, coated with a deadly venom. +plants.starflower.name=Starflower +plants.starflower.desc=An extremely rare plant, Starflower is said to grant holy power to whomever touches it. +plants.stormvine.name=Stormvine +plants.stormvine.desc=Gravity affects the Stormvine plant strangely, allowing its whispy blue tendrils to 'hang' on the air. Anything caught in the vine is affected by this, and becomes disoriented. +plants.sungrass.name=Sungrass +plants.sungrass.desc=Sungrass is renowned for its sap's slow but effective healing properties. +plants.sungrass$health.name=Herbal Healing +plants.sungrass$health.desc=Sungrass possesses excellent healing properties, though its not as fast as a potion of healing.\n\nYou are current slowly regenerating health from the sungrass plant. Taking damage while healing will reduce the healing effectiveness, and moving off the plant will break the healing effect.\n\nYou can heal for %d more health, or until your health is full. + + + +###scenes +#scenes.aboutscene.= +scenes.amuletscene.exit=Let's call it a day +scenes.amuletscene.stay=I'm not done yet +scenes.amuletscene.text=You finally hold it in your hands, the Amulet of Yendor. Using its power you can take over the world or bring peace and prosperity to people or whatever. Anyway, your life will change forever and this game will end here. Or you can stay a mere mortal a little longer. +scenes.badgesscene.title=Your Badges +scenes.gamescene.welcome=Welcome to the level %d of Pixel Dungeon! +scenes.gamescene.welcome_back=Welcome back to the level %d of Pixel Dungeon! +scenes.gamescene.chasm=Your steps echo across the dungeon. +scenes.gamescene.water=You hear water splashing around you. +scenes.gamescene.grass=The smell of vegetation is thick in the air. +scenes.gamescene.dark=You can hear enemies moving in the darkness... +scenes.gamescene.secrets=The atmosphere hints that this floor hides many secrets. +scenes.interlevelscene$mode.descend=Descending... +scenes.interlevelscene$mode.ascend=Ascending... +scenes.interlevelscene$mode.continue=Loading... +scenes.interlevelscene$mode.resurrect=Resurrecting... +scenes.interlevelscene$mode.return=Returning... +scenes.interlevelscene$mode.fall=Falling... +scenes.interlevelscene$mode.reset=Resetting... +scenes.interlevelscene.file_not_found=Save file not found. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that. +scenes.interlevelscene.io_error=Cannot read save file. If this error persists after restarting, it may mean this save game is corrupted. Sorry about that. +scenes.introscene.text=Many heroes have ventured into the dungeon before you from the city above. Some have returned with treasures and magical artifacts, most have never been heard from again.\n\nNone, however, have ventured to the bottom and retrieved the Amulet of Yendor, which is said to be guarded by an ancient evil in the depths. Even now dark energy radiates from below, making its way up into the city.\n\nYou consider yourself ready for the challenge. Most importantly, you feel that fortune smiles upon you. It's time to start your own adventure! +scenes.rankingsscene.title=Top Rankings +scenes.rankingsscene.total=Games Played: +scenes.rankingsscene.no_games=No games have been played yet. +scenes.rankingsscene.no_info=No additional information +scenes.startscene.load=Load Game +scenes.startscene.new=New Game +scenes.startscene.erase=Erases Progress +scenes.startscene.depth_level=Depth: %d, Level: %d +scenes.startscene.really=Do you really want to start new game? +scenes.startscene.warning=Your current game progress will be erased. +scenes.startscene.yes=Yes, start new game +scenes.startscene.no=No, return to main menu +scenes.startscene.unlock=To unlock the huntress, slay the 3rd boss with any other class +scenes.startscene.need_to_win=To unlock Challenges, win the game with any character class. +scenes.surfacesscene.exit=Game Over +scenes.titlesscene.play=Play +scenes.titlesscene.rankings=Rankings +scenes.titlesscene.badges=Badges +scenes.titlesscene.about=About +#scenes.welcomescene.= + + + +###UI ui.quickslotbutton.select_item=Select an item to quickslot ui.toolbar.examine_prompt=Press again to search\nPress a cell for info + +###root classes badges.endorsed=Badge endorsed: %s badges.new_super=New super badge: %s badges.new=New badge: %s diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java index b2ab6ec37..a29f1f797 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.scenes; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; @@ -33,21 +34,12 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.watabou.utils.Random; public class AmuletScene extends PixelScene { - - private static final String TXT_EXIT = "Let's call it a day"; - private static final String TXT_STAY = "I'm not done yet"; private static final int WIDTH = 120; private static final int BTN_HEIGHT = 18; private static final float SMALL_GAP = 2; private static final float LARGE_GAP = 8; - private static final String TXT = - "You finally hold it in your hands, the Amulet of Yendor. Using its power " + - "you can take over the world or bring peace and prosperity to people or whatever. " + - "Anyway, your life will change forever and this game will end here. " + - "Or you can stay a mere mortal a little longer."; - public static boolean noText = false; private Image amulet; @@ -58,7 +50,7 @@ public class AmuletScene extends PixelScene { BitmapTextMultiline text = null; if (!noText) { - text = createMultiline( TXT, 8 ); + text = createMultiline( Messages.get(this, "text"), 8 ); text.maxWidth = WIDTH; text.measure(); add( text ); @@ -67,7 +59,7 @@ public class AmuletScene extends PixelScene { amulet = new Image( Assets.AMULET ); add( amulet ); - RedButton btnExit = new RedButton( TXT_EXIT ) { + RedButton btnExit = new RedButton( Messages.get(this, "exit") ) { @Override protected void onClick() { Dungeon.win( ResultDescriptions.WIN ); @@ -78,7 +70,7 @@ public class AmuletScene extends PixelScene { btnExit.setSize( WIDTH, BTN_HEIGHT ); add( btnExit ); - RedButton btnStay = new RedButton( TXT_STAY ) { + RedButton btnStay = new RedButton( Messages.get(this, "stay") ) { @Override protected void onClick() { onBackPressed(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/BadgesScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/BadgesScene.java index aa9006ea3..026f2d2ae 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/BadgesScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/BadgesScene.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBadge; import com.watabou.noosa.BitmapText; import com.watabou.noosa.Camera; @@ -42,8 +43,6 @@ import java.util.List; public class BadgesScene extends PixelScene { - private static final String TXT_TITLE = "Your Badges"; - @Override public void create() { @@ -72,7 +71,7 @@ public class BadgesScene extends PixelScene { float left = (w - size * nCols) / 2; float top = (h - size * nRows) / 2; - BitmapText title = PixelScene.createText( TXT_TITLE, 9 ); + BitmapText title = PixelScene.createText( Messages.get(this, "title"), 9 ); title.hardlight(Window.TITLE_COLOR); title.measure(); title.x = (w - title.width()) / 2 ; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index be9e63b7c..ca3a1b3b4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.WandHolster; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual; import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator; @@ -93,16 +94,7 @@ import com.watabou.utils.GameMath; import com.watabou.utils.Random; public class GameScene extends PixelScene { - - private static final String TXT_WELCOME = "Welcome to the level %d of Pixel Dungeon!"; - private static final String TXT_WELCOME_BACK = "Welcome back to the level %d of Pixel Dungeon!"; - - private static final String TXT_CHASM = "Your steps echo across the dungeon."; - private static final String TXT_WATER = "You hear water splashing around you."; - private static final String TXT_GRASS = "The smell of vegetation is thick in the air."; - private static final String TXT_DARK = "You can hear enemies moving in the darkness..."; - private static final String TXT_SECRETS = "The atmosphere hints that this floor hides many secrets."; - + static GameScene scene; private SkinnedBlock water; @@ -341,30 +333,30 @@ public class GameScene extends PixelScene { if (InterlevelScene.mode != InterlevelScene.Mode.NONE) { if (Dungeon.depth < Statistics.deepestFloor) { - GLog.h(TXT_WELCOME_BACK, Dungeon.depth); + GLog.h(Messages.get(this, "welcome_back"), Dungeon.depth); } else { - GLog.h(TXT_WELCOME, Dungeon.depth); + GLog.h(Messages.get(this, "welcome"), Dungeon.depth); Sample.INSTANCE.play(Assets.SND_DESCEND); } switch (Dungeon.level.feeling) { case CHASM: - GLog.w(TXT_CHASM); + GLog.w(Messages.get(this, "chasm")); break; case WATER: - GLog.w(TXT_WATER); + GLog.w(Messages.get(this, "water")); break; case GRASS: - GLog.w(TXT_GRASS); + GLog.w(Messages.get(this, "grass")); break; case DARK: - GLog.w(TXT_DARK); + GLog.w(Messages.get(this, "dark")); break; default: } if (Dungeon.level instanceof RegularLevel && ((RegularLevel) Dungeon.level).secretDoors > Random.IntRange(3, 4)) { - GLog.w(TXT_SECRETS); + GLog.w(Messages.get(this, "secrets")); } InterlevelScene.mode = InterlevelScene.Mode.NONE; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java index 7df35c251..340d25eeb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndError; import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory; @@ -43,22 +44,9 @@ public class InterlevelScene extends PixelScene { private static final float TIME_TO_FADE = 0.3f; - private static final String TXT_DESCENDING = "Descending..."; - private static final String TXT_ASCENDING = "Ascending..."; - private static final String TXT_LOADING = "Loading..."; - private static final String TXT_RESURRECTING= "Resurrecting..."; - private static final String TXT_RETURNING = "Returning..."; - private static final String TXT_FALLING = "Falling..."; - private static final String TXT_RESETTING = "Resetting..."; - - private static final String ERR_FILE_NOT_FOUND = "Save file not found. If this error persists after restarting, " + - "it may mean this save game is corrupted. Sorry about that."; - private static final String ERR_IO = "Cannot read save file. If this error persists after restarting, " + - "it may mean this save game is corrupted. Sorry about that."; - - public static enum Mode { + public enum Mode { DESCEND, ASCEND, CONTINUE, RESURRECT, RETURN, FALL, RESET, NONE - }; + } public static Mode mode; public static int returnDepth; @@ -70,7 +58,7 @@ public class InterlevelScene extends PixelScene { private enum Phase { FADE_IN, STATIC, FADE_OUT - }; + } private Phase phase; private float timeLeft; @@ -83,30 +71,7 @@ public class InterlevelScene extends PixelScene { public void create() { super.create(); - String text = ""; - switch (mode) { - case DESCEND: - text = TXT_DESCENDING; - break; - case ASCEND: - text = TXT_ASCENDING; - break; - case CONTINUE: - text = TXT_LOADING; - break; - case RESURRECT: - text = TXT_RESURRECTING; - break; - case RETURN: - text = TXT_RETURNING; - break; - case FALL: - text = TXT_FALLING; - break; - case RESET: - text = TXT_RESETTING; - break; - } + String text = Messages.get(Mode.class, mode.name()); message = PixelScene.createText( text, 9 ); message.measure(); @@ -202,8 +167,8 @@ public class InterlevelScene extends PixelScene { case STATIC: if (error != null) { String errorMsg; - if (error instanceof FileNotFoundException) errorMsg = ERR_FILE_NOT_FOUND; - else if (error instanceof IOException) errorMsg = ERR_IO; + if (error instanceof FileNotFoundException) errorMsg = Messages.get(this, "file_not_found"); + else if (error instanceof IOException) errorMsg = Messages.get(this, "io_error"); else throw new RuntimeException("fatal error occured while moving between floors", error); @@ -211,7 +176,7 @@ public class InterlevelScene extends PixelScene { public void onBackPressed() { super.onBackPressed(); Game.switchScene( StartScene.class ); - }; + } } ); error = null; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java index 821238f2a..7b7ccb982 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/IntroScene.java @@ -20,25 +20,17 @@ */ package com.shatteredpixel.shatteredpixeldungeon.scenes; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.noosa.Game; import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory; public class IntroScene extends PixelScene { - - private static final String TEXT = - "Many heroes have ventured into the dungeon before you from the city above. Some " + - "have returned with treasures and magical artifacts, most have never been heard from again.\n\n" + - "None, however, have ventured to the bottom and retrieved the Amulet of Yendor, " + - "which is said to be guarded by an ancient evil in the depths. " + - "Even now dark energy radiates from below, making its way up into the city.\n\n" + - "You consider yourself ready for the challenge. Most importantly, " + - "you feel that fortune smiles upon you. It's time to start your own adventure!"; @Override public void create() { super.create(); - add( new WndStory( TEXT ) { + add( new WndStory( Messages.get(this, "text") ) { @Override public void hide() { super.hide(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java index 49371b40c..0da5efa22 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.scenes; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.noosa.BitmapText; import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Camera; @@ -42,12 +43,6 @@ import com.watabou.utils.GameMath; public class RankingsScene extends PixelScene { - private static final String TXT_TITLE = "Top Rankings"; - private static final String TXT_TOTAL = "Games Played: "; - private static final String TXT_NO_GAMES = "No games have been played yet."; - - private static final String TXT_NO_INFO = "No additional information"; - private static final float ROW_HEIGHT_MAX = 20; private static final float ROW_HEIGHT_MIN = 12; @@ -76,7 +71,7 @@ public class RankingsScene extends PixelScene { Rankings.INSTANCE.load(); - BitmapText title = PixelScene.createText(TXT_TITLE, 9); + BitmapText title = PixelScene.createText( Messages.get(this, "title"), 9); title.hardlight(Window.SHPX_COLOR); title.measure(); title.x = (w - title.width()) / 2; @@ -108,7 +103,7 @@ public class RankingsScene extends PixelScene { } if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) { - BitmapText label = PixelScene.createText( TXT_TOTAL, 8 ); + BitmapText label = PixelScene.createText( Messages.get(this, "total") + " ", 8 ); label.hardlight( 0xCCCCCC ); label.measure(); add( label ); @@ -135,7 +130,7 @@ public class RankingsScene extends PixelScene { } else { - BitmapText noRec = PixelScene.createText(TXT_NO_GAMES, 8); + BitmapText noRec = PixelScene.createText(Messages.get(this, "no_games"), 8); noRec.hardlight( 0xCCCCCC ); noRec.measure(); noRec.x = (w - noRec.width()) / 2; @@ -297,7 +292,7 @@ public class RankingsScene extends PixelScene { if (rec.gameFile.length() > 0) { parent.add( new WndRanking( rec.gameFile ) ); } else { - parent.add( new WndError( TXT_NO_INFO ) ); + parent.add( new WndError( Messages.get(this, "no_info") ) ); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java index 0b984cde6..d6ec1a789 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import java.util.HashMap; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.noosa.BitmapText; import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Camera; @@ -57,29 +58,13 @@ public class StartScene extends PixelScene { private static final float BUTTON_HEIGHT = 24; private static final float GAP = 2; - private static final String TXT_LOAD = "Load Game"; - private static final String TXT_NEW = "New Game"; - - private static final String TXT_ERASE = "Erases Progress"; - private static final String TXT_DPTH_LVL = "Depth: %d, Level: %d"; - - private static final String TXT_REALLY = "Do you really want to start new game?"; - private static final String TXT_WARNING = "Your current game progress will be erased."; - private static final String TXT_YES = "Yes, start new game"; - private static final String TXT_NO = "No, return to main menu"; - - private static final String TXT_UNLOCK = "To unlock this character class, slay the 3rd boss with any other class"; - - private static final String TXT_WIN_THE_GAME = - "To unlock \"Challenges\", win the game with any character class."; - private static final float WIDTH_P = 116; private static final float HEIGHT_P = 220; private static final float WIDTH_L = 224; private static final float HEIGHT_L = 124; - private static HashMap shields = new HashMap(); + private static HashMap shields = new HashMap<>(); private float buttonX; private float buttonY; @@ -129,11 +114,15 @@ public class StartScene extends PixelScene { buttonX = left; buttonY = bottom - BUTTON_HEIGHT; - btnNewGame = new GameButton( TXT_NEW ) { + btnNewGame = new GameButton( Messages.get(this, "new") ) { @Override protected void onClick() { if (GamesInProgress.check( curClass ) != null) { - StartScene.this.add( new WndOptions( TXT_REALLY, TXT_WARNING, TXT_YES, TXT_NO ) { + StartScene.this.add( new WndOptions( + Messages.get(this, "really"), + Messages.get(this, "warning"), + Messages.get(this, "yes"), + Messages.get(this, "no") ) { @Override protected void onSelect( int index ) { if (index == 0) { @@ -149,7 +138,7 @@ public class StartScene extends PixelScene { }; add( btnNewGame ); - btnLoad = new GameButton( TXT_LOAD ) { + btnLoad = new GameButton( Messages.get(this, "load") ) { @Override protected void onClick() { InterlevelScene.mode = InterlevelScene.Mode.CONTINUE; @@ -208,7 +197,7 @@ public class StartScene extends PixelScene { if (!(huntressUnlocked = Badges.isUnlocked( Badges.Badge.BOSS_SLAIN_3 ))) { - BitmapTextMultiline text = PixelScene.createMultiline( TXT_UNLOCK, 9 ); + BitmapTextMultiline text = PixelScene.createMultiline( Messages.get(this, "unlock"), 9 ); text.maxWidth = (int)width; text.measure(); @@ -273,9 +262,9 @@ public class StartScene extends PixelScene { if (info != null) { btnLoad.visible = true; - btnLoad.secondary( Utils.format( TXT_DPTH_LVL, info.depth, info.level ), info.challenges ); + btnLoad.secondary( Utils.format( Messages.get(this, "depth_level"), info.depth, info.level ), info.challenges ); btnNewGame.visible = true; - btnNewGame.secondary( TXT_ERASE, false ); + btnNewGame.secondary( Messages.get(this, "erase"), false ); float w = (Camera.main.width - GAP) / 2 - buttonX; @@ -517,10 +506,10 @@ public class StartScene extends PixelScene { super.onBackPressed(); image.copy( Icons.get( ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) ); - }; + } } ); } else { - StartScene.this.add( new WndMessage( TXT_WIN_THE_GAME ) ); + StartScene.this.add( new WndMessage( Messages.get(this, "need_to_win") ) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java index f9399a67f..1355f8206 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/SurfaceScene.java @@ -24,6 +24,7 @@ import java.nio.FloatBuffer; import java.util.Calendar; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.gltextures.Gradient; import com.watabou.gltextures.SmartTexture; import com.watabou.glwrap.Matrix; @@ -142,7 +143,7 @@ public class SurfaceScene extends PixelScene { window.add( new TouchArea( sky ) { protected void onClick( Touch touch ) { pet.jump(); - }; + } } ); for (int i=0; i < nPatches; i++) { @@ -165,7 +166,7 @@ public class SurfaceScene extends PixelScene { frame.hardlight( 0xDDEEFF ); } - RedButton gameOver = new RedButton( "Game Over" ) { + RedButton gameOver = new RedButton( Messages.get(this, "exit") ) { protected void onClick() { Game.switchScene( TitleScene.class ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index e3a9ec103..1ba92e26c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -25,6 +25,7 @@ import javax.microedition.khronos.opengles.GL10; import android.opengl.GLES20; import com.shatteredpixel.shatteredpixeldungeon.Badges; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.ChangesButton; @@ -45,11 +46,6 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; import com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton; public class TitleScene extends PixelScene { - - private static final String TXT_PLAY = "Play"; - private static final String TXT_HIGHSCORES = "Rankings"; - private static final String TXT_BADGES = "Badges"; - private static final String TXT_ABOUT = "About"; @Override public void create() { @@ -99,7 +95,7 @@ public class TitleScene extends PixelScene { signs.y = title.y; add( signs ); - DashboardItem btnBadges = new DashboardItem( TXT_BADGES, 3 ) { + DashboardItem btnBadges = new DashboardItem( Messages.get(this, "badges"), 3 ) { @Override protected void onClick() { ShatteredPixelDungeon.switchNoFade( BadgesScene.class ); @@ -107,7 +103,7 @@ public class TitleScene extends PixelScene { }; add(btnBadges); - DashboardItem btnAbout = new DashboardItem( TXT_ABOUT, 1 ) { + DashboardItem btnAbout = new DashboardItem( Messages.get(this, "about"), 1 ) { @Override protected void onClick() { ShatteredPixelDungeon.switchNoFade( AboutScene.class ); @@ -115,7 +111,7 @@ public class TitleScene extends PixelScene { }; add( btnAbout ); - DashboardItem btnPlay = new DashboardItem( TXT_PLAY, 0 ) { + DashboardItem btnPlay = new DashboardItem( Messages.get(this, "play"), 0 ) { @Override protected void onClick() { ShatteredPixelDungeon.switchNoFade( StartScene.class ); @@ -123,25 +119,25 @@ public class TitleScene extends PixelScene { }; add( btnPlay ); - DashboardItem btnHighscores = new DashboardItem( TXT_HIGHSCORES, 2 ) { + DashboardItem btnRankings = new DashboardItem( Messages.get(this, "rankings"), 2 ) { @Override protected void onClick() { ShatteredPixelDungeon.switchNoFade( RankingsScene.class ); } }; - add( btnHighscores ); + add( btnRankings ); if (ShatteredPixelDungeon.landscape()) { float y = (h + height) / 2 - DashboardItem.SIZE; - btnHighscores .setPos( w / 2 - btnHighscores.width(), y ); - btnBadges .setPos( w / 2, y ); - btnPlay .setPos( btnHighscores.left() - btnPlay.width(), y ); + btnRankings .setPos( w / 2 - btnRankings.width(), y ); + btnBadges .setPos( w / 2, y ); + btnPlay .setPos( btnRankings.left() - btnPlay.width(), y ); btnAbout .setPos( btnBadges.right(), y ); } else { btnBadges.setPos( w / 2 - btnBadges.width(), (h + height) / 2 - DashboardItem.SIZE ); btnAbout.setPos( w / 2, (h + height) / 2 - DashboardItem.SIZE ); btnPlay.setPos( w / 2 - btnPlay.width(), btnAbout.top() - DashboardItem.SIZE ); - btnHighscores.setPos( w / 2, btnPlay.top() ); + btnRankings.setPos( w / 2, btnPlay.top() ); } BitmapText version = new BitmapText( "v " + Game.version + "", pixelFont);