mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Add score token to spectator state
This commit is contained in:
@ -261,7 +261,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestFinalFramesPurgedBeforeEndingPlay()
|
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", () =>
|
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;
|
spectatorClient.OnNewFrames += onNewFrames;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ namespace osu.Game.Online.Spectator
|
|||||||
return Task.CompletedTask;
|
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`.
|
// This schedule is only here to match the one below in `EndPlaying`.
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
@ -175,6 +175,7 @@ namespace osu.Game.Online.Spectator
|
|||||||
currentState.Mods = score.ScoreInfo.Mods.Select(m => new APIMod(m)).ToArray();
|
currentState.Mods = score.ScoreInfo.Mods.Select(m => new APIMod(m)).ToArray();
|
||||||
currentState.State = SpectatedUserState.Playing;
|
currentState.State = SpectatedUserState.Playing;
|
||||||
currentState.MaximumScoringValues = state.ScoreProcessor.MaximumScoringValues;
|
currentState.MaximumScoringValues = state.ScoreProcessor.MaximumScoringValues;
|
||||||
|
currentState.ScoreToken = token;
|
||||||
|
|
||||||
currentBeatmap = state.Beatmap;
|
currentBeatmap = state.Beatmap;
|
||||||
currentScore = score;
|
currentScore = score;
|
||||||
|
@ -33,14 +33,17 @@ namespace osu.Game.Online.Spectator
|
|||||||
[Key(4)]
|
[Key(4)]
|
||||||
public ScoringValues MaximumScoringValues { get; set; }
|
public ScoringValues MaximumScoringValues { get; set; }
|
||||||
|
|
||||||
|
[Key(5)]
|
||||||
|
public long? ScoreToken { get; set; }
|
||||||
|
|
||||||
public bool Equals(SpectatorState other)
|
public bool Equals(SpectatorState other)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(null, other)) return false;
|
if (ReferenceEquals(null, other)) return false;
|
||||||
if (ReferenceEquals(this, other)) return true;
|
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;
|
realmBeatmap.LastPlayed = DateTimeOffset.Now;
|
||||||
});
|
});
|
||||||
|
|
||||||
spectatorClient.BeginPlaying(GameplayState, Score);
|
spectatorClient.BeginPlaying(GameplayState, Score, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(ScreenExitEvent e)
|
public override bool OnExiting(ScreenExitEvent e)
|
||||||
|
Reference in New Issue
Block a user