mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix toggling hit animations on the editor not applying immediately
This commit is contained in:
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Lists;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -46,15 +47,23 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
HitPolicy = new AnyOrderHitPolicy();
|
HitPolicy = new AnyOrderHitPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly WeakList<DrawableHitObject> drawableHitObjects = new WeakList<DrawableHitObject>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
hitAnimations = config.GetBindable<bool>(OsuSetting.EditorHitAnimations);
|
hitAnimations = config.GetBindable<bool>(OsuSetting.EditorHitAnimations);
|
||||||
|
hitAnimations.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
foreach (var d in drawableHitObjects) d.RefreshStateTransforms();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewDrawableHitObject(DrawableHitObject d)
|
protected override void OnNewDrawableHitObject(DrawableHitObject d)
|
||||||
{
|
{
|
||||||
d.ApplyCustomUpdateState += updateState;
|
d.ApplyCustomUpdateState += updateState;
|
||||||
|
|
||||||
|
drawableHitObjects.Add(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateState(DrawableHitObject hitObject, ArmedState state)
|
private void updateState(DrawableHitObject hitObject, ArmedState state)
|
||||||
|
@ -448,7 +448,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reapplies the current <see cref="ArmedState"/>.
|
/// Reapplies the current <see cref="ArmedState"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void RefreshStateTransforms() => updateState(State.Value, true);
|
public void RefreshStateTransforms() => updateState(State.Value, true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
||||||
|
Reference in New Issue
Block a user