1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 10:47:28 +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>
<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>

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
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>
<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>

View File

@ -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>

View File

@ -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))]

View File

@ -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,

View File

@ -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>

View File

@ -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))

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]
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);
}
}

View File

@ -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)

View File

@ -21,21 +21,20 @@ namespace osu.Game.Skinning.Editor
private readonly List<BindableList<ISkinnableDrawable>> targetComponents = new List<BindableList<ISkinnableDrawable>>();
[Resolved]
private SkinEditor editor { get; set; }
public SkinBlueprintContainer(Drawable target)
{
this.target = target;
}
[BackgroundDependencyLoader(true)]
private void load(SkinEditor editor)
{
SelectedItems.BindTo(editor.SelectedComponents);
}
protected override void LoadComplete()
{
base.LoadComplete();
SelectedItems.BindTo(editor.SelectedComponents);
// track each target container on the current screen.
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)
{
@ -79,7 +78,7 @@ namespace osu.Game.Skinning.Editor
AddBlueprintFor(item);
break;
}
}
});
protected override void AddBlueprintFor(ISkinnableDrawable item)
{
@ -93,5 +92,13 @@ namespace osu.Game.Skinning.Editor
protected override SelectionBlueprint<ISkinnableDrawable> CreateBlueprintFor(ISkinnableDrawable 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();
// 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(populateSettings);

View File

@ -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);