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

Reduce string allocations in TimeInfoContainer

This commit is contained in:
Andrei Zavatski 2024-02-20 19:38:57 +03:00
parent 6678c4783b
commit 871bdb9cf7

View File

@ -47,11 +47,26 @@ namespace osu.Game.Screens.Edit.Components
};
}
private double? lastTime;
private double? lastBPM;
protected override void Update()
{
base.Update();
trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString();
bpm.Text = @$"{editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM:0} BPM";
if (lastTime != editorClock.CurrentTime)
{
lastTime = editorClock.CurrentTime;
trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString();
}
double newBPM = editorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime).BPM;
if (lastBPM != newBPM)
{
lastBPM = newBPM;
bpm.Text = @$"{newBPM:0} BPM";
}
}
}
}