1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00

Avoid using a StringBuilder

This commit is contained in:
Dean Herbert 2021-03-29 18:51:28 +09:00
parent 90ab765cf5
commit 3909eda095

View File

@ -3,7 +3,6 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -101,15 +100,15 @@ namespace osu.Game.Screens.Edit.Compose
private string formatSelectionAsString()
{
var builder = new StringBuilder();
builder.Append(EditorBeatmap.SelectedHitObjects.OrderBy(h => h.StartTime).FirstOrDefault()?.StartTime.ToEditorFormattedString() ?? clock.CurrentTime.ToEditorFormattedString());
if (composer == null)
return string.Empty;
if (EditorBeatmap.SelectedHitObjects.Any() && composer != null)
builder.Append($" ({composer.ConvertSelectionToString()})");
double displayTime = EditorBeatmap.SelectedHitObjects.OrderBy(h => h.StartTime).FirstOrDefault()?.StartTime ?? clock.CurrentTime;
string selectionAsString = composer.ConvertSelectionToString();
builder.Append(" - ");
return builder.ToString();
return !string.IsNullOrEmpty(selectionAsString)
? $"{displayTime.ToEditorFormattedString()} ({selectionAsString}) - "
: $"{displayTime.ToEditorFormattedString()} - ";
}
#endregion