mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Make GameplayState.Score
immutable
This commit is contained in:
@ -161,14 +161,6 @@ namespace osu.Game.Screens.Play
|
||||
if (!LoadedBeatmapSuccessfully)
|
||||
return;
|
||||
|
||||
Score = CreateScore();
|
||||
GameplayState.Score = Score;
|
||||
|
||||
// ensure the score is in a consistent state with the current player.
|
||||
Score.ScoreInfo.BeatmapInfo = Beatmap.Value.BeatmapInfo;
|
||||
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
|
||||
Score.ScoreInfo.Mods = Mods.Value.ToArray();
|
||||
|
||||
PrepareReplay();
|
||||
|
||||
ScoreProcessor.NewJudgement += result => ScoreProcessor.PopulateScore(Score.ScoreInfo);
|
||||
@ -226,7 +218,14 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);
|
||||
|
||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, Mods.Value));
|
||||
Score = CreateScore(playableBeatmap);
|
||||
|
||||
// ensure the score is in a consistent state with the current player.
|
||||
Score.ScoreInfo.BeatmapInfo = Beatmap.Value.BeatmapInfo;
|
||||
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
|
||||
Score.ScoreInfo.Mods = Mods.Value.ToArray();
|
||||
|
||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, Mods.Value, Score));
|
||||
|
||||
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
|
||||
|
||||
@ -989,8 +988,9 @@ namespace osu.Game.Screens.Play
|
||||
/// <summary>
|
||||
/// Creates the player's <see cref="Scoring.Score"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmap"></param>
|
||||
/// <returns>The <see cref="Scoring.Score"/>.</returns>
|
||||
protected virtual Score CreateScore() => new Score
|
||||
protected virtual Score CreateScore(IBeatmap beatmap) => new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo { User = api.LocalUser.Value },
|
||||
};
|
||||
|
Reference in New Issue
Block a user