Skip to content

Commit

Permalink
Show a shutdown button upon death (closes #23), update to v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Jul 8, 2017
1 parent 6781e49 commit cbb13f6
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 22 deletions.
Binary file added android/assets/ui/x0.75/power_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/ui/x1.0/power_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/ui/x1.25/power_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/ui/x1.5/power_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/ui/x2.0/power_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/assets/ui/x4.0/power_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
minSdkVersion 8
targetSdkVersion 25

versionCode 600
versionName "0.6"
versionCode 610
versionName "0.6.1"
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ allprojects {
apply plugin: "eclipse"
apply plugin: "idea"

version = '0.6'
version = '0.6.1'
ext {
appName = "1010! Klooni"
gdxVersion = '1.9.5'
Expand Down
2 changes: 1 addition & 1 deletion core/src/io/github/lonamiwebs/klooni/SkinLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SkinLoader {
private static String[] ids = {
"play", "play_saved", "star", "stopwatch", "palette", "home", "replay",
"share", "sound_on", "sound_off", "snap_on", "snap_off", "issues", "credits",
"web", "back", "ok", "cancel"
"web", "back", "ok", "cancel", "power_off"
};

private static float bestMultiplier;
Expand Down
36 changes: 23 additions & 13 deletions core/src/io/github/lonamiwebs/klooni/screens/PauseMenuStage.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class PauseMenuStage extends Stage {
private final Band band;
private final BaseScorer scorer;
private final SoftButton playButton;
private final SoftButton customButton; // Customize & "Shut down"

//endregion

Expand Down Expand Up @@ -98,22 +99,14 @@ public void changed(ChangeEvent event, Actor actor) {

table.row();

// Palette button (buy colors)
final SoftButton paletteButton = new SoftButton(1, "palette_texture");
table.add(paletteButton).space(16);

paletteButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
// Don't dispose because then it needs to take us to the previous screen
game.transitionTo(new CustomizeScreen(game, game.getScreen()), false);
}
});
// Palette button OR shutdown game (if game over)
customButton = new SoftButton(1, "palette_texture");
table.add(customButton).space(16);
customButton.addListener(customChangeListener);

// Continue playing OR share (if game over) button
playButton = new SoftButton(2, "play_texture");
table.add(playButton).space(16);

playButton.addListener(playChangeListener);
}

Expand All @@ -139,6 +132,14 @@ public void run() {
scorer.resume();
}

private final ChangeListener customChangeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
// Don't dispose because then it needs to take us to the previous screen
game.transitionTo(new CustomizeScreen(game, game.getScreen()), false);
}
};

private final ChangeListener playChangeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Expand Down Expand Up @@ -166,13 +167,22 @@ void show() {
}

void showGameOver(final String gameOverReason, final boolean timeMode) {
// Allow the players to exit the game (issue #23)
customButton.removeListener(customChangeListener);
customButton.updateImage("power_off_texture");
customButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Gdx.app.exit();
}
});

if (game.shareChallenge != null) {
playButton.removeListener(playChangeListener);
playButton.updateImage("share_texture");
playButton.addListener(new ChangeListener() {
public void changed(ChangeEvent event, Actor actor) {
// Don't dispose because then it needs to take us to the previous screen

game.transitionTo(new ShareScoreScreen(
game, game.getScreen(), scorer.getCurrentScore(), timeMode), false);
}
Expand Down
32 changes: 27 additions & 5 deletions original-resources/buttons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions original-resources/gen-ui-png.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'palette',
'play',
'play_saved',
'power_off',
'replay',
'share',
'snap_off',
Expand Down

0 comments on commit cbb13f6

Please sign in to comment.