mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 18:47:27 +08:00
Merge branch 'master' into fix-spinner-rpm-user-rate-adjust
This commit is contained in:
commit
466d37a450
26
osu.Game/Extensions/EditorDisplayExtensions.cs
Normal file
26
osu.Game/Extensions/EditorDisplayExtensions.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace osu.Game.Extensions
|
||||||
|
{
|
||||||
|
public static class EditorDisplayExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Get an editor formatted string (mm:ss:mss)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="milliseconds">A time value in milliseconds.</param>
|
||||||
|
/// <returns>An editor formatted display string.</returns>
|
||||||
|
public static string ToEditorFormattedString(this double milliseconds) =>
|
||||||
|
ToEditorFormattedString(TimeSpan.FromMilliseconds(milliseconds));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an editor formatted string (mm:ss:mss)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timeSpan">A time value.</param>
|
||||||
|
/// <returns>An editor formatted display string.</returns>
|
||||||
|
public static string ToEditorFormattedString(this TimeSpan timeSpan) =>
|
||||||
|
$"{(timeSpan < TimeSpan.Zero ? "-" : string.Empty)}{timeSpan:mm\\:ss\\:fff}";
|
||||||
|
}
|
||||||
|
}
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Components
|
namespace osu.Game.Screens.Edit.Components
|
||||||
@ -35,9 +35,7 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
trackTimer.Text = editorClock.CurrentTime.ToEditorFormattedString();
|
||||||
var timespan = TimeSpan.FromMilliseconds(editorClock.CurrentTime);
|
|
||||||
trackTimer.Text = $"{(timespan < TimeSpan.Zero ? "-" : string.Empty)}{timespan:mm\\:ss\\:fff}";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -89,7 +90,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = $"{group.Time:n0}ms",
|
Text = group.Time.ToEditorFormattedString(),
|
||||||
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
|
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
|
||||||
},
|
},
|
||||||
new ControlGroupAttributes(group),
|
new ControlGroupAttributes(group),
|
||||||
|
Loading…
Reference in New Issue
Block a user