From 6e94a9780bbe26d5a182fed29d7908f34c21baba Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Thu, 31 Mar 2022 12:22:56 +0900 Subject: [PATCH 1/2] Remove ScoreInfo allocations in multi leaderboard --- .../Play/HUD/MultiplayerGameplayLeaderboard.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 71998622ef..4832ee04af 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -228,6 +228,7 @@ namespace osu.Game.Screens.Play.HUD public int? Team => (User.MatchState as TeamVersusUserState)?.TeamID; private readonly RulesetInfo ruleset; + private readonly ScoreInfo scoreInfo; public TrackedUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) { @@ -236,6 +237,8 @@ namespace osu.Game.Screens.Play.HUD User = user; ScoreProcessor = scoreProcessor; + scoreInfo = new ScoreInfo { Ruleset = ruleset }; + ScoringMode.BindValueChanged(_ => UpdateScore()); } @@ -253,12 +256,10 @@ namespace osu.Game.Screens.Play.HUD { var header = frame.Header; - Score.Value = ScoreProcessor.ComputePartialScore(ScoringMode.Value, new ScoreInfo - { - Ruleset = ruleset, - MaxCombo = header.MaxCombo, - Statistics = header.Statistics - }); + scoreInfo.MaxCombo = header.MaxCombo; + scoreInfo.Statistics = header.Statistics; + + Score.Value = ScoreProcessor.ComputePartialScore(ScoringMode.Value, scoreInfo); Accuracy.Value = header.Accuracy; CurrentCombo.Value = header.Combo; From 9c19ae1df8061373e8a2f9481d17885def75d691 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 31 Mar 2022 06:40:38 +0300 Subject: [PATCH 2/2] Remove no longer necessary ruleset field --- osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 4832ee04af..4f5edab526 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -227,13 +227,10 @@ namespace osu.Game.Screens.Play.HUD public int? Team => (User.MatchState as TeamVersusUserState)?.TeamID; - private readonly RulesetInfo ruleset; private readonly ScoreInfo scoreInfo; public TrackedUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) { - this.ruleset = ruleset; - User = user; ScoreProcessor = scoreProcessor;