mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:07:29 +08:00
Split out control point visualisation logic and add special kiai duration handling
This commit is contained in:
parent
153ee25510
commit
0dc1577f68
@ -0,0 +1,30 @@
|
|||||||
|
// 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.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||||
|
{
|
||||||
|
public class ControlPointVisualisation : PointVisualisation
|
||||||
|
{
|
||||||
|
protected readonly ControlPoint Point;
|
||||||
|
|
||||||
|
public ControlPointVisualisation(ControlPoint point)
|
||||||
|
{
|
||||||
|
Point = point;
|
||||||
|
|
||||||
|
Height = 0.25f;
|
||||||
|
Origin = Anchor.TopCentre;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = Point.GetRepresentingColour(colours);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
// 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 System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||||
|
{
|
||||||
|
public class EffectPointVisualisation : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly EffectControlPoint effect;
|
||||||
|
private Bindable<bool> kiai;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private EditorBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
|
public EffectPointVisualisation(EffectControlPoint point)
|
||||||
|
{
|
||||||
|
RelativePositionAxes = Axes.Both;
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
effect = point;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
kiai = effect.KiaiModeBindable.GetBoundCopy();
|
||||||
|
kiai.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
ClearInternal();
|
||||||
|
|
||||||
|
AddInternal(new ControlPointVisualisation(effect));
|
||||||
|
|
||||||
|
if (!kiai.Value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var endControlPoint = beatmap.ControlPointInfo.EffectPoints.FirstOrDefault(c => c.Time > effect.Time && !c.KiaiMode);
|
||||||
|
|
||||||
|
// handle kiai duration
|
||||||
|
// eventually this will be simpler when we have control points with durations.
|
||||||
|
if (endControlPoint != null)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Origin = Anchor.TopLeft;
|
||||||
|
|
||||||
|
Width = (float)(endControlPoint.Time - effect.Time);
|
||||||
|
|
||||||
|
AddInternal(new PointVisualisation
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Width = 1,
|
||||||
|
Height = 0.25f,
|
||||||
|
Depth = float.MaxValue,
|
||||||
|
Colour = effect.GetRepresentingColour(colours).Darken(0.5f),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +1,33 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
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.Containers;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||||
{
|
{
|
||||||
public class GroupVisualisation : PointVisualisation
|
public class GroupVisualisation : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
public readonly ControlPointGroup Group;
|
public readonly ControlPointGroup Group;
|
||||||
|
|
||||||
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private OsuColour colours { get; set; }
|
|
||||||
|
|
||||||
public GroupVisualisation(ControlPointGroup group)
|
public GroupVisualisation(ControlPointGroup group)
|
||||||
: base(group.Time)
|
|
||||||
{
|
{
|
||||||
|
RelativePositionAxes = Axes.X;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Origin = Anchor.TopLeft;
|
||||||
|
|
||||||
Group = group;
|
Group = group;
|
||||||
|
X = (float)group.Time;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -33,13 +37,32 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
controlPoints.BindTo(Group.ControlPoints);
|
controlPoints.BindTo(Group.ControlPoints);
|
||||||
controlPoints.BindCollectionChanged((_, __) =>
|
controlPoints.BindCollectionChanged((_, __) =>
|
||||||
{
|
{
|
||||||
if (controlPoints.Count == 0)
|
ClearInternal();
|
||||||
{
|
|
||||||
Colour = Color4.Transparent;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Colour = Group.ControlPoints.First().GetRepresentingColour(colours);
|
if (controlPoints.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var point in Group.ControlPoints)
|
||||||
|
{
|
||||||
|
switch (point)
|
||||||
|
{
|
||||||
|
case TimingControlPoint _:
|
||||||
|
AddInternal(new ControlPointVisualisation(point) { Y = 0, });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DifficultyControlPoint _:
|
||||||
|
AddInternal(new ControlPointVisualisation(point) { Y = 0.25f, });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SampleControlPoint _:
|
||||||
|
AddInternal(new ControlPointVisualisation(point) { Y = 0.5f, });
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EffectControlPoint effect:
|
||||||
|
AddInternal(new EffectPointVisualisation(effect) { Y = 0.75f });
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Y = -10,
|
||||||
Height = 0.35f
|
Height = 0.35f
|
||||||
},
|
},
|
||||||
new BookmarkPart
|
new BookmarkPart
|
||||||
|
Loading…
Reference in New Issue
Block a user