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:
parent
ae149a61f6
commit
130f9bf445
|
@ -324,7 +324,7 @@ public class GameData {
|
|||
private Replay replay;
|
||||
|
||||
/** Whether this object is used for gameplay (true) or score viewing (false). */
|
||||
private boolean gameplay;
|
||||
private boolean isGameplay;
|
||||
|
||||
/** Container dimensions. */
|
||||
private int width, height;
|
||||
|
@ -337,7 +337,7 @@ public class GameData {
|
|||
public GameData(int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.gameplay = true;
|
||||
this.isGameplay = true;
|
||||
|
||||
clear();
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ public class GameData {
|
|||
public GameData(ScoreData s, int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.gameplay = false;
|
||||
this.isGameplay = false;
|
||||
|
||||
this.scoreData = s;
|
||||
this.score = s.score;
|
||||
|
@ -1468,7 +1468,13 @@ public class GameData {
|
|||
* Returns whether or not this object is used for gameplay.
|
||||
* @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.
|
||||
|
|
|
@ -738,6 +738,7 @@ public class Game extends BasicGameState {
|
|||
r.save();
|
||||
}
|
||||
ScoreData score = data.getScoreData(beatmap);
|
||||
data.setGameplay(!isReplay);
|
||||
|
||||
// add score to database
|
||||
if (!unranked && !isReplay)
|
||||
|
@ -1111,6 +1112,8 @@ public class Game extends BasicGameState {
|
|||
GameMod.loadModState(replay.mods);
|
||||
}
|
||||
|
||||
data.setGameplay(true);
|
||||
|
||||
// check restart state
|
||||
if (restart == Restart.NEW) {
|
||||
// new game
|
||||
|
|
|
@ -20,6 +20,7 @@ package itdelatrisu.opsu.states;
|
|||
|
||||
import itdelatrisu.opsu.GameData;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
|
@ -113,7 +114,7 @@ public class GameRanking extends BasicGameState {
|
|||
|
||||
// buttons
|
||||
replayButton.draw();
|
||||
if (data.isGameplay())
|
||||
if (data.isGameplay() && !GameMod.AUTO.isActive())
|
||||
retryButton.draw();
|
||||
UI.getBackButton().draw();
|
||||
|
||||
|
@ -175,7 +176,8 @@ public class GameRanking extends BasicGameState {
|
|||
// replay
|
||||
Game gameState = (Game) game.getState(Opsu.STATE_GAME);
|
||||
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);
|
||||
if (r != null) {
|
||||
try {
|
||||
|
@ -194,7 +196,9 @@ public class GameRanking extends BasicGameState {
|
|||
}
|
||||
|
||||
// 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.setRestart(Game.Restart.MANUAL);
|
||||
returnToGame = true;
|
||||
|
@ -221,7 +225,7 @@ public class GameRanking extends BasicGameState {
|
|||
} else {
|
||||
SoundController.playSound(SoundEffect.APPLAUSE);
|
||||
retryButton.resetHover();
|
||||
replayButton.setY(replayY);
|
||||
replayButton.setY(!GameMod.AUTO.isActive() ? replayY : retryY);
|
||||
}
|
||||
replayButton.resetHover();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user