From acd554d91820fa861612c9978d80bbbf2ad6c42c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 May 2022 23:30:53 +0900 Subject: [PATCH] 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)