From c1077d909ca5e41270522714e8457733a36043f2 Mon Sep 17 00:00:00 2001 From: Ryuki Date: Sat, 17 Sep 2022 21:09:34 +0200 Subject: [PATCH 01/48] Basic avatar HUD implementation --- osu.Game/Screens/Play/HUD/SkinnableAvatar.cs | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 osu.Game/Screens/Play/HUD/SkinnableAvatar.cs diff --git a/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs b/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs new file mode 100644 index 0000000000..abec4402a7 --- /dev/null +++ b/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs @@ -0,0 +1,50 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Configuration; +using osu.Game.Skinning; +using osu.Game.Users.Drawables; +using osuTK; + +namespace osu.Game.Screens.Play.HUD +{ + public class SkinnableAvatar : CompositeDrawable, ISkinnableDrawable + { + [SettingSource("Corner radius", "How much the edges should be rounded.")] + public new BindableFloat CornerRadius { get; set; } = new BindableFloat(0) + { + MinValue = 0, + MaxValue = 100, + Precision = 0.01f + }; + + [Resolved] + private GameplayState gameplayState { get; set; } = null!; + + private readonly UpdateableAvatar avatar; + + public SkinnableAvatar() + { + Size = new Vector2(128f); + InternalChild = avatar = new UpdateableAvatar(isInteractive: false) + { + RelativeSizeAxes = Axes.Both, + Masking = true + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + avatar.User = gameplayState.Score.ScoreInfo.User; + CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue); + } + + public bool UsesFixedAnchor { get; set; } + } +} From ecf71df8a23bfca5cbe5a78daef23908135d92c2 Mon Sep 17 00:00:00 2001 From: Ryuki Date: Sun, 18 Sep 2022 00:04:56 +0200 Subject: [PATCH 02/48] Change CornerRadius Max Value --- osu.Game/Screens/Play/HUD/SkinnableAvatar.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs b/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs index abec4402a7..d675176a0a 100644 --- a/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs +++ b/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs @@ -15,10 +15,10 @@ namespace osu.Game.Screens.Play.HUD public class SkinnableAvatar : CompositeDrawable, ISkinnableDrawable { [SettingSource("Corner radius", "How much the edges should be rounded.")] - public new BindableFloat CornerRadius { get; set; } = new BindableFloat(0) + public new BindableFloat CornerRadius { get; set; } = new BindableFloat { MinValue = 0, - MaxValue = 100, + MaxValue = 63, Precision = 0.01f }; From fc3d74472cc52b6e06cd1c0791f7277d7ed77744 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 21 Feb 2023 15:55:46 +0300 Subject: [PATCH 03/48] Add mobile local framework reference support --- UseLocalFramework.ps1 | 48 ++++++++++++++++++++++++++++++++++++++----- UseLocalFramework.sh | 39 +++++++++++++++++++++++++++++------ 2 files changed, 76 insertions(+), 11 deletions(-) diff --git a/UseLocalFramework.ps1 b/UseLocalFramework.ps1 index 837685f310..9f4547d980 100644 --- a/UseLocalFramework.ps1 +++ b/UseLocalFramework.ps1 @@ -3,15 +3,53 @@ # # https://github.com/ppy/osu-framework/wiki/Testing-local-framework-checkout-with-other-projects -$CSPROJ="osu.Game/osu.Game.csproj" +$GAME_CSPROJ="osu.Game/osu.Game.csproj" +$ANDROID_PROPS="osu.Android.props" +$IOS_PROPS="osu.iOS.props" $SLN="osu.sln" -dotnet remove $CSPROJ package ppy.osu.Framework; -dotnet sln $SLN add ../osu-framework/osu.Framework/osu.Framework.csproj ../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj; -dotnet add $CSPROJ reference ../osu-framework/osu.Framework/osu.Framework.csproj +dotnet remove $GAME_CSPROJ reference ppy.osu.Framework; +dotnet remove $ANDROID_PROPS reference ppy.osu.Framework.Android; +dotnet remove $IOS_PROPS reference ppy.osu.Framework.iOS; + +dotnet sln $SLN add ../osu-framework/osu.Framework/osu.Framework.csproj ` + ../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj ` + ../osu-framework/osu.Framework.Android/osu.Framework.Android.csproj ` + ../osu-framework/osu.Framework.iOS/osu.Framework.iOS.csproj; + +dotnet add $GAME_CSPROJ reference ../osu-framework/osu.Framework/osu.Framework.csproj; +dotnet add $ANDROID_PROPS reference ../osu-framework/osu.Framework.Android/osu.Framework.Android.csproj; +dotnet add $IOS_PROPS reference ../osu-framework/osu.Framework.iOS/osu.Framework.iOS.csproj; + +# workaround for dotnet add not inserting $(MSBuildThisFileDirectory) on props files +(Get-Content "osu.Android.props") -replace "`"..\\osu-framework", "`"`$(MSBuildThisFileDirectory)..\osu-framework" | Set-Content "osu.Android.props" +(Get-Content "osu.iOS.props") -replace "`"..\\osu-framework", "`"`$(MSBuildThisFileDirectory)..\osu-framework" | Set-Content "osu.iOS.props" + +# needed because iOS framework nupkg includes a set of properties to work around certain issues during building, +# and those get ignored when referencing framework via project, threfore we have to manually include it via props reference. +(Get-Content "osu.iOS.props") | + Foreach-Object { + if ($_ -match "") + { + " " + } + + $_ + } | Set-Content "osu.iOS.props" + +$TMP=New-TemporaryFile $SLNF=Get-Content "osu.Desktop.slnf" | ConvertFrom-Json -$TMP=New-TemporaryFile $SLNF.solution.projects += ("../osu-framework/osu.Framework/osu.Framework.csproj", "../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj") ConvertTo-Json $SLNF | Out-File $TMP -Encoding UTF8 Move-Item -Path $TMP -Destination "osu.Desktop.slnf" -Force + +$SLNF=Get-Content "osu.Android.slnf" | ConvertFrom-Json +$SLNF.solution.projects += ("../osu-framework/osu.Framework/osu.Framework.csproj", "../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj", "../osu-framework/osu.Framework.Android/osu.Framework.Android.csproj") +ConvertTo-Json $SLNF | Out-File $TMP -Encoding UTF8 +Move-Item -Path $TMP -Destination "osu.Android.slnf" -Force + +$SLNF=Get-Content "osu.iOS.slnf" | ConvertFrom-Json +$SLNF.solution.projects += ("../osu-framework/osu.Framework/osu.Framework.csproj", "../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj", "../osu-framework/osu.Framework.iOS/osu.Framework.iOS.csproj") +ConvertTo-Json $SLNF | Out-File $TMP -Encoding UTF8 +Move-Item -Path $TMP -Destination "osu.iOS.slnf" -Force diff --git a/UseLocalFramework.sh b/UseLocalFramework.sh index 4fd1fdfd1b..c12b388e96 100755 --- a/UseLocalFramework.sh +++ b/UseLocalFramework.sh @@ -5,14 +5,41 @@ # # https://github.com/ppy/osu-framework/wiki/Testing-local-framework-checkout-with-other-projects -CSPROJ="osu.Game/osu.Game.csproj" +GAME_CSPROJ="osu.Game/osu.Game.csproj" +ANDROID_PROPS="osu.Android.props" +IOS_PROPS="osu.iOS.props" SLN="osu.sln" -dotnet remove $CSPROJ package ppy.osu.Framework -dotnet sln $SLN add ../osu-framework/osu.Framework/osu.Framework.csproj ../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj -dotnet add $CSPROJ reference ../osu-framework/osu.Framework/osu.Framework.csproj +dotnet remove $GAME_CSPROJ reference ppy.osu.Framework +dotnet remove $ANDROID_PROPS reference ppy.osu.Framework.Android +dotnet remove $IOS_PROPS reference ppy.osu.Framework.iOS + +dotnet sln $SLN add ../osu-framework/osu.Framework/osu.Framework.csproj \ + ../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj \ + ../osu-framework/osu.Framework.Android/osu.Framework.Android.csproj \ + ../osu-framework/osu.Framework.iOS/osu.Framework.iOS.csproj + +dotnet add $GAME_CSPROJ reference ../osu-framework/osu.Framework/osu.Framework.csproj +dotnet add $ANDROID_PROPS reference ../osu-framework/osu.Framework.Android/osu.Framework.Android.csproj +dotnet add $IOS_PROPS reference ../osu-framework/osu.Framework.iOS/osu.Framework.iOS.csproj + +# workaround for dotnet add not inserting $(MSBuildThisFileDirectory) on props files +sed -i.bak 's:"..\\osu-framework:"$(MSBuildThisFileDirectory)..\\osu-framework:g' ./osu.Android.props && rm osu.Android.props.bak +sed -i.bak 's:"..\\osu-framework:"$(MSBuildThisFileDirectory)..\\osu-framework:g' ./osu.iOS.props && rm osu.iOS.props.bak + +# needed because iOS framework nupkg includes a set of properties to work around certain issues during building, +# and those get ignored when referencing framework via project, threfore we have to manually include it via props reference. +sed -i.bak '/<\/Project>/i\ + \ +' ./osu.iOS.props && rm osu.iOS.props.bak -SLNF="osu.Desktop.slnf" tmp=$(mktemp) + jq '.solution.projects += ["../osu-framework/osu.Framework/osu.Framework.csproj", "../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj"]' osu.Desktop.slnf > $tmp -mv -f $tmp $SLNF +mv -f $tmp osu.Desktop.slnf + +jq '.solution.projects += ["../osu-framework/osu.Framework/osu.Framework.csproj", "../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj", "../osu-framework/osu.Framework.Android/osu.Framework.Android.csproj"]' osu.Android.slnf > $tmp +mv -f $tmp osu.Android.slnf + +jq '.solution.projects += ["../osu-framework/osu.Framework/osu.Framework.csproj", "../osu-framework/osu.Framework.NativeLibs/osu.Framework.NativeLibs.csproj", "../osu-framework/osu.Framework.iOS/osu.Framework.iOS.csproj"]' osu.iOS.slnf > $tmp +mv -f $tmp osu.iOS.slnf From 16c8a392a1c7c73d0aeae9aa02edcd1a6e4d2f7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Feb 2023 17:45:38 +0900 Subject: [PATCH 04/48] Add ability to send selected skin components to front or back --- osu.Game/Overlays/SkinEditor/SkinEditor.cs | 37 ++++++++++++++++++- .../SkinEditor/SkinSelectionHandler.cs | 9 +++++ .../ISerialisableDrawableContainer.cs | 3 +- osu.Game/Skinning/SkinComponentsContainer.cs | 4 +- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs index 9d470f58f1..95b88b141f 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs @@ -556,11 +556,46 @@ namespace osu.Game.Overlays.SkinEditor changeHandler?.BeginChange(); foreach (var item in items) - availableTargets.FirstOrDefault(t => t.Components.Contains(item))?.Remove(item); + availableTargets.FirstOrDefault(t => t.Components.Contains(item))?.Remove(item, true); changeHandler?.EndChange(); } + public void BringSelectionToFront() + { + if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target) + return; + + // Iterating by target components order ensures we maintain the same order across selected components, regardless + // of the order they were selected in. + foreach (var d in target.Components.ToArray()) + { + if (!SelectedComponents.Contains(d)) + continue; + + target.Remove(d, false); + + // Selection would be reset by the remove. + SelectedComponents.Add(d); + target.Add(d); + } + } + + public void SendSelectionToBack() + { + if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target) + return; + + foreach (var d in target.Components.ToArray()) + { + if (SelectedComponents.Contains(d)) + continue; + + target.Remove(d, false); + target.Add(d); + } + } + #region Drag & drop import handling public Task Import(params string[] paths) diff --git a/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs b/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs index c628ad8480..b43f4eeb00 100644 --- a/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs +++ b/osu.Game/Overlays/SkinEditor/SkinSelectionHandler.cs @@ -13,6 +13,7 @@ using osu.Framework.Utils; using osu.Game.Extensions; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Edit; +using osu.Game.Screens.Edit.Components.Menus; using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Skinning; using osuTK; @@ -206,6 +207,14 @@ namespace osu.Game.Overlays.SkinEditor ((Drawable)blueprint.Item).Position = Vector2.Zero; }); + yield return new EditorMenuItemSpacer(); + + yield return new OsuMenuItem("Bring to front", MenuItemType.Standard, () => skinEditor.BringSelectionToFront()); + + yield return new OsuMenuItem("Send to back", MenuItemType.Standard, () => skinEditor.SendSelectionToBack()); + + yield return new EditorMenuItemSpacer(); + foreach (var item in base.GetContextMenuItemsForSelection(selection)) yield return item; diff --git a/osu.Game/Skinning/ISerialisableDrawableContainer.cs b/osu.Game/Skinning/ISerialisableDrawableContainer.cs index 9f93d8a2e3..a19c8c5162 100644 --- a/osu.Game/Skinning/ISerialisableDrawableContainer.cs +++ b/osu.Game/Skinning/ISerialisableDrawableContainer.cs @@ -45,6 +45,7 @@ namespace osu.Game.Skinning /// Remove an existing skinnable component from this target. /// /// The component to remove. - void Remove(ISerialisableDrawable component); + /// Whether removed items should be immediately disposed. + void Remove(ISerialisableDrawable component, bool disposeImmediately); } } diff --git a/osu.Game/Skinning/SkinComponentsContainer.cs b/osu.Game/Skinning/SkinComponentsContainer.cs index d18e9023cd..adf0a288b4 100644 --- a/osu.Game/Skinning/SkinComponentsContainer.cs +++ b/osu.Game/Skinning/SkinComponentsContainer.cs @@ -100,7 +100,7 @@ namespace osu.Game.Skinning /// /// Thrown when attempting to add an element to a target which is not supported by the current skin. /// Thrown if the provided instance is not a . - public void Remove(ISerialisableDrawable component) + public void Remove(ISerialisableDrawable component, bool disposeImmediately) { if (content == null) throw new NotSupportedException("Attempting to remove a new component from a target container which is not supported by the current skin."); @@ -108,7 +108,7 @@ namespace osu.Game.Skinning if (!(component is Drawable drawable)) throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component)); - content.Remove(drawable, true); + content.Remove(drawable, disposeImmediately); components.Remove(component); } From 90ca635a1771d9953f3891656296b7b7d98dda84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Feb 2023 17:56:59 +0900 Subject: [PATCH 05/48] Fix weird nullability in `TestSceneSkinEditor` --- .../Visual/Gameplay/TestSceneSkinEditor.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs index 2f20d75813..83609b9ae7 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs @@ -4,6 +4,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; @@ -21,7 +22,7 @@ namespace osu.Game.Tests.Visual.Gameplay { public partial class TestSceneSkinEditor : PlayerTestScene { - private SkinEditor? skinEditor; + private SkinEditor skinEditor = null!; protected override bool Autoplay => true; @@ -40,17 +41,18 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("reload skin editor", () => { - skinEditor?.Expire(); + if (skinEditor.IsNotNull()) + skinEditor.Expire(); Player.ScaleTo(0.4f); LoadComponentAsync(skinEditor = new SkinEditor(Player), Add); }); - AddUntilStep("wait for loaded", () => skinEditor!.IsLoaded); + AddUntilStep("wait for loaded", () => skinEditor.IsLoaded); } [Test] public void TestToggleEditor() { - AddToggleStep("toggle editor visibility", _ => skinEditor!.ToggleVisibility()); + AddToggleStep("toggle editor visibility", _ => skinEditor.ToggleVisibility()); } [Test] @@ -63,7 +65,7 @@ namespace osu.Game.Tests.Visual.Gameplay var blueprint = skinEditor.ChildrenOfType().First(b => b.Item is BarHitErrorMeter); hitErrorMeter = (BarHitErrorMeter)blueprint.Item; - skinEditor!.SelectedComponents.Clear(); + skinEditor.SelectedComponents.Clear(); skinEditor.SelectedComponents.Add(blueprint.Item); }); From 32a9c066dfd2a02c0cc40f5554417ab5bd8e8c97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Feb 2023 18:17:03 +0900 Subject: [PATCH 06/48] Add test coverage of bring-to-front / send-to-back operations --- .../Visual/Gameplay/TestSceneSkinEditor.cs | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs index 83609b9ae7..9690d00d4c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -32,12 +33,14 @@ namespace osu.Game.Tests.Visual.Gameplay [Cached] public readonly EditorClipboard Clipboard = new EditorClipboard(); + private SkinComponentsContainer targetContainer => Player.ChildrenOfType().First(); + [SetUpSteps] public override void SetUpSteps() { base.SetUpSteps(); - AddUntilStep("wait for hud load", () => Player.ChildrenOfType().All(c => c.ComponentsLoaded)); + AddUntilStep("wait for hud load", () => targetContainer.ComponentsLoaded); AddStep("reload skin editor", () => { @@ -49,6 +52,52 @@ namespace osu.Game.Tests.Visual.Gameplay AddUntilStep("wait for loaded", () => skinEditor.IsLoaded); } + [TestCase(false)] + [TestCase(true)] + public void TestBringToFront(bool alterSelectionOrder) + { + AddAssert("Ensure over three components available", () => targetContainer.Components.Count, () => Is.GreaterThan(3)); + + IEnumerable originalOrder = null!; + + AddStep("Save order of components before operation", () => originalOrder = targetContainer.Components.Take(3).ToArray()); + + if (alterSelectionOrder) + AddStep("Select first three components in reverse order", () => skinEditor.SelectedComponents.AddRange(originalOrder.Reverse())); + else + AddStep("Select first three components", () => skinEditor.SelectedComponents.AddRange(originalOrder)); + + AddAssert("Components are not front-most", () => targetContainer.Components.TakeLast(3).ToArray(), () => Is.Not.EqualTo(skinEditor.SelectedComponents)); + + AddStep("Bring to front", () => skinEditor.BringSelectionToFront()); + AddAssert("Ensure components are now front-most in original order", () => targetContainer.Components.TakeLast(3).ToArray(), () => Is.EqualTo(originalOrder)); + AddStep("Bring to front again", () => skinEditor.BringSelectionToFront()); + AddAssert("Ensure components are still front-most in original order", () => targetContainer.Components.TakeLast(3).ToArray(), () => Is.EqualTo(originalOrder)); + } + + [TestCase(false)] + [TestCase(true)] + public void TestSendToBack(bool alterSelectionOrder) + { + AddAssert("Ensure over three components available", () => targetContainer.Components.Count, () => Is.GreaterThan(3)); + + IEnumerable originalOrder = null!; + + AddStep("Save order of components before operation", () => originalOrder = targetContainer.Components.TakeLast(3).ToArray()); + + if (alterSelectionOrder) + AddStep("Select last three components in reverse order", () => skinEditor.SelectedComponents.AddRange(originalOrder.Reverse())); + else + AddStep("Select last three components", () => skinEditor.SelectedComponents.AddRange(originalOrder)); + + AddAssert("Components are not back-most", () => targetContainer.Components.Take(3).ToArray(), () => Is.Not.EqualTo(skinEditor.SelectedComponents)); + + AddStep("Send to back", () => skinEditor.SendSelectionToBack()); + AddAssert("Ensure components are now back-most in original order", () => targetContainer.Components.Take(3).ToArray(), () => Is.EqualTo(originalOrder)); + AddStep("Send to back again", () => skinEditor.SendSelectionToBack()); + AddAssert("Ensure components are still back-most in original order", () => targetContainer.Components.Take(3).ToArray(), () => Is.EqualTo(originalOrder)); + } + [Test] public void TestToggleEditor() { From c48aceb055433f57bd00d885691d8a61e8317460 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Feb 2023 20:03:36 +0900 Subject: [PATCH 07/48] Fix undo history not being batched correctly for depth change operations --- osu.Game/Overlays/SkinEditor/SkinEditor.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs index 95b88b141f..02ede8c08b 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs @@ -566,6 +566,8 @@ namespace osu.Game.Overlays.SkinEditor if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target) return; + changeHandler?.BeginChange(); + // Iterating by target components order ensures we maintain the same order across selected components, regardless // of the order they were selected in. foreach (var d in target.Components.ToArray()) @@ -579,6 +581,8 @@ namespace osu.Game.Overlays.SkinEditor SelectedComponents.Add(d); target.Add(d); } + + changeHandler?.EndChange(); } public void SendSelectionToBack() @@ -586,6 +590,8 @@ namespace osu.Game.Overlays.SkinEditor if (getTarget(selectedTarget.Value) is not SkinComponentsContainer target) return; + changeHandler?.BeginChange(); + foreach (var d in target.Components.ToArray()) { if (SelectedComponents.Contains(d)) @@ -594,6 +600,8 @@ namespace osu.Game.Overlays.SkinEditor target.Remove(d, false); target.Add(d); } + + changeHandler?.EndChange(); } #region Drag & drop import handling From dc3c1150b8401b4f4d49b1ecb6c8ba30663fe217 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Feb 2023 21:10:15 +0900 Subject: [PATCH 08/48] Set better defaults for `SkinBlueprint` transforms --- osu.Game/Overlays/SkinEditor/SkinBlueprint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs b/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs index 034ca11c5c..c090878899 100644 --- a/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs +++ b/osu.Game/Overlays/SkinEditor/SkinBlueprint.cs @@ -82,6 +82,7 @@ namespace osu.Game.Overlays.SkinEditor { Text = Item.GetType().Name, Font = OsuFont.Default.With(size: 10, weight: FontWeight.Bold), + Alpha = 0, Anchor = Anchor.BottomRight, Origin = Anchor.TopRight, }, @@ -99,7 +100,6 @@ namespace osu.Game.Overlays.SkinEditor base.LoadComplete(); updateSelectedState(); - this.FadeInFromZero(200, Easing.OutQuint); } protected override bool OnHover(HoverEvent e) From d98d330da20e2bced3a4d753f40c6a50f614f926 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 26 Feb 2023 14:30:46 -0800 Subject: [PATCH 09/48] Add expected behavior test for scroll back to previous position --- .../TestSceneOverlayScrollContainer.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs index 926bc01aea..ade950e2d5 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs @@ -61,6 +61,18 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("scroll to 500", () => scroll.ScrollTo(500)); AddUntilStep("scrolled to 500", () => Precision.AlmostEquals(scroll.Current, 500, 0.1f)); AddAssert("button is visible", () => scroll.Button.State == Visibility.Visible); + + AddStep("click button", () => + { + InputManager.MoveMouseTo(scroll.Button); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("button is visible", () => scroll.Button.State == Visibility.Visible); + + AddStep("user scroll down by 1", () => InputManager.ScrollVerticalBy(-1)); + + AddAssert("button is hidden", () => scroll.Button.State == Visibility.Hidden); } [Test] @@ -71,6 +83,10 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("invoke action", () => scroll.Button.Action.Invoke()); AddUntilStep("scrolled back to start", () => Precision.AlmostEquals(scroll.Current, 0, 0.1f)); + + AddStep("invoke action", () => scroll.Button.Action.Invoke()); + + AddAssert("scrolled to end", () => scroll.IsScrolledToEnd()); } [Test] @@ -85,6 +101,14 @@ namespace osu.Game.Tests.Visual.UserInterface }); AddUntilStep("scrolled back to start", () => Precision.AlmostEquals(scroll.Current, 0, 0.1f)); + + AddStep("click button", () => + { + InputManager.MoveMouseTo(scroll.Button); + InputManager.Click(MouseButton.Left); + }); + + AddAssert("scrolled to end", () => scroll.IsScrolledToEnd()); } [Test] @@ -97,7 +121,7 @@ namespace osu.Game.Tests.Visual.UserInterface AddStep("hover button", () => InputManager.MoveMouseTo(scroll.Button)); AddRepeatStep("click button", () => InputManager.Click(MouseButton.Left), 3); - AddAssert("invocation count is 1", () => invocationCount == 1); + AddAssert("invocation count is 3", () => invocationCount == 3); } private partial class TestScrollContainer : OverlayScrollContainer From dc00905f8df0b24f974315a7efdac099373f09eb Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 26 Feb 2023 14:38:51 -0800 Subject: [PATCH 10/48] Add ability to scroll back to previous position after scrolling to top via button on overlays --- osu.Game/Overlays/OverlayScrollContainer.cs | 50 +++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/OverlayScrollContainer.cs b/osu.Game/Overlays/OverlayScrollContainer.cs index 5bd7f014a9..8176ddb370 100644 --- a/osu.Game/Overlays/OverlayScrollContainer.cs +++ b/osu.Game/Overlays/OverlayScrollContainer.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -30,16 +31,20 @@ namespace osu.Game.Overlays /// private const int button_scroll_position = 200; - protected readonly ScrollToTopButton Button; + protected ScrollToTopButton Button; - public OverlayScrollContainer() + private readonly Bindable lastScrollTarget = new Bindable(); + + [BackgroundDependencyLoader] + private void load() { AddInternal(Button = new ScrollToTopButton { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(20), - Action = scrollToTop + Action = scrollBack, + LastScrollTarget = { BindTarget = lastScrollTarget } }); } @@ -53,13 +58,28 @@ namespace osu.Game.Overlays return; } - Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden; + Button.State = Target > button_scroll_position || lastScrollTarget.Value != null ? Visibility.Visible : Visibility.Hidden; } - private void scrollToTop() + protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default) { - ScrollToStart(); - Button.State = Visibility.Hidden; + base.OnUserScroll(value, animated, distanceDecay); + + lastScrollTarget.Value = null; + } + + private void scrollBack() + { + if (lastScrollTarget.Value == null) + { + lastScrollTarget.Value = Target; + ScrollToStart(); + } + else + { + ScrollTo(lastScrollTarget.Value.Value); + lastScrollTarget.Value = null; + } } public partial class ScrollToTopButton : OsuHoverContainer @@ -88,6 +108,9 @@ namespace osu.Game.Overlays private readonly Container content; private readonly Box background; + private readonly SpriteIcon spriteIcon; + + public Bindable LastScrollTarget = new Bindable(); public ScrollToTopButton() : base(HoverSampleSet.ScrollToTop) @@ -113,7 +136,7 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.Both }, - new SpriteIcon + spriteIcon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -134,6 +157,17 @@ namespace osu.Game.Overlays flashColour = colourProvider.Light1; } + protected override void LoadComplete() + { + base.LoadComplete(); + + LastScrollTarget.BindValueChanged(target => + { + spriteIcon.RotateTo(target.NewValue != null ? 180 : 0, fade_duration, Easing.OutQuint); + TooltipText = target.NewValue != null ? CommonStrings.ButtonsBackToPrevious : CommonStrings.ButtonsBackToTop; + }, true); + } + protected override bool OnClick(ClickEvent e) { background.FlashColour(flashColour, 800, Easing.OutQuint); From fa710ae1b00dd9f618e481271b25aa2df5d558a4 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 26 Feb 2023 14:39:34 -0800 Subject: [PATCH 11/48] Rename `ScrollToTopButton` to `ScrollBackButton` --- .../UserInterface/TestSceneOverlayScrollContainer.cs | 2 +- osu.Game/Overlays/OverlayScrollContainer.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs index ade950e2d5..77e7178c9e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOverlayScrollContainer.cs @@ -126,7 +126,7 @@ namespace osu.Game.Tests.Visual.UserInterface private partial class TestScrollContainer : OverlayScrollContainer { - public new ScrollToTopButton Button => base.Button; + public new ScrollBackButton Button => base.Button; } } } diff --git a/osu.Game/Overlays/OverlayScrollContainer.cs b/osu.Game/Overlays/OverlayScrollContainer.cs index 8176ddb370..9752e04f44 100644 --- a/osu.Game/Overlays/OverlayScrollContainer.cs +++ b/osu.Game/Overlays/OverlayScrollContainer.cs @@ -22,23 +22,23 @@ using osuTK.Graphics; namespace osu.Game.Overlays { /// - /// which provides . Mostly used in . + /// which provides . Mostly used in . /// public partial class OverlayScrollContainer : UserTrackingScrollContainer { /// - /// Scroll position at which the will be shown. + /// Scroll position at which the will be shown. /// private const int button_scroll_position = 200; - protected ScrollToTopButton Button; + protected ScrollBackButton Button; private readonly Bindable lastScrollTarget = new Bindable(); [BackgroundDependencyLoader] private void load() { - AddInternal(Button = new ScrollToTopButton + AddInternal(Button = new ScrollBackButton { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, @@ -82,7 +82,7 @@ namespace osu.Game.Overlays } } - public partial class ScrollToTopButton : OsuHoverContainer + public partial class ScrollBackButton : OsuHoverContainer { private const int fade_duration = 500; @@ -112,7 +112,7 @@ namespace osu.Game.Overlays public Bindable LastScrollTarget = new Bindable(); - public ScrollToTopButton() + public ScrollBackButton() : base(HoverSampleSet.ScrollToTop) { Size = new Vector2(50); From 8d747f240220e98cb40a9edd567f6778c31115e0 Mon Sep 17 00:00:00 2001 From: OpenSauce <48618519+OpenSauce04@users.noreply.github.com> Date: Mon, 27 Feb 2023 16:06:33 +0000 Subject: [PATCH 12/48] Fixed grammar mistake in Taiko Relax mod description --- osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs index d1e9ab1428..69a98f8372 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModRelax.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Taiko.Mods { public class TaikoModRelax : ModRelax { - public override LocalisableString Description => @"No ninja-like spinners, demanding drumrolls or unexpected katu's."; + public override LocalisableString Description => @"No ninja-like spinners, demanding drumrolls or unexpected katus."; } } From 2615453b3143e59886a56adb2f5d835a241a2a5d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Feb 2023 11:45:32 +0900 Subject: [PATCH 13/48] Rename `SettingSource` tests to match attribute name --- ...ingsSourceAttributeTest.cs => SettingSourceAttributeTest.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename osu.Game.Tests/Mods/{SettingsSourceAttributeTest.cs => SettingSourceAttributeTest.cs} (98%) diff --git a/osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs b/osu.Game.Tests/Mods/SettingSourceAttributeTest.cs similarity index 98% rename from osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs rename to osu.Game.Tests/Mods/SettingSourceAttributeTest.cs index bf59862787..5da303d3a7 100644 --- a/osu.Game.Tests/Mods/SettingsSourceAttributeTest.cs +++ b/osu.Game.Tests/Mods/SettingSourceAttributeTest.cs @@ -12,7 +12,7 @@ using osu.Game.Overlays.Settings; namespace osu.Game.Tests.Mods { [TestFixture] - public partial class SettingsSourceAttributeTest + public partial class SettingSourceAttributeTest { [Test] public void TestOrdering() From bd1460a8d5726a67acfdfbfb08568b872fcc8d83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Feb 2023 14:32:58 +0900 Subject: [PATCH 14/48] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 4bdf5d68c5..abd8406cf7 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -10,7 +10,7 @@ true - + true true + manifestmerger.jar + + + diff --git a/osu.Android/AndroidManifest.xml b/osu.Android/AndroidManifest.xml index 9ea57969b7..bc2f49b1a9 100644 --- a/osu.Android/AndroidManifest.xml +++ b/osu.Android/AndroidManifest.xml @@ -2,16 +2,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Android/Properties/AndroidManifestOverlay.xml b/osu.Android/Properties/AndroidManifestOverlay.xml new file mode 100644 index 0000000000..815f935383 --- /dev/null +++ b/osu.Android/Properties/AndroidManifestOverlay.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Game.Rulesets.Catch.Tests.Android/AndroidManifest.xml b/osu.Game.Rulesets.Catch.Tests.Android/AndroidManifest.xml index 22b4ea9191..bf7c0bfeca 100644 --- a/osu.Game.Rulesets.Catch.Tests.Android/AndroidManifest.xml +++ b/osu.Game.Rulesets.Catch.Tests.Android/AndroidManifest.xml @@ -3,16 +3,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania.Tests.Android/AndroidManifest.xml b/osu.Game.Rulesets.Mania.Tests.Android/AndroidManifest.xml index c8b0de9f42..4a1545a423 100644 --- a/osu.Game.Rulesets.Mania.Tests.Android/AndroidManifest.xml +++ b/osu.Game.Rulesets.Mania.Tests.Android/AndroidManifest.xml @@ -2,16 +2,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu.Tests.Android/AndroidManifest.xml b/osu.Game.Rulesets.Osu.Tests.Android/AndroidManifest.xml index d91fc062fe..45d27dda70 100644 --- a/osu.Game.Rulesets.Osu.Tests.Android/AndroidManifest.xml +++ b/osu.Game.Rulesets.Osu.Tests.Android/AndroidManifest.xml @@ -2,16 +2,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko.Tests.Android/AndroidManifest.xml b/osu.Game.Rulesets.Taiko.Tests.Android/AndroidManifest.xml index f678d63dbb..452b9683ec 100644 --- a/osu.Game.Rulesets.Taiko.Tests.Android/AndroidManifest.xml +++ b/osu.Game.Rulesets.Taiko.Tests.Android/AndroidManifest.xml @@ -2,16 +2,4 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/osu.Game.Tests.Android/AndroidManifest.xml b/osu.Game.Tests.Android/AndroidManifest.xml index 105f2b1e8b..f25b2e5328 100644 --- a/osu.Game.Tests.Android/AndroidManifest.xml +++ b/osu.Game.Tests.Android/AndroidManifest.xml @@ -2,16 +2,4 @@ - - - - - - - - - - - - \ No newline at end of file From 082bfe3621f8502b81376f5a92e031cf3c7d4803 Mon Sep 17 00:00:00 2001 From: tsrk Date: Sun, 5 Mar 2023 23:09:02 +0000 Subject: [PATCH 34/48] refactor: `SkinnableAvatar` to `PlayerAvatar` --- .../Screens/Play/HUD/{SkinnableAvatar.cs => PlayerAvatar.cs} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename osu.Game/Screens/Play/HUD/{SkinnableAvatar.cs => PlayerAvatar.cs} (92%) diff --git a/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs similarity index 92% rename from osu.Game/Screens/Play/HUD/SkinnableAvatar.cs rename to osu.Game/Screens/Play/HUD/PlayerAvatar.cs index 41fe8c6a06..d4ab555d04 100644 --- a/osu.Game/Screens/Play/HUD/SkinnableAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -12,7 +12,7 @@ using osuTK; namespace osu.Game.Screens.Play.HUD { - public partial class SkinnableAvatar : CompositeDrawable, ISerialisableDrawable + public partial class PlayerAvatar : CompositeDrawable, ISerialisableDrawable { [SettingSource("Corner radius", "How much the edges should be rounded.")] public new BindableFloat CornerRadius { get; set; } = new BindableFloat @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.HUD private readonly UpdateableAvatar avatar; - public SkinnableAvatar() + public PlayerAvatar() { Size = new Vector2(128f); InternalChild = avatar = new UpdateableAvatar(isInteractive: false) From 654eacd4496cde2601015abc053d8d081f25869d Mon Sep 17 00:00:00 2001 From: tsrk Date: Sun, 5 Mar 2023 23:10:42 +0000 Subject: [PATCH 35/48] feat(l10n): localise `CornerRadius` --- .../SkinComponents/SkinnableComponentStrings.cs | 10 ++++++++++ osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs index 547df86fc7..5cec9442e4 100644 --- a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs +++ b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs @@ -39,6 +39,16 @@ namespace osu.Game.Localisation.SkinComponents /// public static LocalisableString TextElementTextDescription => new TranslatableString(getKey(@"text_element_text_description"), "The text to be displayed."); + /// + /// "Corner Radius" + /// + public static LocalisableString CornerRadius => new TranslatableString(getKey(@"corner_radius"), "Corner Radius"); + + /// + /// "How rounded the corners should be." + /// + public static LocalisableString CornerRadiusDescription => new TranslatableString(getKey(@"corner_radius_description"), "How rounded the corners should be."); + private static string getKey(string key) => $"{prefix}:{key}"; } } diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index d4ab555d04..6cea463193 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; +using osu.Game.Localisation.SkinComponents; using osu.Game.Skinning; using osu.Game.Users.Drawables; using osuTK; @@ -14,7 +15,7 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerAvatar : CompositeDrawable, ISerialisableDrawable { - [SettingSource("Corner radius", "How much the edges should be rounded.")] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.CornerRadius), nameof(SkinnableComponentStrings.CornerRadiusDescription))] public new BindableFloat CornerRadius { get; set; } = new BindableFloat { MinValue = 0, From 20a610ea6c4c407cedcdffc8a9ac3ae0fbd1f8b0 Mon Sep 17 00:00:00 2001 From: tsrk Date: Sun, 5 Mar 2023 23:15:58 +0000 Subject: [PATCH 36/48] style: a NRT pass on `UpdateableFlag` --- osu.Game/Users/Drawables/UpdateableFlag.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs index a208f3c7c4..8f8d7052e5 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -30,14 +28,14 @@ namespace osu.Game.Users.Drawables /// Perform an action in addition to showing the country ranking. /// This should be used to perform auxiliary tasks and not as a primary action for clicking a flag (to maintain a consistent UX). /// - public Action Action; + public Action? Action; public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown) { CountryCode = countryCode; } - protected override Drawable CreateDrawable(CountryCode countryCode) + protected override Drawable? CreateDrawable(CountryCode countryCode) { if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown) return null; @@ -56,8 +54,8 @@ namespace osu.Game.Users.Drawables }; } - [Resolved(canBeNull: true)] - private RankingsOverlay rankingsOverlay { get; set; } + [Resolved] + private RankingsOverlay? rankingsOverlay { get; set; } protected override bool OnClick(ClickEvent e) { From 07bde4990d50836a64e62f61a60f991165bb6436 Mon Sep 17 00:00:00 2001 From: tsrk Date: Sun, 5 Mar 2023 23:17:30 +0000 Subject: [PATCH 37/48] feat: implement `PlayerAvatar` --- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 osu.Game/Screens/Play/HUD/PlayerFlag.cs diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs new file mode 100644 index 0000000000..17188d0009 --- /dev/null +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -0,0 +1,38 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Skinning; +using osu.Game.Users.Drawables; +using osuTK; + +namespace osu.Game.Screens.Play.HUD +{ + public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable + { + [Resolved] + private GameplayState gameplayState { get; set; } = null!; + + private readonly UpdateableFlag flag; + + public PlayerFlag() + { + Size = new Vector2(114, 80); + InternalChild = flag = new UpdateableFlag + { + RelativeSizeAxes = Axes.Both, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + flag.CountryCode = gameplayState.Score.ScoreInfo.User.CountryCode; + } + + public bool UsesFixedAnchor { get; set; } + } +} From ddee6400dfa3c28f476e0c9fea11a17874c82257 Mon Sep 17 00:00:00 2001 From: tsrk Date: Sun, 5 Mar 2023 23:46:51 +0000 Subject: [PATCH 38/48] test: add coverage for `Player{Avatar,Flag}` --- .../Archives/modified-argon-20230305.osk | Bin 0 -> 1897 bytes osu.Game.Tests/Skins/SkinDeserialisationTest.cs | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Resources/Archives/modified-argon-20230305.osk diff --git a/osu.Game.Tests/Resources/Archives/modified-argon-20230305.osk b/osu.Game.Tests/Resources/Archives/modified-argon-20230305.osk new file mode 100644 index 0000000000000000000000000000000000000000..c85f3b6352af3357089a797c287659a0d8e848f7 GIT binary patch literal 1897 zcmZ`)2{ha37XJrDwM>j<6dg)aofm6Nl`=@FlHetRpxP!SwNw*ZQW6}y5s4*KF={EH zN^R8^#bCygmIl?)Djh?_UPTSDj7j_Ey*c&X`@VC}J@-4`@1A?V@7~`N?B_rB4NU|rVlAmS1QZ5D)sBQZsC%Y@)DD`?fvQgW%$c95cG#nwX5eaNBy!>}^x zSMnoc3Ae1r;c-(M3B@4=N}}*4N1bz$rM~DOQvG&rj>c9JM;D3N!SAoqeU77@MDnSzO%AM%6NUOL18A1WCPf&1x=^Hr@-YKH;#HEae+Y?K$)9#Y zp;nQ74leahsHb|mF3#Vh5!whYHwEo9pbyiB4LJ|=_WzS(|IFS21k?HUW@x)deu|SE zay7-W`RrQ#+Um2lqAv@=yCBKoklbWQt{}W1+)sdtTOW(bo;~2>!=EPb*$XDIi@-{# zJdTBE@q7q;9w5sc$)t(`K$Q{zC<+5~!21zxU97E0*8@pJ0x>k?Q>067Xwn-aaFkl@ z9*+0=gl%$GFDSe>pM2y|arf9e_DM01wq8$Pm^!<`W^m8^Y2CufVp;Vdp8Vb2E8{mN zZwtncE^kiH6pF`XhGLyWl%Go~&CPFdp0mECH6>MyEWXe-D>w<=HN&b+n zHvTxQ&#A2@r^Q?FE^O+n-!W*D@YYu?FVAORzPojLrfOT|EO}!VJ9mclb(~0#l>XZb z(c4ukV&`+0>4li7y=#00?T+CDS8+PE_$gE_IC#8$Y^|wb)Tlbg4m)q;`(f9V$V8vB(W^<3RQMb^q4L(#q25!yjaJWPgxI?H|lk0dHv z69fR(A^`A(uv;-Cq7Q};K=2Cv)TZPNB(YN;oVan5Dgj;SmGVPav9<4gD884XAvs>8 zYp)cWU}zI{S3OH~UA5KiwxyKpxwm~0duCDLlo4!vSQCT-xC(8*>Fw(iJ434N=Sk_qq46_?0cwbTrb3fm^Ie z_w9``>IV!Cb~kcIe9W1q@W}E(?v0LzBjo0Ex0GAwih;z|%R|JIw ziO2*0f5ZqM^wjSYAg1##)PG2RKXgCg{tfjKe(e9I-~B%Jm%-mY YWDopTQJ|0q#6MmT6Yf=^#(%Q@1WNchY5)KL literal 0 HcmV?d00001 diff --git a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs index 04b8c6dd4e..eb1df954aa 100644 --- a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs +++ b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs @@ -9,6 +9,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; +using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.IO; using osu.Game.IO.Archives; @@ -48,7 +49,9 @@ namespace osu.Game.Tests.Skins // Covers BPM counter. "Archives/modified-default-20221205.osk", // Covers judgement counter. - "Archives/modified-default-20230117.osk" + "Archives/modified-default-20230117.osk", + // Covers player avatar and flag. + "Archives/modified-argon-20230305.osk", }; /// @@ -61,6 +64,8 @@ namespace osu.Game.Tests.Skins foreach (string oskFile in available_skins) { + Logger.Log($"Testing file {oskFile}..."); + using (var stream = TestResources.OpenResource(oskFile)) using (var storage = new ZipArchiveReader(stream)) { From 87d0bef313fc9e5563dc3d368f3daf59b437c6aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 6 Mar 2023 15:16:31 +0900 Subject: [PATCH 39/48] Use nullable comparison helper method instead of manual implementation --- .../Screens/Select/Carousel/CarouselBeatmapSet.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs index 63493a3b02..67822a27ee 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Select.Carousel break; case SortMode.DateRanked: - comparison = compareNullableDateTimeOffset(BeatmapSet.DateRanked, otherSet.BeatmapSet.DateRanked); + comparison = Nullable.Compare(otherSet.BeatmapSet.DateRanked, BeatmapSet.DateRanked); break; case SortMode.LastPlayed: @@ -107,7 +107,7 @@ namespace osu.Game.Screens.Select.Carousel break; case SortMode.DateSubmitted: - comparison = compareNullableDateTimeOffset(BeatmapSet.DateSubmitted, otherSet.BeatmapSet.DateSubmitted); + comparison = Nullable.Compare(otherSet.BeatmapSet.DateSubmitted, BeatmapSet.DateSubmitted); break; } @@ -124,14 +124,6 @@ namespace osu.Game.Screens.Select.Carousel return otherSet.BeatmapSet.ID.CompareTo(BeatmapSet.ID); } - private static int compareNullableDateTimeOffset(DateTimeOffset? x, DateTimeOffset? y) - { - if (x == null) return 1; - if (y == null) return -1; - - return y.Value.CompareTo(x.Value); - } - /// /// All beatmaps which are not filtered and valid for display. /// From 3a240aaa5fa1e55bcc9b50c26345ebdf0c001d99 Mon Sep 17 00:00:00 2001 From: tsrk Date: Mon, 6 Mar 2023 10:27:59 +0000 Subject: [PATCH 40/48] style: use 64 radius --- osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index 6cea463193..32ed045df7 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play.HUD public new BindableFloat CornerRadius { get; set; } = new BindableFloat { MinValue = 0, - MaxValue = 63, + MaxValue = 64, Precision = 0.01f }; From 952814604ed43ab85b799198268cd222b7f9b9a9 Mon Sep 17 00:00:00 2001 From: tsrk Date: Mon, 6 Mar 2023 20:06:56 +0000 Subject: [PATCH 41/48] style: fix late night oopsies --- osu.Game.Tests/Skins/SkinDeserialisationTest.cs | 3 --- osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs index eb1df954aa..bd8088cfb6 100644 --- a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs +++ b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs @@ -9,7 +9,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Bindables; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; -using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.IO; using osu.Game.IO.Archives; @@ -64,8 +63,6 @@ namespace osu.Game.Tests.Skins foreach (string oskFile in available_skins) { - Logger.Log($"Testing file {oskFile}..."); - using (var stream = TestResources.OpenResource(oskFile)) using (var storage = new ZipArchiveReader(stream)) { diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index 32ed045df7..d2f4f0be17 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -43,8 +43,7 @@ namespace osu.Game.Screens.Play.HUD base.LoadComplete(); avatar.User = gameplayState.Score.ScoreInfo.User; - avatar.CornerRadius = CornerRadius.Value; - CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue); + CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue, true); } public bool UsesFixedAnchor { get; set; } From fc0e27fb15e3eb1a143e5924a9adf3f472944a06 Mon Sep 17 00:00:00 2001 From: tsrk Date: Mon, 6 Mar 2023 20:11:52 +0000 Subject: [PATCH 42/48] style: use normalised `CornerRadius` values --- osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index d2f4f0be17..f293199911 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -16,10 +16,10 @@ namespace osu.Game.Screens.Play.HUD public partial class PlayerAvatar : CompositeDrawable, ISerialisableDrawable { [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.CornerRadius), nameof(SkinnableComponentStrings.CornerRadiusDescription))] - public new BindableFloat CornerRadius { get; set; } = new BindableFloat + public new BindableFloat CornerRadius { get; set; } = new BindableFloat(0.25f) { MinValue = 0, - MaxValue = 64, + MaxValue = 0.5f, Precision = 0.01f }; @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play.HUD base.LoadComplete(); avatar.User = gameplayState.Score.ScoreInfo.User; - CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue, true); + CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue * 128f, true); } public bool UsesFixedAnchor { get; set; } From 2cce785fa5bb7fd1ab6b77d1a757a76a6fc3f94b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2023 15:54:33 +0900 Subject: [PATCH 43/48] Fix storyboard videos not fading out on completion Closes https://github.com/ppy/osu/issues/22802. Stable uses a 1,000 ms fade-in / out. Rather than matching that, I've stuck with 500ms (what lazer was already using for the fade-in) because I think it feels better. Tested using the beatmap linked in the issue thread. --- osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs index f4b0692619..eec2cd6a60 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs @@ -58,7 +58,11 @@ namespace osu.Game.Storyboards.Drawables using (drawableVideo.BeginAbsoluteSequence(Video.StartTime)) { Schedule(() => drawableVideo.PlaybackPosition = Time.Current - Video.StartTime); + drawableVideo.FadeIn(500); + + using (drawableVideo.BeginDelayedSequence(drawableVideo.Duration - 500)) + drawableVideo.FadeOut(500); } } } From f7f1dff6471784c79a14c27e79f168597ca30a0c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2023 16:45:33 +0900 Subject: [PATCH 44/48] Fix incorrect case of localisable string for "corner radius" --- .../Localisation/SkinComponents/SkinnableComponentStrings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs index 5cec9442e4..7c11ea6ac6 100644 --- a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs +++ b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs @@ -40,9 +40,9 @@ namespace osu.Game.Localisation.SkinComponents public static LocalisableString TextElementTextDescription => new TranslatableString(getKey(@"text_element_text_description"), "The text to be displayed."); /// - /// "Corner Radius" + /// "Corner radius" /// - public static LocalisableString CornerRadius => new TranslatableString(getKey(@"corner_radius"), "Corner Radius"); + public static LocalisableString CornerRadius => new TranslatableString(getKey(@"corner_radius"), "Corner radius"); /// /// "How rounded the corners should be." From d98199961b2d0820a3e4ff12816ac1c8e2190004 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2023 17:00:10 +0900 Subject: [PATCH 45/48] Adjust default sizing to fit a bit better with existing elements --- osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 7 +++++-- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index f293199911..1c558aaa8a 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -28,9 +28,12 @@ namespace osu.Game.Screens.Play.HUD private readonly UpdateableAvatar avatar; + private const float default_size = 80f; + public PlayerAvatar() { - Size = new Vector2(128f); + Size = new Vector2(default_size); + InternalChild = avatar = new UpdateableAvatar(isInteractive: false) { RelativeSizeAxes = Axes.Both, @@ -43,7 +46,7 @@ namespace osu.Game.Screens.Play.HUD base.LoadComplete(); avatar.User = gameplayState.Score.ScoreInfo.User; - CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue * 128f, true); + CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue * default_size, true); } public bool UsesFixedAnchor { get; set; } diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index 17188d0009..bf65ee23d8 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -17,9 +17,11 @@ namespace osu.Game.Screens.Play.HUD private readonly UpdateableFlag flag; + private const float default_size = 40f; + public PlayerFlag() { - Size = new Vector2(114, 80); + Size = new Vector2(default_size, default_size / 1.4f); InternalChild = flag = new UpdateableFlag { RelativeSizeAxes = Axes.Both, From 5e90b67be09b842a9fb4b7114f49e4463afdce52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2023 17:01:29 +0900 Subject: [PATCH 46/48] Move `GameplayState` usage to BDL --- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index bf65ee23d8..85799c03d3 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -12,9 +12,6 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable { - [Resolved] - private GameplayState gameplayState { get; set; } = null!; - private readonly UpdateableFlag flag; private const float default_size = 40f; @@ -28,10 +25,9 @@ namespace osu.Game.Screens.Play.HUD }; } - protected override void LoadComplete() + [BackgroundDependencyLoader] + private void load(GameplayState gameplayState) { - base.LoadComplete(); - flag.CountryCode = gameplayState.Score.ScoreInfo.User.CountryCode; } From dc2945f4f8635a08c83c84fd57f65c6da4eb8e47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2023 17:39:21 +0900 Subject: [PATCH 47/48] Move avatar user loading to BDL also --- osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index 1c558aaa8a..e3fab499f3 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -23,9 +23,6 @@ namespace osu.Game.Screens.Play.HUD Precision = 0.01f }; - [Resolved] - private GameplayState gameplayState { get; set; } = null!; - private readonly UpdateableAvatar avatar; private const float default_size = 80f; @@ -41,11 +38,16 @@ namespace osu.Game.Screens.Play.HUD }; } + [BackgroundDependencyLoader] + private void load(GameplayState gameplayState) + { + avatar.User = gameplayState.Score.ScoreInfo.User; + } + protected override void LoadComplete() { base.LoadComplete(); - avatar.User = gameplayState.Score.ScoreInfo.User; CornerRadius.BindValueChanged(e => avatar.CornerRadius = e.NewValue * default_size, true); } From 7ade525eef4a3c887de1d50123682140ee9c605a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 7 Mar 2023 19:43:52 +0100 Subject: [PATCH 48/48] Display corner radius setting as percentage --- .../Settings/SettingsPercentageSlider.cs | 20 +++++++++++++++++++ .../Rulesets/Mods/ModAccuracyChallenge.cs | 11 +--------- osu.Game/Screens/Play/HUD/PlayerAvatar.cs | 4 +++- 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Overlays/Settings/SettingsPercentageSlider.cs diff --git a/osu.Game/Overlays/Settings/SettingsPercentageSlider.cs b/osu.Game/Overlays/Settings/SettingsPercentageSlider.cs new file mode 100644 index 0000000000..fa59d18de1 --- /dev/null +++ b/osu.Game/Overlays/Settings/SettingsPercentageSlider.cs @@ -0,0 +1,20 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Graphics; +using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Overlays.Settings +{ + /// + /// A that displays its value as a percentage by default. + /// Mostly provided for convenience of use with . + /// + public partial class SettingsPercentageSlider : SettingsSlider + where TValue : struct, IEquatable, IComparable, IConvertible + { + protected override Drawable CreateControl() => ((RoundedSliderBar)base.CreateControl()).With(sliderBar => sliderBar.DisplayAsPercentage = true); + } +} diff --git a/osu.Game/Rulesets/Mods/ModAccuracyChallenge.cs b/osu.Game/Rulesets/Mods/ModAccuracyChallenge.cs index dc7594f469..d4223a80c2 100644 --- a/osu.Game/Rulesets/Mods/ModAccuracyChallenge.cs +++ b/osu.Game/Rulesets/Mods/ModAccuracyChallenge.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Bindables; using osu.Framework.Localisation; using osu.Game.Configuration; -using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Judgements; @@ -33,7 +32,7 @@ namespace osu.Game.Rulesets.Mods public override string SettingDescription => base.SettingDescription.Replace(MinimumAccuracy.ToString(), MinimumAccuracy.Value.ToString("##%", NumberFormatInfo.InvariantInfo)); - [SettingSource("Minimum accuracy", "Trigger a failure if your accuracy goes below this value.", SettingControlType = typeof(SettingsSlider))] + [SettingSource("Minimum accuracy", "Trigger a failure if your accuracy goes below this value.", SettingControlType = typeof(SettingsPercentageSlider))] public BindableNumber MinimumAccuracy { get; } = new BindableDouble { MinValue = 0.60, @@ -69,12 +68,4 @@ namespace osu.Game.Rulesets.Mods return scoreProcessor.ComputeAccuracy(score); } } - - public partial class PercentSlider : RoundedSliderBar - { - public PercentSlider() - { - DisplayAsPercentage = true; - } - } } diff --git a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs index e3fab499f3..1d0331593a 100644 --- a/osu.Game/Screens/Play/HUD/PlayerAvatar.cs +++ b/osu.Game/Screens/Play/HUD/PlayerAvatar.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Localisation.SkinComponents; +using osu.Game.Overlays.Settings; using osu.Game.Skinning; using osu.Game.Users.Drawables; using osuTK; @@ -15,7 +16,8 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerAvatar : CompositeDrawable, ISerialisableDrawable { - [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.CornerRadius), nameof(SkinnableComponentStrings.CornerRadiusDescription))] + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.CornerRadius), nameof(SkinnableComponentStrings.CornerRadiusDescription), + SettingControlType = typeof(SettingsPercentageSlider))] public new BindableFloat CornerRadius { get; set; } = new BindableFloat(0.25f) { MinValue = 0,