mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 06:42:54 +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
|
set
|
||||||
{
|
{
|
||||||
if (format12H == value)
|
if (use24HourDisplay == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
format12H = value;
|
use24HourDisplay = value;
|
||||||
updateMetrics();
|
updateMetrics();
|
||||||
UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second
|
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)
|
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}";
|
gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMetrics()
|
private void updateMetrics()
|
||||||
{
|
{
|
||||||
if (format12H)
|
if (use24HourDisplay)
|
||||||
Width = 70;
|
Width = 70;
|
||||||
else
|
else
|
||||||
Width = showRuntime ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare).
|
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);
|
}, true);
|
||||||
|
|
||||||
digitalPrefer24Hour.BindValueChanged(prefer24H =>
|
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)
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
Loading…
Reference in New Issue
Block a user