Update time info and add bpm

This commit is contained in:
Dean Herbert 2022-05-25 23:30:53 +09:00
parent 2c61a9d3d1
commit acd554d918
3 changed files with 27 additions and 7 deletions

View File

@ -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()

View File

@ -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;
}
}
}

View File

@ -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)