diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java index 77b17fe55..a95fed752 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/BrokenSeal.java @@ -113,7 +113,8 @@ public class BrokenSeal extends Item { } else if (armor.glyph != null && seal.getGlyph() != null && armor.glyph.getClass() != seal.getGlyph().getClass()) { - GameScene.show(new WndOptions(Messages.get(BrokenSeal.class, "choose_title"), + GameScene.show(new WndOptions(new ItemSprite(seal), + Messages.get(BrokenSeal.class, "choose_title"), Messages.get(BrokenSeal.class, "choose_desc"), armor.glyph.name(), seal.getGlyph().name()){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java index 8c20323c1..89c28e3dd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindofMisc.java @@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; @@ -84,7 +85,8 @@ public abstract class KindofMisc extends EquipableItem { } GameScene.show( - new WndOptions(Messages.get(KindofMisc.class, "unequip_title"), + new WndOptions(new ItemSprite(this), + Messages.get(KindofMisc.class, "unequip_title"), Messages.get(KindofMisc.class, "unequip_message"), miscs[0] == null ? "---" : Messages.titleCase(miscs[0].toString()), miscs[1] == null ? "---" : Messages.titleCase(miscs[1].toString()), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index 33253f7ac..b9071f80e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; @@ -67,7 +68,8 @@ public class ChaliceOfBlood extends Artifact { if (damage > hero.HP*0.75) { GameScene.show( - new WndOptions(Messages.titleCase(Messages.get(this, "name")), + new WndOptions(new ItemSprite(this), + Messages.titleCase(name()), Messages.get(this, "prick_warn"), Messages.get(this, "yes"), Messages.get(this, "no")) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index 32379fc86..f9de37a17 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -35,6 +35,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfEnergy; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; @@ -89,7 +90,8 @@ public class TimekeepersHourglass extends Artifact { } else if (charge <= 0) GLog.i( Messages.get(this, "no_charge") ); else if (cursed) GLog.i( Messages.get(this, "cursed") ); else GameScene.show( - new WndOptions( Messages.get(this, "name"), + new WndOptions(new ItemSprite(this), + Messages.titleCase(name()), Messages.get(this, "prompt"), Messages.get(this, "stasis"), Messages.get(this, "freeze")) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index dff6da662..542e004aa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -41,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTransmutat import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.exotic.ExoticScroll; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; @@ -140,7 +141,7 @@ public class UnstableSpellbook extends Artifact { final ExploitHandler handler = Buff.affect(hero, ExploitHandler.class); handler.scroll = scroll; - GameScene.show(new WndOptions( + GameScene.show(new WndOptions(new ItemSprite(this), Messages.get(this, "prompt"), Messages.get(this, "read_empowered"), scroll.trueName(), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 40908cb61..5054f8610 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -238,7 +238,8 @@ public class Potion extends Item { if (isKnown() && mustThrowPots.contains(getClass())) { GameScene.show( - new WndOptions( Messages.get(Potion.class, "harmful"), + new WndOptions(new ItemSprite(this), + Messages.get(Potion.class, "harmful"), Messages.get(Potion.class, "sure_drink"), Messages.get(Potion.class, "yes"), Messages.get(Potion.class, "no") ) { @Override @@ -265,7 +266,8 @@ public class Potion extends Item { && !canThrowPots.contains(this.getClass())) { GameScene.show( - new WndOptions( Messages.get(Potion.class, "beneficial"), + new WndOptions(new ItemSprite(this), + Messages.get(Potion.class, "beneficial"), Messages.get(Potion.class, "sure_throw"), Messages.get(Potion.class, "yes"), Messages.get(Potion.class, "no") ) { @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java index 34647f1c7..7b8148888 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.audio.Sample; @@ -48,8 +49,11 @@ public abstract class InventoryScroll extends Scroll { } private void confirmCancelation() { - GameScene.show( new WndOptions( Messages.titleCase(name()), Messages.get(this, "warning"), - Messages.get(this, "yes"), Messages.get(this, "no") ) { + GameScene.show( new WndOptions(new ItemSprite(this), + Messages.titleCase(name()), + Messages.get(this, "warning"), + Messages.get(this, "yes"), + Messages.get(this, "no") ) { @Override protected void onSelect( int index ) { switch (index) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java index 70bb9b89f..053228ca5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/exotic/ScrollOfEnchantment.java @@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; @@ -65,7 +66,8 @@ public class ScrollOfEnchantment extends ExoticScroll { enchants[1] = Weapon.Enchantment.randomUncommon( existing ); enchants[2] = Weapon.Enchantment.random( existing, enchants[0].getClass(), enchants[1].getClass()); - GameScene.show(new WndOptions(Messages.titleCase(ScrollOfEnchantment.this.name()), + GameScene.show(new WndOptions(new ItemSprite(ScrollOfEnchantment.this), + Messages.titleCase(ScrollOfEnchantment.this.name()), Messages.get(ScrollOfEnchantment.class, "weapon") + "\n\n" + Messages.get(ScrollOfEnchantment.class, "cancel_warn"), @@ -102,7 +104,8 @@ public class ScrollOfEnchantment extends ExoticScroll { glyphs[1] = Armor.Glyph.randomUncommon( existing ); glyphs[2] = Armor.Glyph.random( existing, glyphs[0].getClass(), glyphs[1].getClass()); - GameScene.show(new WndOptions(Messages.titleCase(ScrollOfEnchantment.this.name()), + GameScene.show(new WndOptions( new ItemSprite(ScrollOfEnchantment.this), + Messages.titleCase(ScrollOfEnchantment.this.name()), Messages.get(ScrollOfEnchantment.class, "armor") + "\n\n" + Messages.get(ScrollOfEnchantment.class, "cancel_warn"), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java index 25c943b76..7ade346a4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/spells/BeaconOfReturning.java @@ -59,7 +59,8 @@ public class BeaconOfReturning extends Spell { if (returnDepth == -1){ setBeacon(hero); } else { - GameScene.show(new WndOptions(Messages.titleCase(name()), + GameScene.show(new WndOptions(new ItemSprite(this), + Messages.titleCase(name()), Messages.get(BeaconOfReturning.class, "wnd_body"), Messages.get(BeaconOfReturning.class, "wnd_set"), Messages.get(BeaconOfReturning.class, "wnd_return")){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 1ec915538..fe4162817 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -64,6 +64,7 @@ import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; +import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; @@ -371,7 +372,12 @@ public class CursedWand { return cursedEffect(origin, user, targetPos); } else { GameScene.show( - new WndOptions("CURSED WAND ERROR", "this application will now self-destruct", "abort", "retry", "fail") { + new WndOptions(Icons.get(Icons.WARNING), + "CURSED WAND ERROR", + "this application will now self-destruct", + "abort", + "retry", + "fail") { @Override protected void onSelect(int index) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java index e2dba7ac3..27053eefd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfWarding.java @@ -382,7 +382,8 @@ public class WandOfWarding extends Wand { Game.runOnRenderThread(new Callback() { @Override public void call() { - GameScene.show(new WndOptions( Messages.get(Ward.this, "dismiss_title"), + GameScene.show(new WndOptions( sprite(), + Messages.get(Ward.this, "dismiss_title"), Messages.get(Ward.this, "dismiss_body"), Messages.get(Ward.this, "dismiss_confirm"), Messages.get(Ward.this, "dismiss_cancel") ){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index 6f32ebea1..0457a864b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; @@ -403,7 +404,8 @@ public class MagesStaff extends MeleeWeapon { } GameScene.show( - new WndOptions("", + new WndOptions(new ItemSprite(item), + Messages.titleCase(item.name()), bodyText, Messages.get(MagesStaff.class, "yes"), Messages.get(MagesStaff.class, "no")) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java index 95ccbbced..680202337 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWea import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; @@ -200,7 +201,8 @@ public class Dart extends MissileWeapon { TippedDart tipResult = TippedDart.getTipped((Plant.Seed) item, 1); - GameScene.show(new WndOptions(Messages.get(Dart.class, "tip_title"), + GameScene.show(new WndOptions( new ItemSprite(item), + Messages.titleCase(item.name()), Messages.get(Dart.class, "tip_desc", tipResult.name()) + "\n\n" + tipResult.desc(), options){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java index 3bb014964..177665659 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java @@ -45,6 +45,7 @@ import com.shatteredpixel.shatteredpixeldungeon.plants.Stormvine; import com.shatteredpixel.shatteredpixeldungeon.plants.Sungrass; import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.utils.Reflection; @@ -74,7 +75,8 @@ public abstract class TippedDart extends Dart { super.execute(hero, action); if (action.equals( AC_CLEAN )){ - GameScene.show(new WndOptions(Messages.get(this, "clean_title"), + GameScene.show(new WndOptions(new ItemSprite(this), + Messages.titleCase(name()), Messages.get(this, "clean_desc"), Messages.get(this, "clean_all"), Messages.get(this, "clean_one"), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java index bf077d132..befc7deb7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/features/Chasm.java @@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; +import com.watabou.noosa.Image; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.Random; @@ -57,7 +58,8 @@ public class Chasm implements Hero.Doom { @Override public void call() { GameScene.show( - new WndOptions( Messages.get(Chasm.class, "chasm"), + new WndOptions( new Image(Dungeon.level.tilesTex(), 48, 48, 16, 16), + Messages.get(Chasm.class, "chasm"), Messages.get(Chasm.class, "jump"), Messages.get(Chasm.class, "yes"), Messages.get(Chasm.class, "no") ) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 87187fd87..c9ae75caf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -80,6 +80,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Banner; import com.shatteredpixel.shatteredpixeldungeon.ui.BusyIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.CharHealthIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog; +import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.LootIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton; import com.shatteredpixel.shatteredpixeldungeon.ui.ResumeIndicator; @@ -1137,8 +1138,10 @@ public class GameScene extends PixelScene { } else if (objects.size() == 1){ examineObject(objects.get(0)); } else { - GameScene.show(new WndOptions(Messages.get(GameScene.class, "choose_examine"), - Messages.get(GameScene.class, "multiple_examine"), names.toArray(new String[names.size()])){ + GameScene.show(new WndOptions(Icons.get(Icons.INFO), + Messages.get(GameScene.class, "choose_examine"), + Messages.get(GameScene.class, "multiple_examine"), + names.toArray(new String[names.size()])){ @Override protected void onSelect(int index) { examineObject(objects.get(index)); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java index fce8de6db..74dda83c1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -287,6 +287,7 @@ public class TitleScene extends PixelScene { AvailableUpdateData update = Updates.updateData(); ShatteredPixelDungeon.scene().addToFront( new WndOptions( + Icons.get(Icons.CHANGES), update.versionName == null ? Messages.get(this,"title") : Messages.get(this,"versioned_title", update.versionName), update.desc == null ? Messages.get(this,"desc") : update.desc, Messages.get(this,"update"), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java deleted file mode 100644 index 63d57afe2..000000000 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/UpdateNotification.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Pixel Dungeon - * Copyright (C) 2012-2015 Oleg Dolya - * - * Shattered Pixel Dungeon - * Copyright (C) 2014-2021 Evan Debenham - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - */ - -package com.shatteredpixel.shatteredpixeldungeon.ui; - -import com.shatteredpixel.shatteredpixeldungeon.Chrome; -import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.services.updates.AvailableUpdateData; -import com.shatteredpixel.shatteredpixeldungeon.services.updates.Updates; -import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; -import com.watabou.noosa.Game; - -public class UpdateNotification extends StyledButton { - - public UpdateNotification(){ - super( Chrome.Type.GREY_BUTTON_TR, Messages.get(UpdateNotification.class, "title") ); - textColor( Window.SHPX_COLOR ); - visible = false; - Updates.checkForUpdate(); - } - - @Override - public void update() { - super.update(); - - if (Updates.updateAvailable()){ - bg.alpha((float) (0.7f + Math.sin(Game.timeTotal*2)*0.3f)); - text.alpha((float) (0.7f + Math.sin(Game.timeTotal*2)*0.3f)); - visible = true; - } else { - visible = false; - } - - } - - @Override - protected void onClick() { - if (Updates.updateAvailable()){ - ShatteredPixelDungeon.scene().addToFront( new WndUpdate( Updates.updateData() ) ); - } - } - - public static class WndUpdate extends WndOptions { - - private AvailableUpdateData update; - - public WndUpdate( AvailableUpdateData update ){ - super( - update.versionName == null ? Messages.get(WndUpdate.class,"title") : Messages.get(WndUpdate.class,"versioned_title", update.versionName), - update.desc == null ? Messages.get(WndUpdate.class,"desc") : update.desc, - Messages.get(WndUpdate.class,"button")); - this.update = update; - } - - @Override - protected void onSelect(int index) { - if (index == 0) { - Updates.launchUpdate(update); - } - } - } -} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGameInProgress.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGameInProgress.java index d1fd338c9..2f47f6dda 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGameInProgress.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGameInProgress.java @@ -138,7 +138,7 @@ public class WndGameInProgress extends Window { protected void onClick() { super.onClick(); - ShatteredPixelDungeon.scene().add(new WndOptions( + ShatteredPixelDungeon.scene().add(new WndOptions(Icons.get(Icons.WARNING), Messages.get(WndGameInProgress.class, "erase_warn_title"), Messages.get(WndGameInProgress.class, "erase_warn_body"), Messages.get(WndGameInProgress.class, "erase_warn_yes"), diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java index 3638c0064..47051d359 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java @@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.noosa.Image; public class WndOptions extends Window { @@ -32,7 +33,24 @@ public class WndOptions extends Window { private static final int WIDTH_L = 144; private static final int MARGIN = 2; - private static final int BUTTON_HEIGHT = 20; + private static final int BUTTON_HEIGHT = 18; + + public WndOptions(Image icon, String title, String message, String... options) { + super(); + + int width = PixelScene.landscape() ? WIDTH_L : WIDTH_P; + + float pos = 0; + if (title != null) { + IconTitle tfTitle = new IconTitle(icon, title); + tfTitle.setRect(0, pos, width, 0); + add(tfTitle); + + pos = tfTitle.bottom() + 2*MARGIN; + } + + layoutBody(pos, message, options); + } public WndOptions( String title, String message, String... options ) { super(); @@ -47,16 +65,22 @@ public class WndOptions extends Window { tfTitle.maxWidth(width - MARGIN * 2); add(tfTitle); - pos = tfTitle.bottom() + 3*MARGIN; + pos = tfTitle.bottom() + 2*MARGIN; } + layoutBody(pos, message, options); + } + + private void layoutBody(float pos, String message, String... options){ + int width = PixelScene.landscape() ? WIDTH_L : WIDTH_P; + RenderedTextBlock tfMesage = PixelScene.renderTextBlock( 6 ); - tfMesage.text(message, width - MARGIN * 2); - tfMesage.setPos( MARGIN, pos ); + tfMesage.text(message, width); + tfMesage.setPos( 0, pos ); add( tfMesage ); - + pos = tfMesage.bottom() + 2*MARGIN; - + for (int i=0; i < options.length; i++) { final int index = i; RedButton btn = new RedButton( options[i] ) { @@ -67,13 +91,13 @@ public class WndOptions extends Window { } }; btn.enable(enabled(i)); - btn.setRect( MARGIN, pos, width - MARGIN * 2, BUTTON_HEIGHT ); + btn.setRect( 0, pos, width, BUTTON_HEIGHT ); add( btn ); - + pos += BUTTON_HEIGHT + MARGIN; } - - resize( width, (int)pos ); + + resize( width, (int)(pos - MARGIN) ); } protected boolean enabled( int index ){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index f6e5ec141..2081f7ba5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -230,7 +230,7 @@ public class WndSettings extends WndTabbed { super.onClick(); if (checked()) { checked(!checked()); - ShatteredPixelDungeon.scene().add(new WndOptions( + ShatteredPixelDungeon.scene().add(new WndOptions(Icons.get(Icons.DISPLAY), Messages.get(DisplayTab.class, "saver"), Messages.get(DisplayTab.class, "saver_desc"), Messages.get(DisplayTab.class, "okay"),