1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Rename GameplayState to SpectatorGameplayState

This commit is contained in:
Dean Herbert 2021-10-02 02:08:56 +09:00
parent b8b61a196f
commit 05ca3aec4f
4 changed files with 20 additions and 20 deletions

View File

@ -213,8 +213,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
{ {
} }
protected override void StartGameplay(int userId, GameplayState gameplayState) protected override void StartGameplay(int userId, SpectatorGameplayState spectatorGameplayState)
=> instances.Single(i => i.UserId == userId).LoadScore(gameplayState.Score); => instances.Single(i => i.UserId == userId).LoadScore(spectatorGameplayState.Score);
protected override void EndGameplay(int userId) protected override void EndGameplay(int userId)
{ {

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play
/// The player's immediate online gameplay state. /// The player's immediate online gameplay state.
/// This doesn't always reflect the gameplay state being watched. /// This doesn't always reflect the gameplay state being watched.
/// </summary> /// </summary>
private GameplayState immediateGameplayState; private SpectatorGameplayState immediateSpectatorGameplayState;
private GetBeatmapSetRequest onlineBeatmapRequest; private GetBeatmapSetRequest onlineBeatmapRequest;
@ -146,7 +146,7 @@ namespace osu.Game.Screens.Play
Width = 250, Width = 250,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Action = () => scheduleStart(immediateGameplayState), Action = () => scheduleStart(immediateSpectatorGameplayState),
Enabled = { Value = false } Enabled = { Value = false }
} }
} }
@ -167,18 +167,18 @@ namespace osu.Game.Screens.Play
showBeatmapPanel(spectatorState); showBeatmapPanel(spectatorState);
} }
protected override void StartGameplay(int userId, GameplayState gameplayState) protected override void StartGameplay(int userId, SpectatorGameplayState spectatorGameplayState)
{ {
immediateGameplayState = gameplayState; immediateSpectatorGameplayState = spectatorGameplayState;
watchButton.Enabled.Value = true; watchButton.Enabled.Value = true;
scheduleStart(gameplayState); scheduleStart(spectatorGameplayState);
} }
protected override void EndGameplay(int userId) protected override void EndGameplay(int userId)
{ {
scheduledStart?.Cancel(); scheduledStart?.Cancel();
immediateGameplayState = null; immediateSpectatorGameplayState = null;
watchButton.Enabled.Value = false; watchButton.Enabled.Value = false;
clearDisplay(); clearDisplay();
@ -194,7 +194,7 @@ namespace osu.Game.Screens.Play
private ScheduledDelegate scheduledStart; private ScheduledDelegate scheduledStart;
private void scheduleStart(GameplayState gameplayState) private void scheduleStart(SpectatorGameplayState spectatorGameplayState)
{ {
// This function may be called multiple times in quick succession once the screen becomes current again. // This function may be called multiple times in quick succession once the screen becomes current again.
scheduledStart?.Cancel(); scheduledStart?.Cancel();
@ -203,15 +203,15 @@ namespace osu.Game.Screens.Play
if (this.IsCurrentScreen()) if (this.IsCurrentScreen())
start(); start();
else else
scheduleStart(gameplayState); scheduleStart(spectatorGameplayState);
}); });
void start() void start()
{ {
Beatmap.Value = gameplayState.Beatmap; Beatmap.Value = spectatorGameplayState.Beatmap;
Ruleset.Value = gameplayState.Ruleset.RulesetInfo; Ruleset.Value = spectatorGameplayState.Ruleset.RulesetInfo;
this.Push(new SpectatorPlayerLoader(gameplayState.Score, () => new SoloSpectatorPlayer(gameplayState.Score))); this.Push(new SpectatorPlayerLoader(spectatorGameplayState.Score, () => new SoloSpectatorPlayer(spectatorGameplayState.Score)));
} }
} }

View File

@ -8,9 +8,9 @@ using osu.Game.Scoring;
namespace osu.Game.Screens.Spectate namespace osu.Game.Screens.Spectate
{ {
/// <summary> /// <summary>
/// The gameplay state of a spectated user. This class is immutable. /// An immutable spectator gameplay state.
/// </summary> /// </summary>
public class GameplayState public class SpectatorGameplayState
{ {
/// <summary> /// <summary>
/// The score which the user is playing. /// The score which the user is playing.
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Spectate
/// </summary> /// </summary>
public readonly WorkingBeatmap Beatmap; public readonly WorkingBeatmap Beatmap;
public GameplayState(Score score, Ruleset ruleset, WorkingBeatmap beatmap) public SpectatorGameplayState(Score score, Ruleset ruleset, WorkingBeatmap beatmap)
{ {
Score = score; Score = score;
Ruleset = ruleset; Ruleset = ruleset;

View File

@ -43,7 +43,7 @@ namespace osu.Game.Screens.Spectate
private readonly IBindableDictionary<int, SpectatorState> playingUserStates = new BindableDictionary<int, SpectatorState>(); private readonly IBindableDictionary<int, SpectatorState> playingUserStates = new BindableDictionary<int, SpectatorState>();
private readonly Dictionary<int, User> userMap = new Dictionary<int, User>(); private readonly Dictionary<int, User> userMap = new Dictionary<int, User>();
private readonly Dictionary<int, GameplayState> gameplayStates = new Dictionary<int, GameplayState>(); private readonly Dictionary<int, SpectatorGameplayState> gameplayStates = new Dictionary<int, SpectatorGameplayState>();
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated; private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
@ -173,7 +173,7 @@ namespace osu.Game.Screens.Spectate
Replay = new Replay { HasReceivedAllFrames = false }, Replay = new Replay { HasReceivedAllFrames = false },
}; };
var gameplayState = new GameplayState(score, resolvedRuleset, beatmaps.GetWorkingBeatmap(resolvedBeatmap)); var gameplayState = new SpectatorGameplayState(score, resolvedRuleset, beatmaps.GetWorkingBeatmap(resolvedBeatmap));
gameplayStates[userId] = gameplayState; gameplayStates[userId] = gameplayState;
Schedule(() => StartGameplay(userId, gameplayState)); Schedule(() => StartGameplay(userId, gameplayState));
@ -190,8 +190,8 @@ namespace osu.Game.Screens.Spectate
/// Starts gameplay for a user. /// Starts gameplay for a user.
/// </summary> /// </summary>
/// <param name="userId">The user to start gameplay for.</param> /// <param name="userId">The user to start gameplay for.</param>
/// <param name="gameplayState">The gameplay state.</param> /// <param name="spectatorGameplayState">The gameplay state.</param>
protected abstract void StartGameplay(int userId, [NotNull] GameplayState gameplayState); protected abstract void StartGameplay(int userId, [NotNull] SpectatorGameplayState spectatorGameplayState);
/// <summary> /// <summary>
/// Ends gameplay for a user. /// Ends gameplay for a user.