mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Re-use a single beatmap processor
This commit is contained in:
parent
b40143cb73
commit
0fbdcabb6f
@ -177,6 +177,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
private Beatmap<TObject> playableBeatmap;
|
||||
private EditorBeatmap<TObject> editorBeatmap;
|
||||
private IBeatmapProcessor beatmapProcessor;
|
||||
|
||||
protected HitObjectComposer(Ruleset ruleset)
|
||||
: base(ruleset)
|
||||
@ -188,6 +189,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
var workingBeatmap = parent.Get<IBindable<WorkingBeatmap>>();
|
||||
playableBeatmap = (Beatmap<TObject>)workingBeatmap.Value.GetPlayableBeatmap(Ruleset.RulesetInfo, Array.Empty<Mod>());
|
||||
|
||||
beatmapProcessor = Ruleset.CreateBeatmapProcessor(playableBeatmap);
|
||||
|
||||
editorBeatmap = new EditorBeatmap<TObject>(playableBeatmap);
|
||||
editorBeatmap.HitObjectAdded += addHitObject;
|
||||
editorBeatmap.HitObjectRemoved += removeHitObject;
|
||||
@ -201,19 +204,15 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
private void addHitObject(HitObject hitObject)
|
||||
{
|
||||
var processor = Ruleset.CreateBeatmapProcessor(playableBeatmap);
|
||||
|
||||
processor?.PreProcess();
|
||||
beatmapProcessor?.PreProcess();
|
||||
hitObject.ApplyDefaults(playableBeatmap.ControlPointInfo, playableBeatmap.BeatmapInfo.BaseDifficulty);
|
||||
processor?.PostProcess();
|
||||
beatmapProcessor?.PostProcess();
|
||||
}
|
||||
|
||||
private void removeHitObject(HitObject hitObject)
|
||||
{
|
||||
var processor = Ruleset.CreateBeatmapProcessor(playableBeatmap);
|
||||
|
||||
processor?.PreProcess();
|
||||
processor?.PostProcess();
|
||||
beatmapProcessor?.PreProcess();
|
||||
beatmapProcessor?.PostProcess();
|
||||
}
|
||||
|
||||
internal override DrawableEditRuleset CreateDrawableRuleset()
|
||||
|
Loading…
Reference in New Issue
Block a user