mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 17:12:56 +08:00
Simplify scroll speed point display code now that it only serves one purpose
This commit is contained in:
parent
225418dbb3
commit
6b8b49e4f1
@ -1,41 +0,0 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|
||||||
{
|
|
||||||
public partial class EffectPointVisualisation : CompositeDrawable, IControlPointVisualisation
|
|
||||||
{
|
|
||||||
private readonly EffectControlPoint effect;
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private EditorBeatmap beatmap { get; set; } = null!;
|
|
||||||
|
|
||||||
public EffectPointVisualisation(EffectControlPoint point)
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.Both;
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
|
||||||
|
|
||||||
effect = point;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
if (beatmap.BeatmapInfo.Ruleset.CreateInstance().EditorShowScrollSpeed)
|
|
||||||
{
|
|
||||||
AddInternal(new ControlPointVisualisation(effect)
|
|
||||||
{
|
|
||||||
// importantly, override the x position being set since we do that in the GroupVisualisation parent drawable.
|
|
||||||
X = 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsVisuallyRedundant(ControlPoint other) => other is EffectControlPoint;
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -15,6 +16,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
|
|
||||||
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
||||||
|
|
||||||
|
private bool showScrollSpeed;
|
||||||
|
|
||||||
public GroupVisualisation(ControlPointGroup group)
|
public GroupVisualisation(ControlPointGroup group)
|
||||||
{
|
{
|
||||||
RelativePositionAxes = Axes.X;
|
RelativePositionAxes = Axes.X;
|
||||||
@ -24,8 +27,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
|
|
||||||
Group = group;
|
Group = group;
|
||||||
X = (float)group.Time;
|
X = (float)group.Time;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(EditorBeatmap beatmap)
|
||||||
|
{
|
||||||
|
showScrollSpeed = beatmap.BeatmapInfo.Ruleset.CreateInstance().EditorShowScrollSpeed;
|
||||||
|
|
||||||
// Run in constructor so IsRedundant calls can work correctly.
|
|
||||||
controlPoints.BindTo(Group.ControlPoints);
|
controlPoints.BindTo(Group.ControlPoints);
|
||||||
controlPoints.BindCollectionChanged((_, _) =>
|
controlPoints.BindCollectionChanged((_, _) =>
|
||||||
{
|
{
|
||||||
@ -47,8 +55,15 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EffectControlPoint effect:
|
case EffectControlPoint:
|
||||||
AddInternal(new EffectPointVisualisation(effect));
|
if (!showScrollSpeed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AddInternal(new ControlPointVisualisation(point)
|
||||||
|
{
|
||||||
|
// importantly, override the x position being set since we do that above.
|
||||||
|
X = 0,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user