1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Merge branch 'master' into fix-storyboard-fallback-animation-frame-count-weirdness

This commit is contained in:
Bartłomiej Dach 2022-04-07 21:49:32 +02:00
commit 8175741a6c
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
13 changed files with 78 additions and 18 deletions

View File

@ -34,7 +34,7 @@
<RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl> <RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes> <PackageReleaseNotes>Automated release.</PackageReleaseNotes>
<Company>ppy Pty Ltd</Company> <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> <PackageTags>osu game</PackageTags>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -8,7 +8,7 @@
<PackageProjectUrl>https://github.com/ppy/osu/blob/master/Templates</PackageProjectUrl> <PackageProjectUrl>https://github.com/ppy/osu/blob/master/Templates</PackageProjectUrl>
<RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl> <RepositoryUrl>https://github.com/ppy/osu</RepositoryUrl>
<PackageReleaseNotes>Automated release.</PackageReleaseNotes> <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> <Description>Templates to use when creating a ruleset for consumption in osu!.</Description>
<PackageTags>dotnet-new;templates;osu</PackageTags> <PackageTags>dotnet-new;templates;osu</PackageTags>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>

View File

@ -11,7 +11,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A free-to-win rhythm game. Rhythm is just a *click* away!</description> <description>A free-to-win rhythm game. Rhythm is just a *click* away!</description>
<releaseNotes>testing</releaseNotes> <releaseNotes>testing</releaseNotes>
<copyright>Copyright (c) 2021 ppy Pty Ltd</copyright> <copyright>Copyright (c) 2022 ppy Pty Ltd</copyright>
<language>en-AU</language> <language>en-AU</language>
</metadata> </metadata>
<files> <files>

View File

@ -83,6 +83,20 @@ namespace osu.Game.Tests.NonVisual.Skinning
"followpoint.png", "followpoint.png",
"followpoint@2x.png", 2 "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))] [TestCaseSource(nameof(fallbackTestCases))]

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Configuration.Tracking; using osu.Framework.Configuration.Tracking;
using osu.Framework.Extensions; using osu.Framework.Extensions;
@ -102,6 +103,9 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.MenuParallax, true); SetDefault(OsuSetting.MenuParallax, true);
// See https://stackoverflow.com/a/63307411 for default sourcing.
SetDefault(OsuSetting.Prefer24HourTime, CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains(@"tt"));
// 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 +291,7 @@ namespace osu.Game.Configuration
MenuVoice, MenuVoice,
CursorRotation, CursorRotation,
MenuParallax, MenuParallax,
Prefer24HourTime,
BeatmapDetailTab, BeatmapDetailTab,
BeatmapDetailModsFilter, BeatmapDetailModsFilter,
Username, Username,

View File

@ -29,6 +29,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString PreferOriginalMetadataLanguage => new TranslatableString(getKey(@"prefer_original"), @"Prefer metadata in original language"); 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> /// <summary>
/// "Updates" /// "Updates"
/// </summary> /// </summary>

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Localisation; using osu.Game.Localisation;
@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
protected override LocalisableString Header => GeneralSettingsStrings.LanguageHeader; protected override LocalisableString Header => GeneralSettingsStrings.LanguageHeader;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig) private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager config)
{ {
frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale); frameworkLocale = frameworkConfig.GetBindable<string>(FrameworkSetting.Locale);
@ -34,6 +35,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
LabelText = GeneralSettingsStrings.PreferOriginalMetadataLanguage, LabelText = GeneralSettingsStrings.PreferOriginalMetadataLanguage,
Current = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowUnicode) 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)) if (!LanguageExtensions.TryParseCultureCode(frameworkLocale.Value, out var locale))

View File

@ -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] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
@ -50,13 +67,14 @@ namespace osu.Game.Overlays.Toolbar
protected override void UpdateDisplay(DateTimeOffset now) 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}"; gameTime.Text = $"running {new TimeSpan(TimeSpan.TicksPerSecond * (int)(Clock.CurrentTime / 1000)):c}";
} }
private void updateMetrics() 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); gameTime.FadeTo(showRuntime ? 1 : 0);
} }
} }

View File

@ -20,6 +20,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> prefer24HourTime;
private Box hoverBackground; private Box hoverBackground;
private Box flashBackground; private Box flashBackground;
@ -38,6 +39,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);
prefer24HourTime = config.GetBindable<bool>(OsuSetting.Prefer24HourTime);
Children = new Drawable[] Children = new Drawable[]
{ {
@ -94,6 +96,8 @@ namespace osu.Game.Overlays.Toolbar
analog.FadeTo(showAnalog ? 1 : 0); analog.FadeTo(showAnalog ? 1 : 0);
}, true); }, true);
prefer24HourTime.BindValueChanged(prefer24H => digital.Use24HourDisplay = prefer24H.NewValue, true);
} }
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)

View File

@ -21,21 +21,20 @@ namespace osu.Game.Skinning.Editor
private readonly List<BindableList<ISkinnableDrawable>> targetComponents = new List<BindableList<ISkinnableDrawable>>(); private readonly List<BindableList<ISkinnableDrawable>> targetComponents = new List<BindableList<ISkinnableDrawable>>();
[Resolved]
private SkinEditor editor { get; set; }
public SkinBlueprintContainer(Drawable target) public SkinBlueprintContainer(Drawable target)
{ {
this.target = target; this.target = target;
} }
[BackgroundDependencyLoader(true)]
private void load(SkinEditor editor)
{
SelectedItems.BindTo(editor.SelectedComponents);
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
SelectedItems.BindTo(editor.SelectedComponents);
// track each target container on the current screen. // track each target container on the current screen.
var targetContainers = target.ChildrenOfType<ISkinnableTarget>().ToArray(); var targetContainers = target.ChildrenOfType<ISkinnableTarget>().ToArray();
@ -56,7 +55,7 @@ namespace osu.Game.Skinning.Editor
} }
} }
private void componentsChanged(object sender, NotifyCollectionChangedEventArgs e) private void componentsChanged(object sender, NotifyCollectionChangedEventArgs e) => Schedule(() =>
{ {
switch (e.Action) switch (e.Action)
{ {
@ -79,7 +78,7 @@ namespace osu.Game.Skinning.Editor
AddBlueprintFor(item); AddBlueprintFor(item);
break; break;
} }
} });
protected override void AddBlueprintFor(ISkinnableDrawable item) protected override void AddBlueprintFor(ISkinnableDrawable item)
{ {
@ -93,5 +92,13 @@ namespace osu.Game.Skinning.Editor
protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable component) protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable component)
=> new SkinBlueprint(component); => new SkinBlueprint(component);
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
foreach (var list in targetComponents)
list.UnbindAll();
}
} }
} }

View File

@ -203,6 +203,9 @@ namespace osu.Game.Skinning.Editor
SelectedComponents.Clear(); SelectedComponents.Clear();
// Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target.
content?.Clear();
Scheduler.AddOnce(loadBlueprintContainer); Scheduler.AddOnce(loadBlueprintContainer);
Scheduler.AddOnce(populateSettings); Scheduler.AddOnce(populateSettings);

View File

@ -443,9 +443,7 @@ namespace osu.Game.Skinning
string lookupName = name.Replace(@"@2x", string.Empty); string lookupName = name.Replace(@"@2x", string.Empty);
float ratio = 2; float ratio = 2;
string twoTimesFilename = Path.HasExtension(lookupName) string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}";
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
: @$"{lookupName}@2x";
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT); var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);