mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:43:00 +08:00
Remove replay logic from DrawableRuleset
(and implement in DrawableEditorRulesetWrapper
)
This commit is contained in:
parent
f14c0eae99
commit
8a76d97b63
@ -1,9 +1,11 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit;
|
||||
@ -52,15 +54,21 @@ namespace osu.Game.Rulesets.Edit
|
||||
if (changeHandler != null)
|
||||
{
|
||||
// for now only regenerate replay on a finalised state change, not HitObjectUpdated.
|
||||
changeHandler.OnStateChange += updateReplay;
|
||||
changeHandler.OnStateChange += () => Scheduler.AddOnce(regenerateAutoplay);
|
||||
}
|
||||
else
|
||||
{
|
||||
beatmap.HitObjectUpdated += _ => updateReplay();
|
||||
beatmap.HitObjectUpdated += _ => Scheduler.AddOnce(regenerateAutoplay);
|
||||
}
|
||||
|
||||
Scheduler.AddOnce(regenerateAutoplay);
|
||||
}
|
||||
|
||||
private void updateReplay() => Scheduler.AddOnce(drawableRuleset.RegenerateAutoplay);
|
||||
private void regenerateAutoplay()
|
||||
{
|
||||
var autoplayMod = drawableRuleset.Mods.OfType<ModAutoplay>().Single();
|
||||
drawableRuleset.SetReplayScore(autoplayMod.CreateReplayScore(drawableRuleset.Beatmap, drawableRuleset.Mods));
|
||||
}
|
||||
|
||||
private void addHitObject(HitObject hitObject)
|
||||
{
|
||||
|
@ -182,18 +182,11 @@ namespace osu.Game.Rulesets.UI
|
||||
.WithChild(ResumeOverlay)));
|
||||
}
|
||||
|
||||
RegenerateAutoplay();
|
||||
applyRulesetMods(Mods, config);
|
||||
|
||||
loadObjects(cancellationToken ?? default);
|
||||
}
|
||||
|
||||
public void RegenerateAutoplay()
|
||||
{
|
||||
// for now this is applying mods which aren't just autoplay.
|
||||
// we'll need to reconsider this flow in the future.
|
||||
applyRulesetMods(Mods, config);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates and adds drawable representations of hit objects to the play field.
|
||||
/// </summary>
|
||||
@ -349,9 +342,6 @@ namespace osu.Game.Rulesets.UI
|
||||
foreach (var mod in mods.OfType<IApplicableToDrawableRuleset<TObject>>())
|
||||
mod.ApplyToDrawableRuleset(this);
|
||||
|
||||
foreach (var mod in mods.OfType<ICreateReplay>())
|
||||
SetReplayScore(mod.CreateReplayScore(Beatmap, mods));
|
||||
|
||||
foreach (var mod in mods.OfType<IReadFromConfig>())
|
||||
mod.ReadFromConfig(config);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user