Merge pull request #17565 from smoogipoo/fix-gameplay-leaderboard-allocations

Remove ScoreInfo allocations in multiplayer leaderboard
This commit is contained in:
Dean Herbert
2022-03-31 15:48:14 +09:00
committed by GitHub

View File

@ -227,15 +227,15 @@ 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;
scoreInfo = new ScoreInfo { Ruleset = ruleset };
ScoringMode.BindValueChanged(_ => UpdateScore());
}
@ -253,12 +253,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;