1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:43:01 +08:00

Fix toggling hit animations on the editor not applying immediately

This commit is contained in:
Dean Herbert 2022-05-12 17:36:35 +09:00
parent 5f2d9bf04c
commit 10e41d018a
2 changed files with 10 additions and 1 deletions

View File

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Lists;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
@ -46,15 +47,23 @@ namespace osu.Game.Rulesets.Osu.Edit
HitPolicy = new AnyOrderHitPolicy();
}
private readonly WeakList<DrawableHitObject> drawableHitObjects = new WeakList<DrawableHitObject>();
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
hitAnimations = config.GetBindable<bool>(OsuSetting.EditorHitAnimations);
hitAnimations.BindValueChanged(_ =>
{
foreach (var d in drawableHitObjects) d.RefreshStateTransforms();
});
}
protected override void OnNewDrawableHitObject(DrawableHitObject d)
{
d.ApplyCustomUpdateState += updateState;
drawableHitObjects.Add(d);
}
private void updateState(DrawableHitObject hitObject, ArmedState state)

View File

@ -448,7 +448,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <summary>
/// Reapplies the current <see cref="ArmedState"/>.
/// </summary>
protected void RefreshStateTransforms() => updateState(State.Value, true);
public void RefreshStateTransforms() => updateState(State.Value, true);
/// <summary>
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.