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

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