mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Add score token to spectator state
This commit is contained in:
parent
e42bd7b31a
commit
4a65f5c864
@ -261,7 +261,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[Test]
|
||||
public void TestFinalFramesPurgedBeforeEndingPlay()
|
||||
{
|
||||
AddStep("begin playing", () => spectatorClient.BeginPlaying(TestGameplayState.Create(new OsuRuleset()), new Score()));
|
||||
AddStep("begin playing", () => spectatorClient.BeginPlaying(TestGameplayState.Create(new OsuRuleset()), new Score(), 0));
|
||||
|
||||
AddStep("send frames and finish play", () =>
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
}
|
||||
};
|
||||
|
||||
spectatorClient.BeginPlaying(TestGameplayState.Create(new OsuRuleset()), recordingScore);
|
||||
spectatorClient.BeginPlaying(TestGameplayState.Create(new OsuRuleset()), recordingScore, 0);
|
||||
spectatorClient.OnNewFrames += onNewFrames;
|
||||
});
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ namespace osu.Game.Online.Spectator
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void BeginPlaying(GameplayState state, Score score)
|
||||
public void BeginPlaying(GameplayState state, Score score, long? token)
|
||||
{
|
||||
// This schedule is only here to match the one below in `EndPlaying`.
|
||||
Schedule(() =>
|
||||
@ -175,6 +175,7 @@ namespace osu.Game.Online.Spectator
|
||||
currentState.Mods = score.ScoreInfo.Mods.Select(m => new APIMod(m)).ToArray();
|
||||
currentState.State = SpectatedUserState.Playing;
|
||||
currentState.MaximumScoringValues = state.ScoreProcessor.MaximumScoringValues;
|
||||
currentState.ScoreToken = token;
|
||||
|
||||
currentBeatmap = state.Beatmap;
|
||||
currentScore = score;
|
||||
|
@ -33,14 +33,17 @@ namespace osu.Game.Online.Spectator
|
||||
[Key(4)]
|
||||
public ScoringValues MaximumScoringValues { get; set; }
|
||||
|
||||
[Key(5)]
|
||||
public long? ScoreToken { get; set; }
|
||||
|
||||
public bool Equals(SpectatorState other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return BeatmapID == other.BeatmapID && Mods.SequenceEqual(other.Mods) && RulesetID == other.RulesetID && State == other.State;
|
||||
return BeatmapID == other.BeatmapID && Mods.SequenceEqual(other.Mods) && RulesetID == other.RulesetID && State == other.State && ScoreToken == other.ScoreToken;
|
||||
}
|
||||
|
||||
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID} State:{State}";
|
||||
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID} State:{State} Token:{ScoreToken}";
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Play
|
||||
realmBeatmap.LastPlayed = DateTimeOffset.Now;
|
||||
});
|
||||
|
||||
spectatorClient.BeginPlaying(GameplayState, Score);
|
||||
spectatorClient.BeginPlaying(GameplayState, Score, token);
|
||||
}
|
||||
|
||||
public override bool OnExiting(ScreenExitEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user