Add visual feedback when a game was saved
This commit is contained in:
parent
6ab176cbc3
commit
f954766d99
7 changed files with 84 additions and 6 deletions
|
@ -41,8 +41,10 @@ public class Klooni extends Game {
|
|||
Gdx.files.internal("ui/button_down.png")), 28, 28, 28, 28));
|
||||
|
||||
skin.add("play_texture", new Texture(Gdx.files.internal("ui/play.png")));
|
||||
skin.add("play_saved_texture", new Texture(Gdx.files.internal("ui/play_saved.png")));
|
||||
skin.add("star_texture", new Texture(Gdx.files.internal("ui/star.png")));
|
||||
skin.add("stopwatch_texture", new Texture(Gdx.files.internal("ui/stopwatch.png")));
|
||||
skin.add("stopwatch_saved_texture", new Texture(Gdx.files.internal("ui/stopwatch_saved.png")));
|
||||
skin.add("palette_texture", new Texture(Gdx.files.internal("ui/palette.png")));
|
||||
skin.add("home_texture", new Texture(Gdx.files.internal("ui/home.png")));
|
||||
skin.add("replay_texture", new Texture(Gdx.files.internal("ui/replay.png")));
|
||||
|
|
|
@ -272,6 +272,10 @@ class GameScreen implements Screen, InputProcessor, BinSerializable {
|
|||
handle.delete();
|
||||
}
|
||||
|
||||
static boolean hasSavedData() {
|
||||
return Gdx.files.local(SAVE_DAT_FILENAME).exists();
|
||||
}
|
||||
|
||||
private boolean tryLoad() {
|
||||
// Load will fail if the game modes differ, but that's okay
|
||||
final FileHandle handle = Gdx.files.local(SAVE_DAT_FILENAME);
|
||||
|
|
|
@ -42,7 +42,8 @@ public class MainMenuScreen extends InputListener implements Screen {
|
|||
stage.addActor(table);
|
||||
|
||||
// Play button
|
||||
final SoftButton playButton = new SoftButton(0, "play_texture");
|
||||
final SoftButton playButton = new SoftButton(
|
||||
0, GameScreen.hasSavedData() ? "play_saved_texture" : "play_texture");
|
||||
playButton.addListener(new ChangeListener() {
|
||||
public void changed (ChangeEvent event, Actor actor) {
|
||||
MainMenuScreen.this.game.setScreen(
|
||||
|
@ -65,7 +66,9 @@ public class MainMenuScreen extends InputListener implements Screen {
|
|||
table.add(starButton).space(16);
|
||||
|
||||
// Time mode
|
||||
final SoftButton statsButton = new SoftButton(2, "stopwatch_texture");
|
||||
// TODO Would be nice if it actually showed the saved texture iff that's the saved game mode
|
||||
final SoftButton statsButton = new SoftButton(
|
||||
2, GameScreen.hasSavedData() ? "stopwatch_saved_texture" : "stopwatch_texture");
|
||||
statsButton.addListener(new ChangeListener() {
|
||||
@Override
|
||||
public void changed(ChangeEvent event, Actor actor) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue