mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Merge pull request #12423 from peppy/summary-timeline-kiai-display
Show kiai time on summary timeline (and split out other control point types)
This commit is contained in:
commit
503302f63c
@ -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.
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
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
|
||||
{
|
||||
public class GroupVisualisation : PointVisualisation
|
||||
public class GroupVisualisation : CompositeDrawable
|
||||
{
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public readonly ControlPointGroup Group;
|
||||
|
||||
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public GroupVisualisation(ControlPointGroup group)
|
||||
: base(group.Time)
|
||||
{
|
||||
RelativePositionAxes = Axes.X;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Origin = Anchor.TopLeft;
|
||||
|
||||
Group = group;
|
||||
X = (float)group.Time;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -33,13 +37,32 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
controlPoints.BindTo(Group.ControlPoints);
|
||||
controlPoints.BindCollectionChanged((_, __) =>
|
||||
{
|
||||
if (controlPoints.Count == 0)
|
||||
{
|
||||
Colour = Color4.Transparent;
|
||||
return;
|
||||
}
|
||||
ClearInternal();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Y = -10,
|
||||
Height = 0.35f
|
||||
},
|
||||
new BookmarkPart
|
||||
|
@ -21,9 +21,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations
|
||||
|
||||
public PointVisualisation()
|
||||
{
|
||||
Origin = Anchor.TopCentre;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
|
Loading…
Reference in New Issue
Block a user