From 508b92e611c3c20ffa4a7bbdecd64b2f3db42586 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 15:57:55 +0900 Subject: [PATCH 01/10] Update beat divisor colours to be more distinguishable Close to osu-stable --- osu.Game/Screens/Edit/BindableBeatDivisor.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index ce95d81f54..e8f7c75cc1 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -52,29 +52,32 @@ namespace osu.Game.Screens.Edit { switch (beatDivisor) { + case 1: + return Color4.White; + case 2: - return colours.BlueLight; + return colours.Red; case 4: return colours.Blue; case 8: - return colours.BlueDarker; + return colours.Yellow; case 16: return colours.PurpleDark; case 3: - return colours.YellowLight; + return colours.Purple; case 6: - return colours.Yellow; + return colours.YellowDark; case 12: return colours.YellowDarker; default: - return Color4.White; + return Color4.Red; } } } From df665c3a3cd98744c5381282c124148b60d83cdc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 16:00:51 +0900 Subject: [PATCH 02/10] Move beat index colour retrieval to static function --- osu.Game/Screens/Edit/BindableBeatDivisor.cs | 23 ++++++++++++++++++- .../Compose/Components/DistanceSnapGrid.cs | 14 +---------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index e8f7c75cc1..be1e121a99 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; @@ -80,5 +80,26 @@ namespace osu.Game.Screens.Edit return Color4.Red; } } + + /// + /// Retrieves the applicable divisor for a specific beat index. + /// + /// The 0-based beat index. + /// The beat divisor. + /// The applicable divisor. + public static int GetDivisorForBeatIndex(int index, int beatDivisor) + { + int beat = index % beatDivisor; + + for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++) + { + int divisor = BindableBeatDivisor.VALID_DIVISORS[i]; + + if ((beat * divisor) % beatDivisor == 0) + return divisor; + } + + return 0; + } } } diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 53c5cf97fa..3bbccd612b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -130,19 +130,7 @@ namespace osu.Game.Screens.Edit.Compose.Components /// The applicable colour. protected ColourInfo GetColourForBeatIndex(int index) { - int beat = (index + 1) % beatDivisor.Value; - ColourInfo colour = Colours.Gray5; - - for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++) - { - int divisor = BindableBeatDivisor.VALID_DIVISORS[i]; - - if ((beat * divisor) % beatDivisor.Value == 0) - { - colour = BindableBeatDivisor.GetColourFor(divisor, Colours); - break; - } - } + var colour = BindableBeatDivisor.GetColourFor(BindableBeatDivisor.GetDivisorForBeatIndex(index + 1, beatDivisor.Value), Colours); int repeatIndex = index / beatDivisor.Value; return colour.MultiplyAlpha(0.5f / (repeatIndex + 1)); From 03b7c6cfa7ed291dc9b9c2913d12c7b4378c65b6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 16:54:36 +0900 Subject: [PATCH 03/10] Add base test scene for timeline --- .../TestSceneTimelineBlueprintContainer.cs | 135 +--------------- .../Visual/Editor/TimelineTestScene.cs | 148 ++++++++++++++++++ 2 files changed, 150 insertions(+), 133 deletions(-) create mode 100644 osu.Game.Tests/Visual/Editor/TimelineTestScene.cs diff --git a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBlueprintContainer.cs b/osu.Game.Tests/Visual/Editor/TestSceneTimelineBlueprintContainer.cs index e7b2508ac7..3c75fd5310 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBlueprintContainer.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneTimelineBlueprintContainer.cs @@ -1,146 +1,15 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Timing; -using osu.Game.Beatmaps; -using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Objects; -using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Compose.Components.Timeline; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Tests.Visual.Editor { [TestFixture] - public class TestSceneTimelineBlueprintContainer : EditorClockTestScene + public class TestSceneTimelineBlueprintContainer : TimelineTestScene { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(TimelineArea), - typeof(Timeline), - typeof(TimelineButton), - typeof(CentreMarker) - }; - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - Beatmap.Value = new WaveformTestBeatmap(audio); - - var editorBeatmap = new EditorBeatmap((Beatmap)Beatmap.Value.Beatmap, BeatDivisor); - - Dependencies.Cache(editorBeatmap); - Dependencies.CacheAs(editorBeatmap); - - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 5), - Children = new Drawable[] - { - new StartStopButton(), - new AudioVisualiser(), - } - }, - new TimelineArea - { - Child = new TimelineBlueprintContainer(), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.X, - Size = new Vector2(0.8f, 100) - } - }; - } - - private class AudioVisualiser : CompositeDrawable - { - private readonly Drawable marker; - - [Resolved] - private IBindable beatmap { get; set; } - - [Resolved] - private IAdjustableClock adjustableClock { get; set; } - - public AudioVisualiser() - { - Size = new Vector2(250, 25); - - InternalChildren = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.25f, - }, - marker = new Box - { - RelativePositionAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Width = 2, - } - }; - } - - protected override void Update() - { - base.Update(); - - if (beatmap.Value.Track.IsLoaded) - marker.X = (float)(adjustableClock.CurrentTime / beatmap.Value.Track.Length); - } - } - - private class StartStopButton : OsuButton - { - private IAdjustableClock adjustableClock; - private bool started; - - public StartStopButton() - { - BackgroundColour = Color4.SlateGray; - Size = new Vector2(100, 50); - Text = "Start"; - - Action = onClick; - } - - [BackgroundDependencyLoader] - private void load(IAdjustableClock adjustableClock) - { - this.adjustableClock = adjustableClock; - } - - private void onClick() - { - if (started) - { - adjustableClock.Stop(); - Text = "Start"; - } - else - { - adjustableClock.Start(); - Text = "Stop"; - } - - started = !started; - } - } + public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(); } } diff --git a/osu.Game.Tests/Visual/Editor/TimelineTestScene.cs b/osu.Game.Tests/Visual/Editor/TimelineTestScene.cs new file mode 100644 index 0000000000..b5e526d3c2 --- /dev/null +++ b/osu.Game.Tests/Visual/Editor/TimelineTestScene.cs @@ -0,0 +1,148 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Objects; +using osu.Game.Screens.Edit; +using osu.Game.Screens.Edit.Compose.Components.Timeline; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual.Editor +{ + public abstract class TimelineTestScene : EditorClockTestScene + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(TimelineArea), + typeof(Timeline), + typeof(TimelineButton), + typeof(CentreMarker) + }; + + protected TimelineArea TimelineArea { get; private set; } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + Beatmap.Value = new WaveformTestBeatmap(audio); + + var editorBeatmap = new EditorBeatmap((Beatmap)Beatmap.Value.Beatmap, BeatDivisor); + + Dependencies.Cache(editorBeatmap); + Dependencies.CacheAs(editorBeatmap); + + AddRange(new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 5), + Children = new Drawable[] + { + new StartStopButton(), + new AudioVisualiser(), + } + }, + TimelineArea = new TimelineArea + { + Child = CreateTestComponent(), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Size = new Vector2(0.8f, 100), + } + }); + } + + public abstract Drawable CreateTestComponent(); + + private class AudioVisualiser : CompositeDrawable + { + private readonly Drawable marker; + + [Resolved] + private IBindable beatmap { get; set; } + + [Resolved] + private IAdjustableClock adjustableClock { get; set; } + + public AudioVisualiser() + { + Size = new Vector2(250, 25); + + InternalChildren = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.25f, + }, + marker = new Box + { + RelativePositionAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Width = 2, + } + }; + } + + protected override void Update() + { + base.Update(); + + if (beatmap.Value.Track.IsLoaded) + marker.X = (float)(adjustableClock.CurrentTime / beatmap.Value.Track.Length); + } + } + + private class StartStopButton : OsuButton + { + private IAdjustableClock adjustableClock; + private bool started; + + public StartStopButton() + { + BackgroundColour = Color4.SlateGray; + Size = new Vector2(100, 50); + Text = "Start"; + + Action = onClick; + } + + [BackgroundDependencyLoader] + private void load(IAdjustableClock adjustableClock) + { + this.adjustableClock = adjustableClock; + } + + private void onClick() + { + if (started) + { + adjustableClock.Stop(); + Text = "Start"; + } + else + { + adjustableClock.Start(); + Text = "Stop"; + } + + started = !started; + } + } + } +} From e24c4ab90101ed2c53035db225a5c85339dc6183 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 16:54:57 +0900 Subject: [PATCH 04/10] Adjust zoom defaults for timeline to be more useful --- .../Screens/Edit/Compose/Components/Timeline/Timeline.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index 96395696c3..5b2dd343e6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -30,7 +30,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { ZoomDuration = 200; ZoomEasing = Easing.OutQuint; - Zoom = 10; + + Zoom = 60; + MaxZoom = 240; + ScrollbarVisible = false; } From 084fa2f04a8fa8b1d6a3c34b7744c590c0256f75 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 17:34:25 +0900 Subject: [PATCH 05/10] Add timeline beat display --- .../TestSceneTimelineBeatLineDisplay.cs | 32 +++++++ .../Visualisations/PointVisualisation.cs | 2 +- .../Timeline/TimelineBeatLineDisplay.cs | 90 +++++++++++++++++++ .../Screens/Edit/EditorScreenWithTimeline.cs | 6 +- 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs create mode 100644 osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs diff --git a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs b/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs new file mode 100644 index 0000000000..50a33852be --- /dev/null +++ b/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Screens.Edit.Compose.Components; +using osu.Game.Screens.Edit.Compose.Components.Timeline; +using osuTK; + +namespace osu.Game.Tests.Visual.Editor +{ + [TestFixture] + public class TestSceneTimelineBeatLineDisplay : TimelineTestScene + { + public override Drawable CreateTestComponent() => new TimelineBeatLineDisplay(); + + [BackgroundDependencyLoader] + private void load() + { + BeatDivisor.Value = 4; + + Add(new BeatDivisorControl(BeatDivisor) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Margin = new MarginPadding(30), + Size = new Vector2(90) + }); + } + } +} 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 9c00cce57a..1ac960039e 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Visualisations/PointVisualisation.cs @@ -12,7 +12,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations /// public class PointVisualisation : Box { - protected PointVisualisation(double startTime) + public PointVisualisation(double startTime) { Origin = Anchor.TopCentre; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs new file mode 100644 index 0000000000..0a6fa2be66 --- /dev/null +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs @@ -0,0 +1,90 @@ +// Copyright (c) ppy Pty Ltd . 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.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; +using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; + +namespace osu.Game.Screens.Edit.Compose.Components.Timeline +{ + public class TimelineBeatLineDisplay : TimelinePart + { + [Resolved] + private EditorBeatmap beatmap { get; set; } + + [Resolved] + private Bindable working { get; set; } + + [Resolved] + private BindableBeatDivisor beatDivisor { get; set; } + + [Resolved] + private OsuColour colours { get; set; } + + public TimelineBeatLineDisplay() + { + RelativeSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load() + { + beatDivisor.BindValueChanged(_ => createLines(), true); + } + + private void createLines() + { + Clear(); + + for (var i = 0; i < beatmap.ControlPointInfo.TimingPoints.Count; i++) + { + var point = beatmap.ControlPointInfo.TimingPoints[i]; + var until = beatmap.ControlPointInfo.TimingPoints.Count < i + 1 ? beatmap.ControlPointInfo.TimingPoints[i + 1].Time : working.Value.Track.Length; + + int beat = 0; + + for (double t = point.Time; t < until; t += point.BeatLength / beatDivisor.Value) + { + var indexInBeat = beat % beatDivisor.Value; + + if (indexInBeat == 0) + { + Add(new PointVisualisation(t) + { + Colour = BindableBeatDivisor.GetColourFor(1, colours), + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }); + } + else + { + var divisor = BindableBeatDivisor.GetDivisorForBeatIndex(beat, beatDivisor.Value); + var colour = BindableBeatDivisor.GetColourFor(divisor, colours); + var height = 0.1f - (float)divisor / BindableBeatDivisor.VALID_DIVISORS.Last() * 0.08f; + + Add(new PointVisualisation(t) + { + Colour = colour, + Height = height, + }); + + Add(new PointVisualisation(t) + { + Colour = colour, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Height = height, + }); + } + + beat++; + } + } + } + } +} diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs index 8967f24185..0f81194894 100644 --- a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs +++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs @@ -102,7 +102,11 @@ namespace osu.Game.Screens.Edit LoadComponentAsync(new TimelineArea { RelativeSizeAxes = Axes.Both, - Child = CreateTimelineContent() + Children = new[] + { + new TimelineBeatLineDisplay(), + CreateTimelineContent(), + } }, timelineContainer.Add); }); } From 493390b75088993c67d6c6c8d662b366483cb622 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 18:07:46 +0900 Subject: [PATCH 06/10] Rename class to TimelineTickDisplay --- .../Visual/Editor/TestSceneTimelineBeatLineDisplay.cs | 2 +- .../{TimelineBeatLineDisplay.cs => TimelineTickDisplay.cs} | 4 ++-- osu.Game/Screens/Edit/EditorScreenWithTimeline.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename osu.Game/Screens/Edit/Compose/Components/Timeline/{TimelineBeatLineDisplay.cs => TimelineTickDisplay.cs} (96%) diff --git a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs b/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs index 50a33852be..3b04496792 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs @@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual.Editor [TestFixture] public class TestSceneTimelineBeatLineDisplay : TimelineTestScene { - public override Drawable CreateTestComponent() => new TimelineBeatLineDisplay(); + public override Drawable CreateTestComponent() => new TimelineTickDisplay(); [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs similarity index 96% rename from osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs rename to osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs index 0a6fa2be66..03fb1fdba1 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineBeatLineDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs @@ -12,7 +12,7 @@ using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations; namespace osu.Game.Screens.Edit.Compose.Components.Timeline { - public class TimelineBeatLineDisplay : TimelinePart + public class TimelineTickDisplay : TimelinePart { [Resolved] private EditorBeatmap beatmap { get; set; } @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline [Resolved] private OsuColour colours { get; set; } - public TimelineBeatLineDisplay() + public TimelineTickDisplay() { RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs index 0f81194894..7ee1005add 100644 --- a/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs +++ b/osu.Game/Screens/Edit/EditorScreenWithTimeline.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.Both, Children = new[] { - new TimelineBeatLineDisplay(), + new TimelineTickDisplay(), CreateTimelineContent(), } }, timelineContainer.Add); From d5fda053f4333bd6c68715c3cc077412d5607b57 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 18:08:30 +0900 Subject: [PATCH 07/10] Use centre origin/anchors --- .../Edit/Compose/Components/Timeline/TimelineTickDisplay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs index 03fb1fdba1..f9b92c0504 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineTickDisplay.cs @@ -57,8 +57,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline Add(new PointVisualisation(t) { Colour = BindableBeatDivisor.GetColourFor(1, colours), - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Origin = Anchor.TopCentre, }); } else @@ -71,13 +70,14 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { Colour = colour, Height = height, + Origin = Anchor.TopCentre, }); Add(new PointVisualisation(t) { Colour = colour, Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Origin = Anchor.BottomCentre, Height = height, }); } From 9a2867d3d97e8becceffa5d7b6866ae336758cdb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Jan 2020 18:10:42 +0900 Subject: [PATCH 08/10] Rename test class --- ...melineBeatLineDisplay.cs => TestSceneTimelineTickDisplay.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Tests/Visual/Editor/{TestSceneTimelineBeatLineDisplay.cs => TestSceneTimelineTickDisplay.cs} (92%) diff --git a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs b/osu.Game.Tests/Visual/Editor/TestSceneTimelineTickDisplay.cs similarity index 92% rename from osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs rename to osu.Game.Tests/Visual/Editor/TestSceneTimelineTickDisplay.cs index 3b04496792..43a3cd6122 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneTimelineBeatLineDisplay.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneTimelineTickDisplay.cs @@ -11,7 +11,7 @@ using osuTK; namespace osu.Game.Tests.Visual.Editor { [TestFixture] - public class TestSceneTimelineBeatLineDisplay : TimelineTestScene + public class TestSceneTimelineTickDisplay : TimelineTestScene { public override Drawable CreateTestComponent() => new TimelineTickDisplay(); From 40379a5e225eb8b2b8f13a1214858e5dedf059e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jan 2020 16:04:13 +0900 Subject: [PATCH 09/10] Use foreach --- osu.Game/Screens/Edit/BindableBeatDivisor.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index be1e121a99..d9477dd4bc 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -91,10 +91,8 @@ namespace osu.Game.Screens.Edit { int beat = index % beatDivisor; - for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++) + foreach (var divisor in BindableBeatDivisor.VALID_DIVISORS) { - int divisor = BindableBeatDivisor.VALID_DIVISORS[i]; - if ((beat * divisor) % beatDivisor == 0) return divisor; } From 12ff51f686cfd884200dabed1f2ef87dc7f08d91 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Jan 2020 17:21:24 +0900 Subject: [PATCH 10/10] Fix key count being incorrectly adjusted by hard/easy mods --- .../Screens/Select/Details/AdvancedStats.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index b7f60a8370..56c400e869 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -117,9 +117,20 @@ namespace osu.Game.Screens.Select.Details mod.ApplyToDifficulty(adjustedDifficulty); } - // Account for mania differences - firstValue.Title = (Beatmap?.Ruleset?.ID ?? 0) == 3 ? "Key Amount" : "Circle Size"; - firstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize); + switch (Beatmap?.Ruleset?.ID ?? 0) + { + case 3: + // Account for mania differences locally for now + // Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes + firstValue.Title = "Key Count"; + firstValue.Value = (baseDifficulty?.CircleSize ?? 0, null); + break; + + default: + firstValue.Title = "Circle Size"; + firstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize); + break; + } starDifficulty.Value = ((float)(Beatmap?.StarDifficulty ?? 0), null);