From 8791e3b9ef37071dae3f1e44a56060e889f3f7d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:10:58 +0900 Subject: [PATCH 1/5] Split `BottomBar` out of `Editor` --- osu.Game/Screens/Edit/BottomBar.cs | 83 +++++++++++++++++++++ osu.Game/Screens/Edit/Editor.cs | 113 ++++++----------------------- 2 files changed, 107 insertions(+), 89 deletions(-) create mode 100644 osu.Game/Screens/Edit/BottomBar.cs diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs new file mode 100644 index 0000000000..e48d54e811 --- /dev/null +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -0,0 +1,83 @@ +// Copyright (c) ppy Pty Ltd . 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.Framework.Graphics.Shapes; +using osu.Game.Overlays; +using osu.Game.Screens.Edit.Components; +using osu.Game.Screens.Edit.Components.Timelines.Summary; +using osuTK; + +namespace osu.Game.Screens.Edit +{ + internal class BottomBar : CompositeDrawable + { + public TestGameplayButton TestGameplayButton { get; private set; } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider, Editor editor) + { + Anchor = Anchor.BottomLeft; + Origin = Anchor.BottomLeft; + + RelativeSizeAxes = Axes.X; + + Height = 60; + + InternalChildren = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background4, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Child = new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 220), + new Dimension(), + new Dimension(GridSizeMode.Absolute, 220), + new Dimension(GridSizeMode.Absolute, 120), + }, + Content = new[] + { + new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Right = 10 }, + Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, + }, + new SummaryTimeline + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 10 }, + Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, + }, + TestGameplayButton = new TestGameplayButton + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = 10 }, + Size = new Vector2(1), + Action = editor.TestGameplay, + } + }, + } + }, + } + }; + } + } +} diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7e7764397c..4281b49e76 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -12,7 +12,6 @@ using osu.Framework.Audio.Track; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; using osu.Framework.Input.Bindings; @@ -26,7 +25,6 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Configuration; using osu.Game.Database; -using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osu.Game.Input.Bindings; @@ -37,9 +35,7 @@ using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; -using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components.Menus; -using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Design; using osu.Game.Screens.Edit.GameplayTest; @@ -48,7 +44,6 @@ using osu.Game.Screens.Edit.Timing; using osu.Game.Screens.Edit.Verify; using osu.Game.Screens.Play; using osu.Game.Users; -using osuTK; using osuTK.Graphics; using osuTK.Input; @@ -119,13 +114,13 @@ namespace osu.Game.Screens.Edit private IBeatmap playableBeatmap; private EditorBeatmap editorBeatmap; + private BottomBar bottomBar; + [CanBeNull] // Should be non-null once it can support custom rulesets. private EditorChangeHandler changeHandler; private DependencyContainer dependencies; - private TestGameplayButton testGameplayButton; - private bool isNewBeatmap; protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo); @@ -148,7 +143,7 @@ namespace osu.Game.Screens.Edit } [BackgroundDependencyLoader] - private void load(OsuColour colours, OsuConfigManager config) + private void load(OsuConfigManager config) { var loadableBeatmap = Beatmap.Value; @@ -226,7 +221,7 @@ namespace osu.Game.Screens.Edit AddInternal(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both, - Children = new[] + Children = new Drawable[] { new Container { @@ -287,67 +282,7 @@ namespace osu.Game.Screens.Edit }, }, }, - new Container - { - Name = "Bottom bar", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = 60, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = colours.Gray2 - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Vertical = 5, Horizontal = 10 }, - Child = new GridContainer - { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 220), - new Dimension(), - new Dimension(GridSizeMode.Absolute, 220), - new Dimension(GridSizeMode.Absolute, 120), - }, - Content = new[] - { - new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = 10 }, - Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, - }, - new SummaryTimeline - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, - }, - testGameplayButton = new TestGameplayButton - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Size = new Vector2(1), - Action = testGameplay - } - }, - } - }, - } - } - }, + bottomBar = new BottomBar(), } }); @@ -392,6 +327,24 @@ namespace osu.Game.Screens.Edit Clipboard.Content.Value = state.ClipboardContent; }); + public void TestGameplay() + { + if (HasUnsavedChanges) + { + dialogOverlay.Push(new SaveBeforeGameplayTestDialog(() => + { + Save(); + pushEditorPlayer(); + })); + } + else + { + pushEditorPlayer(); + } + + void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this)); + } + /// /// Saves the currently edited beatmap. /// @@ -589,7 +542,7 @@ namespace osu.Game.Screens.Edit return true; case GlobalAction.EditorTestGameplay: - testGameplayButton.TriggerClick(); + bottomBar.TestGameplayButton.TriggerClick(); return true; default: @@ -935,24 +888,6 @@ namespace osu.Game.Screens.Edit loader?.CancelPendingDifficultySwitch(); } - private void testGameplay() - { - if (HasUnsavedChanges) - { - dialogOverlay.Push(new SaveBeforeGameplayTestDialog(() => - { - Save(); - pushEditorPlayer(); - })); - } - else - { - pushEditorPlayer(); - } - - void pushEditorPlayer() => this.Push(new EditorPlayerLoader(this)); - } - public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime); public double GetBeatLengthAtTime(double referenceTime) => editorBeatmap.GetBeatLengthAtTime(referenceTime); From 2c61a9d3d1b4cf1035d3a087c283ac086c2682a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:17:52 +0900 Subject: [PATCH 2/5] Update bottom bar components to new design language (mostly) --- osu.Game/Screens/Edit/BottomBar.cs | 19 +++---------------- .../Edit/Components/BottomBarContainer.cs | 16 ++++++++-------- .../Edit/Components/PlaybackControl.cs | 7 ++++--- .../Edit/Components/TimeInfoContainer.cs | 8 ++++++-- .../Timelines/Summary/SummaryTimeline.cs | 10 ++++++---- .../Timelines/Summary/TestGameplayButton.cs | 2 ++ 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs index e48d54e811..0f857940b3 100644 --- a/osu.Game/Screens/Edit/BottomBar.cs +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -50,22 +50,9 @@ namespace osu.Game.Screens.Edit { new Drawable[] { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Right = 10 }, - Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, - }, - new SummaryTimeline - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = 10 }, - Child = new PlaybackControl { RelativeSizeAxes = Axes.Both }, - }, + new TimeInfoContainer { RelativeSizeAxes = Axes.Both }, + new SummaryTimeline { RelativeSizeAxes = Axes.Both }, + new PlaybackControl { RelativeSizeAxes = Axes.Both }, TestGameplayButton = new TestGameplayButton { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index 08091fc3f7..3c63da3a4a 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -8,20 +8,19 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; -using osu.Game.Graphics; +using osuTK.Graphics; namespace osu.Game.Screens.Edit.Components { public class BottomBarContainer : Container { - private const float corner_radius = 5; private const float contents_padding = 15; protected readonly IBindable Beatmap = new Bindable(); protected readonly IBindable Track = new Bindable(); - private readonly Drawable background; + protected readonly Drawable Background; private readonly Container content; protected override Container Content => content; @@ -29,11 +28,14 @@ namespace osu.Game.Screens.Edit.Components public BottomBarContainer() { Masking = true; - CornerRadius = corner_radius; InternalChildren = new[] { - background = new Box { RelativeSizeAxes = Axes.Both }, + Background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Transparent, + }, content = new Container { RelativeSizeAxes = Axes.Both, @@ -43,12 +45,10 @@ namespace osu.Game.Screens.Edit.Components } [BackgroundDependencyLoader] - private void load(IBindable beatmap, OsuColour colours, EditorClock clock) + private void load(IBindable beatmap, EditorClock clock) { Beatmap.BindTo(beatmap); Track.BindTo(clock.Track); - - background.Colour = colours.Gray1; } } } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index bdc6e238c8..d1a999c2d1 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -16,6 +16,7 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; using osuTK.Input; namespace osu.Game.Screens.Edit.Components @@ -155,10 +156,10 @@ namespace osu.Game.Screens.Edit.Components private Color4 normalColour; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { - text.Colour = normalColour = colours.YellowDarker; - textBold.Colour = hoveredColour = colours.Yellow; + text.Colour = normalColour = colourProvider.Light3; + textBold.Colour = hoveredColour = colourProvider.Content1; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 0a8c339559..ac79a8ce7e 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -6,18 +6,22 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; using osu.Game.Extensions; using osu.Game.Graphics; +using osu.Game.Overlays; namespace osu.Game.Screens.Edit.Components { public class TimeInfoContainer : BottomBarContainer { - private readonly OsuSpriteText trackTimer; + private OsuSpriteText trackTimer; [Resolved] private EditorClock editorClock { get; set; } - public TimeInfoContainer() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { + Background.Colour = colourProvider.Background5; + Children = new Drawable[] { trackTimer = new OsuSpriteText diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs index e90ae411de..1706c47c96 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/SummaryTimeline.cs @@ -1,13 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; +using osu.Game.Overlays; using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; +using osuTK; namespace osu.Game.Screens.Edit.Components.Timelines.Summary { @@ -17,8 +17,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary public class SummaryTimeline : BottomBarContainer { [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OverlayColourProvider colourProvider) { + Background.Colour = colourProvider.Background6; + Children = new Drawable[] { new MarkerPart { RelativeSizeAxes = Axes.Both }, @@ -41,7 +43,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary { Name = "centre line", RelativeSizeAxes = Axes.Both, - Colour = colours.Gray5, + Colour = colourProvider.Background2, Children = new Drawable[] { new Circle diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs index 0d7a4ad057..99cdc014aa 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/TestGameplayButton.cs @@ -28,6 +28,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary BackgroundColour = colours.Orange1; SpriteText.Colour = colourProvider.Background6; + Content.CornerRadius = 0; + Text = "Test!"; } } From acd554d91820fa861612c9978d80bbbf2ad6c42c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:30:53 +0900 Subject: [PATCH 3/5] Update time info and add bpm --- .../Editing/TestScenePlaybackControl.cs | 2 +- .../Edit/Components/TimeInfoContainer.cs | 23 +++++++++++++++---- osu.Game/Tests/Visual/EditorClockTestScene.cs | 9 +++++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs b/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs index 6aa884a197..bf0a7876a9 100644 --- a/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs +++ b/osu.Game.Tests/Visual/Editing/TestScenePlaybackControl.cs @@ -12,7 +12,7 @@ using osuTK; namespace osu.Game.Tests.Visual.Editing { [TestFixture] - public class TestScenePlaybackControl : OsuTestScene + public class TestScenePlaybackControl : EditorClockTestScene { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index ac79a8ce7e..6024716f4b 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -7,18 +7,23 @@ using osu.Framework.Allocation; using osu.Game.Extensions; using osu.Game.Graphics; using osu.Game.Overlays; +using osuTK; namespace osu.Game.Screens.Edit.Components { public class TimeInfoContainer : BottomBarContainer { private OsuSpriteText trackTimer; + private OsuSpriteText bpm; + + [Resolved] + private EditorBeatmap editorBeatmap { get; set; } [Resolved] private EditorClock editorClock { get; set; } [BackgroundDependencyLoader] - private void load(OverlayColourProvider colourProvider) + private void load(OsuColour colours, OverlayColourProvider colourProvider) { Background.Colour = colourProvider.Background5; @@ -28,10 +33,16 @@ namespace osu.Game.Screens.Edit.Components { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - // intentionally fudged centre to avoid movement of the number portion when - // going negative. - X = -35, - Font = OsuFont.GetFont(size: 25, fixedWidth: true), + Spacing = new Vector2(-2, 0), + Font = OsuFont.Torus.With(size: 36, fixedWidth: true, weight: FontWeight.Light), + Y = -10, + }, + bpm = new OsuSpriteText + { + Colour = colours.Orange1, + Anchor = Anchor.CentreRight, + Font = OsuFont.Torus.With(size: 18, weight: FontWeight.SemiBold), + Y = 5, } }; } @@ -40,6 +51,8 @@ namespace osu.Game.Screens.Edit.Components { base.Update(); trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString(); + bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM"; + bpm.X = 5 - trackTimer.DrawWidth; } } } diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 542f06f86b..93dfe58076 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Overlays; +using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; namespace osu.Game.Tests.Visual @@ -19,6 +20,10 @@ namespace osu.Game.Tests.Visual [Cached] private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); + [Cached(typeof(EditorBeatmap))] + [Cached(typeof(IBeatSnapProvider))] + private readonly EditorBeatmap editorBeatmap; + protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor(); protected new readonly EditorClock Clock; @@ -26,7 +31,9 @@ namespace osu.Game.Tests.Visual protected EditorClockTestScene() { - Clock = new EditorClock(new Beatmap(), BeatDivisor) { IsCoupled = false }; + editorBeatmap = new EditorBeatmap(new Beatmap()); + + Clock = new EditorClock(editorBeatmap, BeatDivisor) { IsCoupled = false }; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) From 7f4ea5d522de3dc6c53d9e6cb892720b580c47c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:12:28 +0900 Subject: [PATCH 4/5] Use left alignment and remove hacky text positioning code --- osu.Game/Screens/Edit/BottomBar.cs | 2 +- osu.Game/Screens/Edit/Components/TimeInfoContainer.cs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/BottomBar.cs b/osu.Game/Screens/Edit/BottomBar.cs index 0f857940b3..5994184c11 100644 --- a/osu.Game/Screens/Edit/BottomBar.cs +++ b/osu.Game/Screens/Edit/BottomBar.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Edit RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { - new Dimension(GridSizeMode.Absolute, 220), + new Dimension(GridSizeMode.Absolute, 170), new Dimension(), new Dimension(GridSizeMode.Absolute, 220), new Dimension(GridSizeMode.Absolute, 120), diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 6024716f4b..bd5377e578 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -31,8 +31,8 @@ namespace osu.Game.Screens.Edit.Components { trackTimer = new OsuSpriteText { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, Spacing = new Vector2(-2, 0), Font = OsuFont.Torus.With(size: 36, fixedWidth: true, weight: FontWeight.Light), Y = -10, @@ -40,9 +40,9 @@ namespace osu.Game.Screens.Edit.Components bpm = new OsuSpriteText { Colour = colours.Orange1, - Anchor = Anchor.CentreRight, + Anchor = Anchor.CentreLeft, Font = OsuFont.Torus.With(size: 18, weight: FontWeight.SemiBold), - Y = 5, + Position = new Vector2(2, 5), } }; } @@ -52,7 +52,6 @@ namespace osu.Game.Screens.Edit.Components base.Update(); trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString(); bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM"; - bpm.X = 5 - trackTimer.DrawWidth; } } } From 93c94b8ea0f21cb19cfb22a1376b6a0ec61f4911 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 26 May 2022 18:30:37 +0900 Subject: [PATCH 5/5] Fix test caching woes --- osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs | 6 ++++++ osu.Game/Tests/Visual/EditorClockTestScene.cs | 11 +++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs index 4b9be77471..393d3886e7 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs @@ -2,10 +2,13 @@ // 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.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu; +using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components; +using osu.Game.Tests.Beatmaps; using osuTK; namespace osu.Game.Tests.Visual.Editing @@ -13,6 +16,9 @@ namespace osu.Game.Tests.Visual.Editing [TestFixture] public class TestSceneEditorClock : EditorClockTestScene { + [Cached] + private EditorBeatmap editorBeatmap = new EditorBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo)); + public TestSceneEditorClock() { Add(new FillFlowContainer diff --git a/osu.Game/Tests/Visual/EditorClockTestScene.cs b/osu.Game/Tests/Visual/EditorClockTestScene.cs index 93dfe58076..2d3e1960d9 100644 --- a/osu.Game/Tests/Visual/EditorClockTestScene.cs +++ b/osu.Game/Tests/Visual/EditorClockTestScene.cs @@ -6,7 +6,6 @@ using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Overlays; -using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit; namespace osu.Game.Tests.Visual @@ -20,20 +19,16 @@ namespace osu.Game.Tests.Visual [Cached] private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Aquamarine); - [Cached(typeof(EditorBeatmap))] - [Cached(typeof(IBeatSnapProvider))] - private readonly EditorBeatmap editorBeatmap; - protected readonly BindableBeatDivisor BeatDivisor = new BindableBeatDivisor(); + + [Cached] protected new readonly EditorClock Clock; protected virtual bool ScrollUsingMouseWheel => true; protected EditorClockTestScene() { - editorBeatmap = new EditorBeatmap(new Beatmap()); - - Clock = new EditorClock(editorBeatmap, BeatDivisor) { IsCoupled = false }; + Clock = new EditorClock(new Beatmap(), BeatDivisor) { IsCoupled = false }; } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)