mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 21:42:58 +08:00
Avoid reconstructing ruleset for each frame bundle
This commit is contained in:
parent
5fcd39a43d
commit
730cc645fb
@ -38,6 +38,8 @@ namespace osu.Game.Screens.Play
|
||||
[Resolved]
|
||||
private Bindable<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
private Ruleset rulesetInstance;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
@ -141,12 +143,10 @@ namespace osu.Game.Screens.Play
|
||||
if (replay == null)
|
||||
return;
|
||||
|
||||
var rulesetInstance = ruleset.Value.CreateInstance();
|
||||
|
||||
foreach (var frame in data.Frames)
|
||||
{
|
||||
IConvertibleReplayFrame convertibleFrame = rulesetInstance.CreateConvertibleReplayFrame();
|
||||
convertibleFrame.FromLegacy(frame, beatmap.Value.Beatmap, null);
|
||||
convertibleFrame.FromLegacy(frame, beatmap.Value.Beatmap);
|
||||
|
||||
var convertedFrame = (ReplayFrame)convertibleFrame;
|
||||
convertedFrame.Time = frame.Time;
|
||||
@ -206,6 +206,8 @@ namespace osu.Game.Screens.Play
|
||||
};
|
||||
|
||||
ruleset.Value = resolvedRuleset.RulesetInfo;
|
||||
rulesetInstance = resolvedRuleset;
|
||||
|
||||
beatmap.Value = beatmaps.GetWorkingBeatmap(resolvedBeatmap);
|
||||
|
||||
this.Push(new SpectatorPlayerLoader(new Score
|
||||
|
Loading…
Reference in New Issue
Block a user