mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Reload scrolling composer on control point changes
This commit is contained in:
parent
694cfd0e25
commit
922837dd3a
@ -4,6 +4,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -12,6 +13,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -21,6 +23,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectComposer<TObject>
|
public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectComposer<TObject>
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private Editor? editor { get; set; }
|
||||||
|
|
||||||
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
|
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
|
||||||
private Bindable<bool> configShowSpeedChanges = null!;
|
private Bindable<bool> configShowSpeedChanges = null!;
|
||||||
|
|
||||||
@ -72,6 +77,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
if (beatSnapGrid != null)
|
if (beatSnapGrid != null)
|
||||||
AddInternal(beatSnapGrid);
|
AddInternal(beatSnapGrid);
|
||||||
|
|
||||||
|
EditorBeatmap.ControlPointInfo.ControlPointsChanged += expireComposeScreenOnControlPointChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -104,5 +111,15 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
beatSnapGrid.SelectionTimeRange = null;
|
beatSnapGrid.SelectionTimeRange = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (EditorBeatmap.IsNotNull())
|
||||||
|
EditorBeatmap.ControlPointInfo.ControlPointsChanged -= expireComposeScreenOnControlPointChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void expireComposeScreenOnControlPointChange() => editor?.ReloadComposeScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -996,6 +996,15 @@ namespace osu.Game.Screens.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Forces a reload of the compose screen after significant configuration changes.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This can be necessary for scrolling rulesets, as they do not easily support control points changing under them.
|
||||||
|
/// The reason that this works is that <see cref="onModeChanged"/> will re-instantiate the screen whenever it is requested next.
|
||||||
|
/// </remarks>
|
||||||
|
public void ReloadComposeScreen() => screenContainer.SingleOrDefault(s => s.Type == EditorScreenMode.Compose)?.RemoveAndDisposeImmediately();
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private ScheduledDelegate playbackDisabledDebounce;
|
private ScheduledDelegate playbackDisabledDebounce;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user