mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Rename variable and fix inspections
This commit is contained in:
parent
2525ec0d18
commit
37509e04a9
@ -29,17 +29,17 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
}
|
||||
|
||||
private bool format12H = false;
|
||||
private bool use24HourDisplay;
|
||||
|
||||
public bool Format12H
|
||||
public bool Use24HourDisplay
|
||||
{
|
||||
get => format12H;
|
||||
get => use24HourDisplay;
|
||||
set
|
||||
{
|
||||
if (format12H == value)
|
||||
if (use24HourDisplay == value)
|
||||
return;
|
||||
|
||||
format12H = value;
|
||||
use24HourDisplay = value;
|
||||
updateMetrics();
|
||||
UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second
|
||||
}
|
||||
@ -66,13 +66,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected override void UpdateDisplay(DateTimeOffset now)
|
||||
{
|
||||
realTime.Text = format12H ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}";
|
||||
realTime.Text = use24HourDisplay ? $"{now:h:mm:ss tt}" : $"{now:HH:mm:ss}";
|
||||
gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
|
||||
}
|
||||
|
||||
private void updateMetrics()
|
||||
{
|
||||
if (format12H)
|
||||
if (use24HourDisplay)
|
||||
Width = 70;
|
||||
else
|
||||
Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare).
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}, true);
|
||||
|
||||
digitalPrefer24Hour.BindValueChanged(prefer24H =>
|
||||
digital.Format12H = prefer24H.NewValue ? false : CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true);
|
||||
digital.Use24HourDisplay = !prefer24H.NewValue && CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user