1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +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)
=> instances.Single(i => i.UserId == userId).LoadScore(gameplayState.Score);
protected override void StartGameplay(int userId, SpectatorGameplayState spectatorGameplayState)
=> instances.Single(i => i.UserId == userId).LoadScore(spectatorGameplayState.Score);
protected override void EndGameplay(int userId)
{

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play
/// The player's immediate online gameplay state.
/// This doesn't always reflect the gameplay state being watched.
/// </summary>
private GameplayState immediateGameplayState;
private SpectatorGameplayState immediateSpectatorGameplayState;
private GetBeatmapSetRequest onlineBeatmapRequest;
@ -146,7 +146,7 @@ namespace osu.Game.Screens.Play
Width = 250,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Action = () => scheduleStart(immediateGameplayState),
Action = () => scheduleStart(immediateSpectatorGameplayState),
Enabled = { Value = false }
}
}
@ -167,18 +167,18 @@ namespace osu.Game.Screens.Play
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;
scheduleStart(gameplayState);
scheduleStart(spectatorGameplayState);
}
protected override void EndGameplay(int userId)
{
scheduledStart?.Cancel();
immediateGameplayState = null;
immediateSpectatorGameplayState = null;
watchButton.Enabled.Value = false;
clearDisplay();
@ -194,7 +194,7 @@ namespace osu.Game.Screens.Play
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.
scheduledStart?.Cancel();
@ -203,15 +203,15 @@ namespace osu.Game.Screens.Play
if (this.IsCurrentScreen())
start();
else
scheduleStart(gameplayState);
scheduleStart(spectatorGameplayState);
});
void start()
{
Beatmap.Value = gameplayState.Beatmap;
Ruleset.Value = gameplayState.Ruleset.RulesetInfo;
Beatmap.Value = spectatorGameplayState.Beatmap;
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
{
/// <summary>
/// The gameplay state of a spectated user. This class is immutable.
/// An immutable spectator gameplay state.
/// </summary>
public class GameplayState
public class SpectatorGameplayState
{
/// <summary>
/// The score which the user is playing.
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Spectate
/// </summary>
public readonly WorkingBeatmap Beatmap;
public GameplayState(Score score, Ruleset ruleset, WorkingBeatmap beatmap)
public SpectatorGameplayState(Score score, Ruleset ruleset, WorkingBeatmap beatmap)
{
Score = score;
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 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;
@ -173,7 +173,7 @@ namespace osu.Game.Screens.Spectate
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;
Schedule(() => StartGameplay(userId, gameplayState));
@ -190,8 +190,8 @@ namespace osu.Game.Screens.Spectate
/// Starts gameplay for a user.
/// </summary>
/// <param name="userId">The user to start gameplay for.</param>
/// <param name="gameplayState">The gameplay state.</param>
protected abstract void StartGameplay(int userId, [NotNull] GameplayState gameplayState);
/// <param name="spectatorGameplayState">The gameplay state.</param>
protected abstract void StartGameplay(int userId, [NotNull] SpectatorGameplayState spectatorGameplayState);
/// <summary>
/// Ends gameplay for a user.