mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add config in settings for forcing 24H time, determines default off CurrentCulture
This commit is contained in:
@ -102,6 +102,8 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
SetDefault(OsuSetting.MenuParallax, true);
|
SetDefault(OsuSetting.MenuParallax, true);
|
||||||
|
|
||||||
|
SetDefault(OsuSetting.Prefer24HourTime, false);
|
||||||
|
|
||||||
// Gameplay
|
// Gameplay
|
||||||
SetDefault(OsuSetting.PositionalHitsounds, true); // replaced by level setting below, can be removed 20220703.
|
SetDefault(OsuSetting.PositionalHitsounds, true); // replaced by level setting below, can be removed 20220703.
|
||||||
SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1);
|
SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1);
|
||||||
@ -287,6 +289,7 @@ namespace osu.Game.Configuration
|
|||||||
MenuVoice,
|
MenuVoice,
|
||||||
CursorRotation,
|
CursorRotation,
|
||||||
MenuParallax,
|
MenuParallax,
|
||||||
|
Prefer24HourTime,
|
||||||
BeatmapDetailTab,
|
BeatmapDetailTab,
|
||||||
BeatmapDetailModsFilter,
|
BeatmapDetailModsFilter,
|
||||||
Username,
|
Username,
|
||||||
|
@ -24,6 +24,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString CursorRotation => new TranslatableString(getKey(@"cursor_rotation"), @"Rotate cursor when dragging");
|
public static LocalisableString CursorRotation => new TranslatableString(getKey(@"cursor_rotation"), @"Rotate cursor when dragging");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Prefer 24-hour time"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString Prefer24HourTime => new TranslatableString(getKey(@"prefer_24_hour_time"), @"Prefer 24-hour time");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Menu cursor size"
|
/// "Menu cursor size"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -41,6 +41,11 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
|||||||
Current = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay),
|
Current = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay),
|
||||||
KeyboardStep = 50
|
KeyboardStep = 50
|
||||||
},
|
},
|
||||||
|
new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = UserInterfaceStrings.Prefer24HourTime,
|
||||||
|
Current = config.GetBindable<bool>(OsuSetting.Prefer24HourTime)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,21 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool format12H = true;
|
private bool format12H = false;
|
||||||
|
|
||||||
|
public bool Format12H
|
||||||
|
{
|
||||||
|
get => format12H;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (format12H == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
format12H = value;
|
||||||
|
updateMetrics();
|
||||||
|
UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
@ -52,14 +66,14 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
protected override void UpdateDisplay(DateTimeOffset now)
|
protected override void UpdateDisplay(DateTimeOffset now)
|
||||||
{
|
{
|
||||||
realTime.Text = format12H ? $"{now:hh:mm:ss tt}" : $"{now:HH:mm:ss}";
|
realTime.Text = format12H ? $"{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 (format12H)
|
||||||
Width = 74;
|
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).
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Globalization;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -20,6 +21,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
public class ToolbarClock : OsuClickableContainer
|
public class ToolbarClock : OsuClickableContainer
|
||||||
{
|
{
|
||||||
private Bindable<ToolbarClockDisplayMode> clockDisplayMode;
|
private Bindable<ToolbarClockDisplayMode> clockDisplayMode;
|
||||||
|
private Bindable<bool> digitalPrefer24Hour;
|
||||||
|
|
||||||
private Box hoverBackground;
|
private Box hoverBackground;
|
||||||
private Box flashBackground;
|
private Box flashBackground;
|
||||||
@ -38,6 +40,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
clockDisplayMode = config.GetBindable<ToolbarClockDisplayMode>(OsuSetting.ToolbarClockDisplayMode);
|
clockDisplayMode = config.GetBindable<ToolbarClockDisplayMode>(OsuSetting.ToolbarClockDisplayMode);
|
||||||
|
digitalPrefer24Hour = config.GetBindable<bool>(OsuSetting.Prefer24HourTime);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -94,6 +97,9 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
analog.FadeTo(showAnalog ? 1 : 0);
|
analog.FadeTo(showAnalog ? 1 : 0);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
digitalPrefer24Hour.BindValueChanged(prefer24H =>
|
||||||
|
digital.Format12H = prefer24H.NewValue ? false : CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
Reference in New Issue
Block a user