1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Remove ScoreInfo allocations in multi leaderboard

This commit is contained in:
Dan Balasescu 2022-03-31 12:22:56 +09:00
parent 0020102810
commit 6e94a9780b

View File

@ -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;