From 275e7aa451f5f9a0d8de2889a307903fa653124e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Jul 2024 16:26:38 +0900 Subject: [PATCH 1/4] Adjust timeline centre marker visuals and bring in front of ticks --- .../Screens/Edit/Compose/Components/Timeline/CentreMarker.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs index e3542cbf9bb9..3d76656a1450 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/CentreMarker.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; From 24547226019dc7a080f317b436a98c5765f82bb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Jul 2024 14:18:41 +0900 Subject: [PATCH 2/4] Add tooltips to summary timeline display --- .../Timelines/Summary/Parts/BreakPart.cs | 10 +++++++- .../Parts/ControlPointVisualisation.cs | 24 ++++++++++++++++++- .../Summary/Parts/EffectPointVisualisation.cs | 19 ++++++++++++++- .../Summary/Parts/PreviewTimePart.cs | 7 +++++- .../Visualisations/PointVisualisation.cs | 10 +++----- .../Timeline/TimelineTickDisplay.cs | 2 +- 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs index ef1a82596974..c20738bbd910 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs @@ -4,9 +4,12 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Beatmaps.Timing; +using osu.Game.Extensions; using osu.Game.Graphics; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts @@ -46,12 +49,15 @@ protected override void LoadComplete() }, true); } - private partial class BreakVisualisation : PoolableDrawable + private partial class BreakVisualisation : PoolableDrawable, IHasTooltip { + private BreakPeriod breakPeriod; + public BreakPeriod BreakPeriod { set { + breakPeriod = value; X = (float)value.StartTime; Width = (float)value.Duration; } @@ -66,6 +72,8 @@ private void load(OsuColour colours) InternalChild = new Circle { RelativeSizeAxes = Axes.Both }; Colour = colours.Gray6; } + + public LocalisableString TooltipText => $"{breakPeriod.StartTime.ToEditorFormattedString()} - {breakPeriod.EndTime.ToEditorFormattedString()} break time"; } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs index 1df128461e9c..977aadd6c34f 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointVisualisation.cs @@ -2,18 +2,23 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Localisation; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { - public partial class ControlPointVisualisation : PointVisualisation, IControlPointVisualisation + public partial class ControlPointVisualisation : PointVisualisation, IControlPointVisualisation, IHasTooltip { protected readonly ControlPoint Point; public ControlPointVisualisation(ControlPoint point) + : base(point.Time) { Point = point; Alpha = 0.3f; @@ -27,5 +32,22 @@ private void load(OsuColour colours) } public bool IsVisuallyRedundant(ControlPoint other) => other.GetType() == Point.GetType(); + + public LocalisableString TooltipText + { + get + { + switch (Point) + { + case EffectControlPoint effect: + return $"{StartTime.ToEditorFormattedString()} effect [{effect.ScrollSpeed:N2}x scroll{(effect.KiaiMode ? " kiai" : "")}]"; + + case TimingControlPoint timing: + return $"{StartTime.ToEditorFormattedString()} timing [{timing.BPM:N2} bpm {timing.TimeSignature.GetDescription()}]"; + } + + return string.Empty; + } + } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs index 41f4b3a36511..f1e2b52ad8be 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/EffectPointVisualisation.cs @@ -5,8 +5,11 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Extensions; using osu.Game.Graphics; namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts @@ -90,7 +93,7 @@ private void refreshDisplay() Width = (float)(nextControlPoint.Time - effect.Time); - AddInternal(new Circle + AddInternal(new KiaiVisualisation(effect.Time, nextControlPoint.Time) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.BottomLeft, @@ -102,6 +105,20 @@ private void refreshDisplay() } } + private partial class KiaiVisualisation : Circle, IHasTooltip + { + private readonly double startTime; + private readonly double endTime; + + public KiaiVisualisation(double startTime, double endTime) + { + this.startTime = startTime; + this.endTime = endTime; + } + + public LocalisableString TooltipText => $"{startTime.ToEditorFormattedString()} - {endTime.ToEditorFormattedString()} kiai time"; + } + // kiai sections display duration, so are required to be visualised. public bool IsVisuallyRedundant(ControlPoint other) => other is EffectControlPoint otherEffect && effect.KiaiMode == otherEffect.KiaiMode; } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/PreviewTimePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/PreviewTimePart.cs index 3a63d1e9b358..67bb1ef5005f 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/PreviewTimePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/PreviewTimePart.cs @@ -3,6 +3,9 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Localisation; +using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; @@ -27,7 +30,7 @@ protected override void LoadBeatmap(EditorBeatmap beatmap) }, true); } - private partial class PreviewTimeVisualisation : PointVisualisation + private partial class PreviewTimeVisualisation : PointVisualisation, IHasTooltip { public PreviewTimeVisualisation(double time) : base(time) @@ -37,6 +40,8 @@ public PreviewTimeVisualisation(double time) [BackgroundDependencyLoader] private void load(OsuColour colours) => Colour = colours.Green1; + + public LocalisableString TooltipText => $"{StartTime.ToEditorFormattedString()} preview time"; } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs index 571494860fb5..9c16f457f751 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs @@ -16,13 +16,6 @@ public partial class PointVisualisation : Circle public const float MAX_WIDTH = 4; public PointVisualisation(double startTime) - : this() - { - X = (float)startTime; - StartTime = startTime; - } - - public PointVisualisation() { RelativePositionAxes = Axes.Both; RelativeSizeAxes = Axes.Y; @@ -32,6 +25,9 @@ public PointVisualisation() Width = MAX_WIDTH; Height = 0.4f; + + X = (float)startTime; + StartTime = startTime; } } } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs index 1f357283bdf6..def528d9e58d 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs @@ -191,7 +191,7 @@ Drawable getNextUsableLine() { PointVisualisation point; if (drawableIndex >= Count) - Add(point = new PointVisualisation()); + Add(point = new PointVisualisation(0)); else point = Children[drawableIndex]; From 2453e2fd00b3b484ccc9f14e1555c87fc0f6beee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Jul 2024 18:11:23 +0900 Subject: [PATCH 3/4] Fix nullability issue --- .../Edit/Components/Timelines/Summary/Parts/BreakPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs index c20738bbd910..17e0d47676c8 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BreakPart.cs @@ -51,7 +51,7 @@ protected override void LoadComplete() private partial class BreakVisualisation : PoolableDrawable, IHasTooltip { - private BreakPeriod breakPeriod; + private BreakPeriod breakPeriod = null!; public BreakPeriod BreakPeriod { From 217b01d3031b550e5e35f9a39142dbe9da27fd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 12 Jul 2024 11:10:52 +0200 Subject: [PATCH 4/4] Apply tooltip to bookmark pieces too Bookmarks don't show on real beatmaps, but they do show in test scenes (namely `TestSceneEditorSummaryTimeline`). Also does some more changes to adjust the markers to the latest updates to other markers. --- .../Components/Timelines/Summary/Parts/BookmarkPart.cs | 8 ++++++-- .../Edit/Components/Timelines/Summary/SummaryTimeline.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs index ea71f24e9cb3..189cb4ba4a43 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/BookmarkPart.cs @@ -2,6 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Localisation; +using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; @@ -19,16 +22,17 @@ protected override void LoadBeatmap(EditorBeatmap beatmap) Add(new BookmarkVisualisation(bookmark)); } - private partial class BookmarkVisualisation : PointVisualisation + private partial class BookmarkVisualisation : PointVisualisation, IHasTooltip { public BookmarkVisualisation(double startTime) : base(startTime) { - Width = 2; } [BackgroundDependencyLoader] private void load(OsuColour colours) => Colour = colours.Blue; + + public LocalisableString TooltipText => $"{StartTime.ToEditorFormattedString()} bookmark"; } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs index 49110ccee34d..a495442c1d46 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs @@ -71,7 +71,7 @@ private void load(OverlayColourProvider colourProvider) Anchor = Anchor.Centre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Both, - Height = 0.35f + Height = 0.4f }, new BreakPart {