1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 04:47:38 +08:00
osu-lazer/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs

60 lines
1.9 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Allocation;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Overlays;
2022-05-25 22:30:53 +08:00
using osuTK;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Screens.Edit.Components
{
public class TimeInfoContainer : BottomBarContainer
{
private OsuSpriteText trackTimer;
2022-05-25 22:30:53 +08:00
private OsuSpriteText bpm;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
2018-04-13 17:19:50 +08:00
2020-02-14 21:14:00 +08:00
[Resolved]
private EditorClock editorClock { get; set; }
2018-04-13 17:19:50 +08:00
[BackgroundDependencyLoader]
2022-05-25 22:30:53 +08:00
private void load(OsuColour colours, OverlayColourProvider colourProvider)
2018-04-13 17:19:50 +08:00
{
Background.Colour = colourProvider.Background5;
2018-04-13 17:19:50 +08:00
Children = new Drawable[]
{
trackTimer = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2022-05-25 22:30:53 +08:00
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.CentreLeft,
2022-05-25 22:30:53 +08:00
Font = OsuFont.Torus.With(size: 18, weight: FontWeight.SemiBold),
Position = new Vector2(2, 5),
2018-04-13 17:19:50 +08:00
}
};
}
protected override void Update()
{
base.Update();
trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString();
2022-05-25 22:30:53 +08:00
bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM";
2018-04-13 17:19:50 +08:00
}
}
}