mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 02:43:16 +08:00
Merge pull request #19457 from peppy/fix-summary-kiai-ranges
Fix editor summary timeline not responding to kiai changes correctly
This commit is contained in:
commit
f79d749fea
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -18,13 +16,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
public class EffectPointVisualisation : CompositeDrawable, IControlPointVisualisation
|
public class EffectPointVisualisation : CompositeDrawable, IControlPointVisualisation
|
||||||
{
|
{
|
||||||
private readonly EffectControlPoint effect;
|
private readonly EffectControlPoint effect;
|
||||||
private Bindable<bool> kiai;
|
private Bindable<bool> kiai = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorBeatmap beatmap { get; set; }
|
private EditorBeatmap beatmap { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
public EffectPointVisualisation(EffectControlPoint point)
|
public EffectPointVisualisation(EffectControlPoint point)
|
||||||
{
|
{
|
||||||
@ -38,7 +36,34 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
kiai = effect.KiaiModeBindable.GetBoundCopy();
|
kiai = effect.KiaiModeBindable.GetBoundCopy();
|
||||||
kiai.BindValueChanged(_ =>
|
kiai.BindValueChanged(_ => refreshDisplay(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private EffectControlPoint? nextControlPoint;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// Due to the limitations of ControlPointInfo, it's impossible to know via event flow when the next kiai point has changed.
|
||||||
|
// This is due to the fact that an EffectPoint can be added to an existing group. We would need to bind to ItemAdded on *every*
|
||||||
|
// future group to track this.
|
||||||
|
//
|
||||||
|
// I foresee this being a potential performance issue on beatmaps with many control points, so let's limit how often we check
|
||||||
|
// for changes. ControlPointInfo needs a refactor to make this flow better, but it should do for now.
|
||||||
|
Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
var next = beatmap.ControlPointInfo.EffectPoints.FirstOrDefault(c => c.Time > effect.Time);
|
||||||
|
|
||||||
|
if (!ReferenceEquals(nextControlPoint, next))
|
||||||
|
{
|
||||||
|
nextControlPoint = next;
|
||||||
|
refreshDisplay();
|
||||||
|
}
|
||||||
|
}, 100, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshDisplay()
|
||||||
{
|
{
|
||||||
ClearInternal();
|
ClearInternal();
|
||||||
|
|
||||||
@ -47,16 +72,14 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
if (!kiai.Value)
|
if (!kiai.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var endControlPoint = beatmap.ControlPointInfo.EffectPoints.FirstOrDefault(c => c.Time > effect.Time && !c.KiaiMode);
|
|
||||||
|
|
||||||
// handle kiai duration
|
// handle kiai duration
|
||||||
// eventually this will be simpler when we have control points with durations.
|
// eventually this will be simpler when we have control points with durations.
|
||||||
if (endControlPoint != null)
|
if (nextControlPoint != null)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Origin = Anchor.TopLeft;
|
Origin = Anchor.TopLeft;
|
||||||
|
|
||||||
Width = (float)(endControlPoint.Time - effect.Time);
|
Width = (float)(nextControlPoint.Time - effect.Time);
|
||||||
|
|
||||||
AddInternal(new PointVisualisation
|
AddInternal(new PointVisualisation
|
||||||
{
|
{
|
||||||
@ -68,7 +91,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
Colour = effect.GetRepresentingColour(colours).Darken(0.5f),
|
Colour = effect.GetRepresentingColour(colours).Darken(0.5f),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// kiai sections display duration, so are required to be visualised.
|
// kiai sections display duration, so are required to be visualised.
|
||||||
|
Loading…
Reference in New Issue
Block a user