1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 16:22:55 +08:00

Merge pull request #31841 from peppy/add-editor-percent-progress

Add percent progress display to editor footer
This commit is contained in:
Bartłomiej Dach 2025-02-10 09:54:05 +01:00 committed by GitHub
commit 3294450dc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,6 +18,7 @@ namespace osu.Game.Screens.Edit.Components
public partial class TimeInfoContainer : BottomBarContainer
{
private OsuSpriteText bpm = null!;
private OsuSpriteText progress = null!;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; } = null!;
@ -36,26 +37,44 @@ namespace osu.Game.Screens.Edit.Components
bpm = new OsuSpriteText
{
Colour = colours.Orange1,
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold, fixedWidth: true),
Spacing = new Vector2(-1, 0),
Position = new Vector2(0, 4),
Anchor = Anchor.CentreRight,
Origin = Anchor.TopRight,
},
progress = new OsuSpriteText
{
Colour = colours.Purple1,
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold, fixedWidth: true),
Spacing = new Vector2(-1, 0),
Anchor = Anchor.CentreLeft,
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
Position = new Vector2(2, 4),
}
};
}
private double? lastBPM;
private double? lastProgress;
protected override void Update()
{
base.Update();
double newBPM = editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM;
double newProgress = (int)(editorClock.CurrentTime / editorClock.TrackLength * 100);
if (lastBPM != newBPM)
{
lastBPM = newBPM;
bpm.Text = @$"{newBPM:0} BPM";
}
if (lastProgress != newProgress)
{
lastProgress = newProgress;
progress.Text = @$"{newProgress:0}%";
}
}
private partial class TimestampControl : OsuClickableContainer