Game ranking screen fixes.
- Show retry button only when appropriate (e.g. not when viewing replays or when playing with "Auto" enabled). - Watching a (fake) "replay" with "Auto" enabled will actually just call the "retry" code now. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -324,7 +324,7 @@ public class GameData {
|
|||||||
private Replay replay;
|
private Replay replay;
|
||||||
|
|
||||||
/** Whether this object is used for gameplay (true) or score viewing (false). */
|
/** Whether this object is used for gameplay (true) or score viewing (false). */
|
||||||
private boolean gameplay;
|
private boolean isGameplay;
|
||||||
|
|
||||||
/** Container dimensions. */
|
/** Container dimensions. */
|
||||||
private int width, height;
|
private int width, height;
|
||||||
@@ -337,7 +337,7 @@ public class GameData {
|
|||||||
public GameData(int width, int height) {
|
public GameData(int width, int height) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.gameplay = true;
|
this.isGameplay = true;
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
@@ -353,7 +353,7 @@ public class GameData {
|
|||||||
public GameData(ScoreData s, int width, int height) {
|
public GameData(ScoreData s, int width, int height) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.gameplay = false;
|
this.isGameplay = false;
|
||||||
|
|
||||||
this.scoreData = s;
|
this.scoreData = s;
|
||||||
this.score = s.score;
|
this.score = s.score;
|
||||||
@@ -1468,7 +1468,13 @@ public class GameData {
|
|||||||
* Returns whether or not this object is used for gameplay.
|
* Returns whether or not this object is used for gameplay.
|
||||||
* @return true if gameplay, false if score viewing
|
* @return true if gameplay, false if score viewing
|
||||||
*/
|
*/
|
||||||
public boolean isGameplay() { return gameplay; }
|
public boolean isGameplay() { return isGameplay; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether or not this object is used for gameplay.
|
||||||
|
* @return true if gameplay, false if score viewing
|
||||||
|
*/
|
||||||
|
public void setGameplay(boolean gameplay) { this.isGameplay = gameplay; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the hit into the list of hit error information.
|
* Adds the hit into the list of hit error information.
|
||||||
|
|||||||
@@ -738,6 +738,7 @@ public class Game extends BasicGameState {
|
|||||||
r.save();
|
r.save();
|
||||||
}
|
}
|
||||||
ScoreData score = data.getScoreData(beatmap);
|
ScoreData score = data.getScoreData(beatmap);
|
||||||
|
data.setGameplay(!isReplay);
|
||||||
|
|
||||||
// add score to database
|
// add score to database
|
||||||
if (!unranked && !isReplay)
|
if (!unranked && !isReplay)
|
||||||
@@ -1111,6 +1112,8 @@ public class Game extends BasicGameState {
|
|||||||
GameMod.loadModState(replay.mods);
|
GameMod.loadModState(replay.mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.setGameplay(true);
|
||||||
|
|
||||||
// check restart state
|
// check restart state
|
||||||
if (restart == Restart.NEW) {
|
if (restart == Restart.NEW) {
|
||||||
// new game
|
// new game
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package itdelatrisu.opsu.states;
|
|||||||
|
|
||||||
import itdelatrisu.opsu.GameData;
|
import itdelatrisu.opsu.GameData;
|
||||||
import itdelatrisu.opsu.GameImage;
|
import itdelatrisu.opsu.GameImage;
|
||||||
|
import itdelatrisu.opsu.GameMod;
|
||||||
import itdelatrisu.opsu.Opsu;
|
import itdelatrisu.opsu.Opsu;
|
||||||
import itdelatrisu.opsu.Options;
|
import itdelatrisu.opsu.Options;
|
||||||
import itdelatrisu.opsu.Utils;
|
import itdelatrisu.opsu.Utils;
|
||||||
@@ -113,7 +114,7 @@ public class GameRanking extends BasicGameState {
|
|||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
replayButton.draw();
|
replayButton.draw();
|
||||||
if (data.isGameplay())
|
if (data.isGameplay() && !GameMod.AUTO.isActive())
|
||||||
retryButton.draw();
|
retryButton.draw();
|
||||||
UI.getBackButton().draw();
|
UI.getBackButton().draw();
|
||||||
|
|
||||||
@@ -175,7 +176,8 @@ public class GameRanking extends BasicGameState {
|
|||||||
// replay
|
// replay
|
||||||
Game gameState = (Game) game.getState(Opsu.STATE_GAME);
|
Game gameState = (Game) game.getState(Opsu.STATE_GAME);
|
||||||
boolean returnToGame = false;
|
boolean returnToGame = false;
|
||||||
if (replayButton.contains(x, y)) {
|
boolean replayButtonPressed = replayButton.contains(x, y);
|
||||||
|
if (replayButtonPressed && !(data.isGameplay() && GameMod.AUTO.isActive())) {
|
||||||
Replay r = data.getReplay(null, null);
|
Replay r = data.getReplay(null, null);
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
try {
|
try {
|
||||||
@@ -194,7 +196,9 @@ public class GameRanking extends BasicGameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// retry
|
// retry
|
||||||
else if (data.isGameplay() && retryButton.contains(x, y)) {
|
else if (data.isGameplay() &&
|
||||||
|
(!GameMod.AUTO.isActive() && retryButton.contains(x, y)) ||
|
||||||
|
(GameMod.AUTO.isActive() && replayButtonPressed)) {
|
||||||
gameState.setReplay(null);
|
gameState.setReplay(null);
|
||||||
gameState.setRestart(Game.Restart.MANUAL);
|
gameState.setRestart(Game.Restart.MANUAL);
|
||||||
returnToGame = true;
|
returnToGame = true;
|
||||||
@@ -221,7 +225,7 @@ public class GameRanking extends BasicGameState {
|
|||||||
} else {
|
} else {
|
||||||
SoundController.playSound(SoundEffect.APPLAUSE);
|
SoundController.playSound(SoundEffect.APPLAUSE);
|
||||||
retryButton.resetHover();
|
retryButton.resetHover();
|
||||||
replayButton.setY(replayY);
|
replayButton.setY(!GameMod.AUTO.isActive() ? replayY : retryY);
|
||||||
}
|
}
|
||||||
replayButton.resetHover();
|
replayButton.resetHover();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user