diff --git a/core/src/main/assets/icons.png b/core/src/main/assets/icons.png index 400c154f9..e0a5104ad 100644 Binary files a/core/src/main/assets/icons.png and b/core/src/main/assets/icons.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java index e751ba7e7..1c2bd2168 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java @@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Chrome; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; @@ -32,10 +31,8 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.ActionIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.Archs; import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; -import com.shatteredpixel.shatteredpixeldungeon.ui.IconButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Icons; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; -import com.shatteredpixel.shatteredpixeldungeon.windows.WndChallenges; import com.shatteredpixel.shatteredpixeldungeon.windows.WndGameInProgress; import com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame; import com.watabou.noosa.BitmapText; @@ -52,8 +49,6 @@ public class StartScene extends PixelScene { private static final int SLOT_WIDTH = 120; private static final int SLOT_HEIGHT = 30; - private static final int CHALLENGE_SIZE = 22; - @Override public void create() { super.create(); @@ -109,38 +104,6 @@ public class StartScene extends PixelScene { add(newGame); } - IconButton challengeButton = new IconButton( - Icons.get( SPDSettings.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF)){ - @Override - protected void onClick() { - ShatteredPixelDungeon.scene().add(new WndChallenges(SPDSettings.challenges(), true) { - public void onBackPressed() { - super.onBackPressed(); - icon( Icons.get( SPDSettings.challenges() > 0 ? - Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) ); - } - } ); - } - }; - - if (SPDSettings.landscape()){ - challengeButton.setRect(4*slotGap + (w + SLOT_WIDTH - CHALLENGE_SIZE)/2, 8 + (h - CHALLENGE_SIZE)/2f, - CHALLENGE_SIZE, CHALLENGE_SIZE); - - } else { - challengeButton.setRect((w - CHALLENGE_SIZE)/2f, yPos + 2*slotGap - CHALLENGE_SIZE/2f, - CHALLENGE_SIZE, CHALLENGE_SIZE); - - } - align(challengeButton); - - if (Badges.isUnlocked(Badges.Badge.VICTORY)){ - add(challengeButton); - } else { - Dungeon.challenges = 0; - SPDSettings.challenges(0); - } - GamesInProgress.curSlot = 0; ActionIndicator.action = null; @@ -226,6 +189,16 @@ public class StartScene extends PixelScene { level.text(Integer.toString(info.level)); level.measure(); + if (info.challenges > 0){ + name.hardlight(Window.TITLE_COLOR); + depth.hardlight(Window.TITLE_COLOR); + level.hardlight(Window.TITLE_COLOR); + } else { + name.resetColor(); + depth.resetColor(); + level.resetColor(); + } + } layout(); 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 b290a5db8..34d38447d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/TitleScene.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.GamesInProgress; import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.effects.BannerSprites; @@ -32,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ChangesButton; import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton; import com.shatteredpixel.shatteredpixeldungeon.ui.LanguageButton; import com.shatteredpixel.shatteredpixeldungeon.ui.PrefsButton; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame; import com.watabou.glwrap.Blending; import com.watabou.noosa.BitmapText; import com.watabou.noosa.Camera; @@ -114,7 +116,11 @@ public class TitleScene extends PixelScene { DashboardItem btnPlay = new DashboardItem( Messages.get(this, "play"), 0 ) { @Override protected void onClick() { - ShatteredPixelDungeon.switchNoFade( StartScene.class ); + if (GamesInProgress.checkAll().size() == 0){ + TitleScene.this.add( new WndStartGame(1) ); + } else { + ShatteredPixelDungeon.switchNoFade( StartScene.class ); + } } }; add( btnPlay ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java index 7ce254f31..090ef7682 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/WelcomeScene.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Fireball; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline; +import com.shatteredpixel.shatteredpixeldungeon.windows.WndStartGame; import com.watabou.glwrap.Blending; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; @@ -97,8 +98,13 @@ public class WelcomeScene extends PixelScene { @Override protected void onClick() { super.onClick(); - updateVersion(previousVersion); - ShatteredPixelDungeon.switchScene(TitleScene.class); + if (previousVersion == 0){ + SPDSettings.version(ShatteredPixelDungeon.versionCode); + WelcomeScene.this.add(new WndStartGame(1)); + } else { + updateVersion(previousVersion); + ShatteredPixelDungeon.switchScene(TitleScene.class); + } } }; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java index 89198d49c..51f5c37ab 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Icons.java @@ -155,10 +155,10 @@ public enum Icons { icon.frame( icon.texture.uvRect( 95, 42, 107, 51 ) ); break; case CHALLENGE_OFF: - icon.frame( icon.texture.uvRect( 78, 16, 102, 40 ) ); + icon.frame( icon.texture.uvRect( 78, 12, 92, 24 ) ); break; case CHALLENGE_ON: - icon.frame( icon.texture.uvRect( 102, 16, 126, 40 ) ); + icon.frame( icon.texture.uvRect( 92, 12, 108, 24 ) ); break; case RESUME: icon.frame( icon.texture.uvRect( 13, 53, 24, 64 ) ); 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 91cba27a9..15fceade1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGameInProgress.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndGameInProgress.java @@ -28,9 +28,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; +import com.shatteredpixel.shatteredpixeldungeon.scenes.StartScene; +import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.noosa.Game; import com.watabou.noosa.RenderedText; import com.watabou.utils.FileUtils; @@ -41,13 +44,13 @@ public class WndGameInProgress extends Window { private static final int WIDTH = 120; private static final int HEIGHT = 120; - private static final int GAP = 5; + private int GAP = 5; private float pos; public WndGameInProgress(final int slot){ - GamesInProgress.Info info = GamesInProgress.check(slot); + final GamesInProgress.Info info = GamesInProgress.check(slot); IconTitle title = new IconTitle(); title.icon( HeroSprite.avatar(info.heroClass, info.armorTier) ); @@ -56,7 +59,25 @@ public class WndGameInProgress extends Window { title.setRect( 0, 0, WIDTH, 0 ); add(title); - pos = title.bottom() + 2*GAP; + if (info.challenges > 0) GAP -= 2; + + pos = title.bottom() + GAP; + + if (info.challenges > 0) { + RedButton btnChallenges = new RedButton( "Challenges" ) { + @Override + protected void onClick() { + Game.scene().add( new WndChallenges( info.challenges, false ) ); + } + }; + float btnW = btnChallenges.reqWidth() + 2; + btnChallenges.setRect( (WIDTH - btnW)/2, pos, btnW , btnChallenges.reqHeight() + 2 ); + add( btnChallenges ); + + pos = btnChallenges.bottom() + GAP; + } + + pos += GAP; statSlot( Messages.get(this, "str"), info.str ); if (info.shld > 0) statSlot( Messages.get(this, "health"), info.hp + "+" + info.shld + "/" + info.ht ); @@ -97,7 +118,11 @@ public class WndGameInProgress extends Window { if (index == 0) { FileUtils.deleteDir(GamesInProgress.gameFolder(slot)); GamesInProgress.setUnknown(slot); - ShatteredPixelDungeon.switchNoFade((Class) ShatteredPixelDungeon.scene().getClass()); + if (GamesInProgress.checkAll().size() > 0) { + ShatteredPixelDungeon.switchNoFade(StartScene.class); + } else { + ShatteredPixelDungeon.switchNoFade(TitleScene.class); + } } } } ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java index 727f341ba..2470ae537 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndStartGame.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDSettings; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; +import com.shatteredpixel.shatteredpixeldungeon.journal.Journal; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.IntroScene; @@ -54,6 +55,7 @@ public class WndStartGame extends Window { public WndStartGame(final int slot){ Badges.loadGlobal(); + Journal.loadGlobal(); RenderedText title = PixelScene.renderText(Messages.get(this, "title"), 12 ); title.hardlight(Window.TITLE_COLOR); @@ -112,6 +114,37 @@ public class WndStartGame extends Window { start.setRect(0, HEIGHT - 20, WIDTH, 20); add(start); + if (Badges.isUnlocked(Badges.Badge.VICTORY)){ + IconButton challengeButton = new IconButton( + Icons.get( SPDSettings.challenges() > 0 ? Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF)){ + @Override + protected void onClick() { + ShatteredPixelDungeon.scene().add(new WndChallenges(SPDSettings.challenges(), true) { + public void onBackPressed() { + super.onBackPressed(); + icon( Icons.get( SPDSettings.challenges() > 0 ? + Icons.CHALLENGE_ON :Icons.CHALLENGE_OFF ) ); + } + } ); + } + + @Override + public void update() { + if( !visible && GamesInProgress.selectedClass != null){ + visible = true; + } + super.update(); + } + }; + challengeButton.setRect(WIDTH - 20, HEIGHT - 20, 20, 20); + challengeButton.visible = false; + add(challengeButton); + + } else { + Dungeon.challenges = 0; + SPDSettings.challenges(0); + } + resize(WIDTH, HEIGHT); }