mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Merge branch 'master' into bindable-safety-skin-editor
This commit is contained in:
commit
3016ce7817
@ -34,7 +34,7 @@
|
||||
<RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl>
|
||||
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
|
||||
<Company>ppy Pty Ltd</Company>
|
||||
<Copyright>Copyright (c) 2021 ppy Pty Ltd</Copyright>
|
||||
<Copyright>Copyright (c) 2022 ppy Pty Ltd</Copyright>
|
||||
<PackageTags>osu game</PackageTags>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
2
LICENCE
2
LICENCE
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2021 ppy Pty Ltd <contact@ppy.sh>.
|
||||
Copyright (c) 2022 ppy Pty Ltd <contact@ppy.sh>.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -8,7 +8,7 @@
|
||||
<PackageProjectUrl>https://github.com/ppy/osu/blob/master/Templates</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl>
|
||||
<PackageReleaseNotes>Automated release.</PackageReleaseNotes>
|
||||
<copyright>Copyright (c) 2021 ppy Pty Ltd</copyright>
|
||||
<copyright>Copyright (c) 2022 ppy Pty Ltd</copyright>
|
||||
<Description>Templates to use when creating a ruleset for consumption in osu!.</Description>
|
||||
<PackageTags>dotnet-new;templates;osu</PackageTags>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>A free-to-win rhythm game. Rhythm is just a *click* away!</description>
|
||||
<releaseNotes>testing</releaseNotes>
|
||||
<copyright>Copyright (c) 2021 ppy Pty Ltd</copyright>
|
||||
<copyright>Copyright (c) 2022 ppy Pty Ltd</copyright>
|
||||
<language>en-AU</language>
|
||||
</metadata>
|
||||
<files>
|
||||
|
@ -83,6 +83,20 @@ namespace osu.Game.Tests.NonVisual.Skinning
|
||||
"followpoint.png",
|
||||
"followpoint@2x.png", 2
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
// Looking up a path with extension specified should work.
|
||||
new[] { "Gameplay/osu/followpoint.png" },
|
||||
"Gameplay/osu/followpoint.png",
|
||||
"Gameplay/osu/followpoint.png", 1
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
// Looking up a path with extension specified should also work with @2x sprites.
|
||||
new[] { "Gameplay/osu/followpoint@2x.png" },
|
||||
"Gameplay/osu/followpoint.png",
|
||||
"Gameplay/osu/followpoint@2x.png", 2
|
||||
},
|
||||
};
|
||||
|
||||
[TestCaseSource(nameof(fallbackTestCases))]
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Configuration.Tracking;
|
||||
using osu.Framework.Extensions;
|
||||
@ -102,6 +103,9 @@ namespace osu.Game.Configuration
|
||||
|
||||
SetDefault(OsuSetting.MenuParallax, true);
|
||||
|
||||
// See https://stackoverflow.com/a/63307411 for default sourcing.
|
||||
SetDefault(OsuSetting.Prefer24HourTime, CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt"));
|
||||
|
||||
// Gameplay
|
||||
SetDefault(OsuSetting.PositionalHitsounds, true); // replaced by level setting below, can be removed 20220703.
|
||||
SetDefault(OsuSetting.PositionalHitsoundsLevel, 0.2f, 0, 1);
|
||||
@ -287,6 +291,7 @@ namespace osu.Game.Configuration
|
||||
MenuVoice,
|
||||
CursorRotation,
|
||||
MenuParallax,
|
||||
Prefer24HourTime,
|
||||
BeatmapDetailTab,
|
||||
BeatmapDetailModsFilter,
|
||||
Username,
|
||||
|
@ -29,6 +29,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString PreferOriginalMetadataLanguage => new TranslatableString(getKey(@"prefer_original"), @"Prefer metadata in original language");
|
||||
|
||||
/// <summary>
|
||||
/// "Prefer 24-hour time display"
|
||||
/// </summary>
|
||||
public static LocalisableString Prefer24HourTimeDisplay => new TranslatableString(getKey(@"prefer_24_hour_time_display"), @"Prefer 24-hour time display");
|
||||
|
||||
/// <summary>
|
||||
/// "Updates"
|
||||
/// </summary>
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
protected override LocalisableString Header => GeneralSettingsStrings.LanguageHeader;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkConfigManager frameworkConfig)
|
||||
private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager config)
|
||||
{
|
||||
frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale);
|
||||
|
||||
@ -34,6 +35,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
LabelText = GeneralSettingsStrings.PreferOriginalMetadataLanguage,
|
||||
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowUnicode)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = GeneralSettingsStrings.Prefer24HourTimeDisplay,
|
||||
Current = config.GetBindable<bool>(OsuSetting.Prefer24HourTime)
|
||||
},
|
||||
};
|
||||
|
||||
if (!LanguageExtensions.TryParseCultureCode(frameworkLocale.Value, out var locale))
|
||||
|
@ -29,6 +29,23 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
}
|
||||
|
||||
private bool use24HourDisplay;
|
||||
|
||||
public bool Use24HourDisplay
|
||||
{
|
||||
get => use24HourDisplay;
|
||||
set
|
||||
{
|
||||
if (use24HourDisplay == value)
|
||||
return;
|
||||
|
||||
use24HourDisplay = value;
|
||||
|
||||
updateMetrics();
|
||||
UpdateDisplay(DateTimeOffset.Now); //Update realTime.Text immediately instead of waiting until next second
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
@ -50,13 +67,14 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected override void UpdateDisplay(DateTimeOffset now)
|
||||
{
|
||||
realTime.Text = $"{now:HH:mm:ss}";
|
||||
realTime.Text = use24HourDisplay ? $"{now:HH:mm:ss}" : $"{now:h:mm:ss tt}";
|
||||
gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
|
||||
}
|
||||
|
||||
private void updateMetrics()
|
||||
{
|
||||
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 || !use24HourDisplay ? 66 : 45; // Allows for space for game time up to 99 days (in the padding area since this is quite rare).
|
||||
|
||||
gameTime.FadeTo(showRuntime ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
public class ToolbarClock : OsuClickableContainer
|
||||
{
|
||||
private Bindable<ToolbarClockDisplayMode> clockDisplayMode;
|
||||
private Bindable<bool> prefer24HourTime;
|
||||
|
||||
private Box hoverBackground;
|
||||
private Box flashBackground;
|
||||
@ -38,6 +39,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
clockDisplayMode = config.GetBindable<ToolbarClockDisplayMode>(OsuSetting.ToolbarClockDisplayMode);
|
||||
prefer24HourTime = config.GetBindable<bool>(OsuSetting.Prefer24HourTime);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -94,6 +96,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
analog.FadeTo(showAnalog ? 1 : 0);
|
||||
}, true);
|
||||
|
||||
prefer24HourTime.BindValueChanged(prefer24H => digital.Use24HourDisplay = prefer24H.NewValue, true);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
|
@ -443,9 +443,7 @@ namespace osu.Game.Skinning
|
||||
string lookupName = name.Replace(@"@2x", string.Empty);
|
||||
|
||||
float ratio = 2;
|
||||
string twoTimesFilename = Path.HasExtension(lookupName)
|
||||
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
|
||||
: @$"{lookupName}@2x";
|
||||
string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}";
|
||||
|
||||
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user