From 4060373e0399d3d0cd80639050fcbf06e03dc0ae Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Sat, 5 Aug 2023 21:15:31 +0800 Subject: [PATCH 01/16] add rank display element --- osu.Game/Screens/Play/HUD/RankDisplay.cs | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 osu.Game/Screens/Play/HUD/RankDisplay.cs diff --git a/osu.Game/Screens/Play/HUD/RankDisplay.cs b/osu.Game/Screens/Play/HUD/RankDisplay.cs new file mode 100644 index 0000000000..be8841b647 --- /dev/null +++ b/osu.Game/Screens/Play/HUD/RankDisplay.cs @@ -0,0 +1,46 @@ +// 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.Game.Rulesets.Scoring; +using osu.Game.Skinning; +using osu.Framework.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Extensions; + +namespace osu.Game.Screens.Play.HUD +{ + public partial class RankDisplay : FontAdjustableSkinComponent + { + [Resolved] + private ScoreProcessor scoreProcessor { get; set; } = null!; + + private readonly OsuSpriteText text; + + public RankDisplay() + { + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + text = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + text.Text = scoreProcessor.Rank.Value.GetDescription(); + + scoreProcessor.Rank.BindValueChanged(v => text.Text = v.NewValue.GetDescription()); + } + + protected override void SetFont(FontUsage font) => text.Font = font.With(size: 40); + } +} From c67f6d949bca80561bf82456c1132f6a5dea8403 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Sun, 6 Aug 2023 18:15:14 +0800 Subject: [PATCH 02/16] tests --- .../Archives/modified-argon-20230806.osk | Bin 0 -> 1354 bytes osu.Game.Tests/Skins/SkinDeserialisationTest.cs | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Tests/Resources/Archives/modified-argon-20230806.osk diff --git a/osu.Game.Tests/Resources/Archives/modified-argon-20230806.osk b/osu.Game.Tests/Resources/Archives/modified-argon-20230806.osk new file mode 100644 index 0000000000000000000000000000000000000000..e7c035811d62df429b930fd41548457307cbf90a GIT binary patch literal 1354 zcmWIWW@Zs#U|`^2_)x_b{xqpXate^Q9xTGZP@J8ar42}OmnuF-Rk~{%W2L3)BpF`hq7LuxG?;EX_=A3@+2KLW50%z zCJT1*?Tu&XoUtI*VfhwjufoTAdrWT0Ma{Xkf@$w(9SMn5xn44g8x$8lRNOs3(qd74 z%Jfi^|ABpl0Vfx(=r4_R5}XqAe#WUcQ*y4{IN&>P(dHEU0JzIP0$qM&RRUiT(A6D4 z%nQUImuKdsz#gq{ny90<(fJCWZu^Z35nV4SU;s zezd&&{rb(l6CZWTX0CB?f8})STDef8DX&0-clIHVq~7&z*EpW3q-AL+#q+qH5nYgJ zvuyS;c?VC{_qW5o8TKyp>l6GXlhoQW^O(vvN!~iABF$+Be%qw2$$KZ^)3U@X{KluV zAFX*U)-Jnh)Sa;?@cZP{{EfZ~ue1iJ=uZv0$-0a&G2qsM8Pleh$E~n?aL_4X)&OEvgYy;j{w*|8v}ZGzaIeJgDh3p?^IJ1ESF zGT)sN8N0h{)!T)llX3-E3@0gAZY}Elo??03He!zw^Q84#%@-FfE%o^CtvPq`Y8$pg zSCYP5__pSq&1TE$)K6i#i}(ygYP2dW90ip;D#MOSo%?9AdF{Q|rrEbr7rkBBULB-& zWUaVTq;82zB2RwC37_z_-gepkxyRe&*4fsU&hx&LH~;#yyxk>lwrQuGF$|3tWc|ma zJAcbQfjiE2pAt&Fd|$~NUsC@#l0&fIso|-E!Q4_hJLh#pHne=1BslE-~E|J=o2m$7s89QqI{qdu7~e5_aE^w!dV5Of5&o z%suLV`NPbzhb#qp21+&!oeN@4YRUY)bbQ9XTUV_eL*D%;cl`0`ioSyG>dU2b`hNdm zU6LCeyZy1r?)PtUHsoIsS3e$8@YTvc?Y=pGep(76YbrMkWyk z+=U3xSO{nYQLrKfSr@hp4Ale7G`pa>;Mo~nD|+@qXboq?mD$kEKo1Cn86TO^gC)S5 Rl?^1%0)!udv@;8c2LR#77DE64 literal 0 HcmV?d00001 diff --git a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs index 82d204f134..72581f5513 100644 --- a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs +++ b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs @@ -52,7 +52,9 @@ namespace osu.Game.Tests.Skins // Covers player avatar and flag. "Archives/modified-argon-20230305.osk", // Covers key counters - "Archives/modified-argon-pro-20230618.osk" + "Archives/modified-argon-pro-20230618.osk", + // Covers rank display + "Archives/modified-argon-20230806.osk" }; /// From 92bf363ecf499a8a4b6ca9b56b63dd6024c40877 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Sun, 6 Aug 2023 20:43:09 +0800 Subject: [PATCH 03/16] use Drawable Rank --- .../Screens/Play/HUD/DefaultRankDisplay.cs | 40 ++++++++++++++++ .../Screens/Play/HUD/GameplayRankDisplay.cs | 14 ++++++ osu.Game/Screens/Play/HUD/RankDisplay.cs | 46 ------------------- 3 files changed, 54 insertions(+), 46 deletions(-) create mode 100644 osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs create mode 100644 osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs delete mode 100644 osu.Game/Screens/Play/HUD/RankDisplay.cs diff --git a/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs b/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs new file mode 100644 index 0000000000..a686b6d9fb --- /dev/null +++ b/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs @@ -0,0 +1,40 @@ +// 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.Game.Online.Leaderboards; +using osu.Game.Rulesets.Scoring; +using osuTK; + + +namespace osu.Game.Screens.Play.HUD +{ + public partial class DefaultRankDisplay : GameplayRankDisplay + { + [Resolved] + private ScoreProcessor scoreProcessor { get; set; } = null!; + + private UpdateableRank rank; + + public DefaultRankDisplay() + { + Size = new Vector2(70, 35); + + InternalChildren = new Drawable[] { + rank = new UpdateableRank(Scoring.ScoreRank.X) { + RelativeSizeAxes = Axes.Both + }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + rank.Rank = scoreProcessor.Rank.Value; + + scoreProcessor.Rank.BindValueChanged(v => rank.Rank = v.NewValue); + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs b/osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs new file mode 100644 index 0000000000..402a733abd --- /dev/null +++ b/osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs @@ -0,0 +1,14 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Skinning; +using osu.Framework.Graphics.Containers; + + +namespace osu.Game.Screens.Play.HUD +{ + public abstract partial class GameplayRankDisplay : Container, ISerialisableDrawable + { + public bool UsesFixedAnchor { get; set; } + } +} diff --git a/osu.Game/Screens/Play/HUD/RankDisplay.cs b/osu.Game/Screens/Play/HUD/RankDisplay.cs deleted file mode 100644 index be8841b647..0000000000 --- a/osu.Game/Screens/Play/HUD/RankDisplay.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 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.Game.Rulesets.Scoring; -using osu.Game.Skinning; -using osu.Framework.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Extensions; - -namespace osu.Game.Screens.Play.HUD -{ - public partial class RankDisplay : FontAdjustableSkinComponent - { - [Resolved] - private ScoreProcessor scoreProcessor { get; set; } = null!; - - private readonly OsuSpriteText text; - - public RankDisplay() - { - AutoSizeAxes = Axes.Both; - - InternalChildren = new Drawable[] - { - text = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - } - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - text.Text = scoreProcessor.Rank.Value.GetDescription(); - - scoreProcessor.Rank.BindValueChanged(v => text.Text = v.NewValue.GetDescription()); - } - - protected override void SetFont(FontUsage font) => text.Font = font.With(size: 40); - } -} From f3f7d1ba7c97ae6ca35092df6987fbed0b17b70a Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Mon, 7 Aug 2023 09:50:24 +0800 Subject: [PATCH 04/16] remove measly abstract --- osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs | 7 +++++-- osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs | 14 -------------- 2 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs diff --git a/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs b/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs index a686b6d9fb..433acf678a 100644 --- a/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs +++ b/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs @@ -3,19 +3,22 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Online.Leaderboards; using osu.Game.Rulesets.Scoring; +using osu.Game.Skinning; using osuTK; namespace osu.Game.Screens.Play.HUD { - public partial class DefaultRankDisplay : GameplayRankDisplay + public partial class DefaultRankDisplay : Container, ISerialisableDrawable { [Resolved] private ScoreProcessor scoreProcessor { get; set; } = null!; + public bool UsesFixedAnchor { get; set; } - private UpdateableRank rank; + private readonly UpdateableRank rank; public DefaultRankDisplay() { diff --git a/osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs b/osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs deleted file mode 100644 index 402a733abd..0000000000 --- a/osu.Game/Screens/Play/HUD/GameplayRankDisplay.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Skinning; -using osu.Framework.Graphics.Containers; - - -namespace osu.Game.Screens.Play.HUD -{ - public abstract partial class GameplayRankDisplay : Container, ISerialisableDrawable - { - public bool UsesFixedAnchor { get; set; } - } -} From eb3d3b51e204fef93fdd80e59218e8fb261ae275 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Mon, 7 Aug 2023 09:50:44 +0800 Subject: [PATCH 05/16] add legacy rank display --- osu.Game/Skinning/LegacyRankDisplay.cs | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 osu.Game/Skinning/LegacyRankDisplay.cs diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs new file mode 100644 index 0000000000..0ae3b45107 --- /dev/null +++ b/osu.Game/Skinning/LegacyRankDisplay.cs @@ -0,0 +1,47 @@ +// 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 osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Skinning +{ + public partial class LegacyRankDisplay : CompositeDrawable, ISerialisableDrawable + { + public bool UsesFixedAnchor { get; set; } + + [Resolved] + private ScoreProcessor scoreProcessor { get; set; } = null!; + + [Resolved] + private ISkinSource source { get; set; } = null!; + + private readonly Sprite rank; + + public LegacyRankDisplay() + { + AutoSizeAxes = Axes.Both; + + AddInternal(rank = new Sprite()); + } + + protected override void LoadComplete() + { + + var skin = source.FindProvider(s => getTexture(s, "A") != null); + + rank.Texture = getTexture(skin, scoreProcessor.Rank.Value.ToString()); + + scoreProcessor.Rank.BindValueChanged(v => rank.Texture = getTexture(skin, v.NewValue.ToString())); + } + + private static Texture getTexture(ISkin skin, string name) => skin?.GetTexture($"ranking-{name}"); + } +} \ No newline at end of file From 9bdff29dd72c24b7b48292d7f7312363a16a1e2e Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Mon, 7 Aug 2023 09:50:54 +0800 Subject: [PATCH 06/16] add visual test --- .../Gameplay/TestSceneSkinnableRankDisplay.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs new file mode 100644 index 0000000000..dc8b3d994b --- /dev/null +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs @@ -0,0 +1,37 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Play.HUD; +using osu.Game.Skinning; + +namespace osu.Game.Tests.Visual.Gameplay +{ + public partial class TestSceneSkinnableRankDisplay : SkinnableHUDComponentTestScene + { + [Cached] + private ScoreProcessor scoreProcessor = new ScoreProcessor(new OsuRuleset()); + + protected override Drawable CreateDefaultImplementation() => new DefaultRankDisplay(); + + protected override Drawable CreateLegacyImplementation() => new LegacyRankDisplay(); + + [Test] + public void TestChangingRank() + { + AddStep("Set rank to SS Hidden", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.XH); + AddStep("Set rank to SS", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.X); + AddStep("Set rank to S Hidden", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.SH); + AddStep("Set rank to S", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.S); + AddStep("Set rank to A", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.A); + AddStep("Set rank to B", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.B); + AddStep("Set rank to C", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.C); + AddStep("Set rank to D", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.D); + AddStep("Set rank to F", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.F); + } + } +} \ No newline at end of file From bd67e933105435ee161d8b639cd7221fec88e003 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Mon, 7 Aug 2023 11:16:51 +0800 Subject: [PATCH 07/16] fix code format --- osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs | 10 ++++++---- osu.Game/Skinning/LegacyRankDisplay.cs | 2 -- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs b/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs index 433acf678a..09ab7d156c 100644 --- a/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs +++ b/osu.Game/Screens/Play/HUD/DefaultRankDisplay.cs @@ -9,13 +9,13 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osuTK; - namespace osu.Game.Screens.Play.HUD { public partial class DefaultRankDisplay : Container, ISerialisableDrawable { [Resolved] private ScoreProcessor scoreProcessor { get; set; } = null!; + public bool UsesFixedAnchor { get; set; } private readonly UpdateableRank rank; @@ -24,11 +24,13 @@ namespace osu.Game.Screens.Play.HUD { Size = new Vector2(70, 35); - InternalChildren = new Drawable[] { - rank = new UpdateableRank(Scoring.ScoreRank.X) { + InternalChildren = new Drawable[] + { + rank = new UpdateableRank(Scoring.ScoreRank.X) + { RelativeSizeAxes = Axes.Both }, - }; + }; } protected override void LoadComplete() diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs index 0ae3b45107..83d4299360 100644 --- a/osu.Game/Skinning/LegacyRankDisplay.cs +++ b/osu.Game/Skinning/LegacyRankDisplay.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Scoring; namespace osu.Game.Skinning @@ -34,7 +33,6 @@ namespace osu.Game.Skinning protected override void LoadComplete() { - var skin = source.FindProvider(s => getTexture(s, "A") != null); rank.Texture = getTexture(skin, scoreProcessor.Rank.Value.ToString()); From 07b4f6115b8d35fbb9a03a6399846e5bbeef9db9 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Mon, 7 Aug 2023 20:26:32 +0800 Subject: [PATCH 08/16] use small --- osu.Game/Skinning/LegacyRankDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs index 83d4299360..cd121deb8c 100644 --- a/osu.Game/Skinning/LegacyRankDisplay.cs +++ b/osu.Game/Skinning/LegacyRankDisplay.cs @@ -40,6 +40,6 @@ namespace osu.Game.Skinning scoreProcessor.Rank.BindValueChanged(v => rank.Texture = getTexture(skin, v.NewValue.ToString())); } - private static Texture getTexture(ISkin skin, string name) => skin?.GetTexture($"ranking-{name}"); + private static Texture getTexture(ISkin skin, string name) => skin?.GetTexture($"ranking-{name}-small"); } } \ No newline at end of file From fed338a42b12a248b902f2ea1389f06fcec0ec70 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Wed, 9 Aug 2023 07:34:30 +0800 Subject: [PATCH 09/16] improve code --- osu.Game/Skinning/LegacyRankDisplay.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs index cd121deb8c..b663f52097 100644 --- a/osu.Game/Skinning/LegacyRankDisplay.cs +++ b/osu.Game/Skinning/LegacyRankDisplay.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -33,13 +31,7 @@ namespace osu.Game.Skinning protected override void LoadComplete() { - var skin = source.FindProvider(s => getTexture(s, "A") != null); - - rank.Texture = getTexture(skin, scoreProcessor.Rank.Value.ToString()); - - scoreProcessor.Rank.BindValueChanged(v => rank.Texture = getTexture(skin, v.NewValue.ToString())); + scoreProcessor.Rank.BindValueChanged(v => rank.Texture = source.GetTexture($"ranking-{v.NewValue}-small"), true); } - - private static Texture getTexture(ISkin skin, string name) => skin?.GetTexture($"ranking-{name}-small"); } } \ No newline at end of file From 94613b42e4622a80d724f0e2d700f68f2986c7d9 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Wed, 9 Aug 2023 08:33:50 +0800 Subject: [PATCH 10/16] update tests --- .../Archives/modified-classic-20230809.osk | Bin 0 -> 1603 bytes .../Archives/modified-default-20230809.osk | Bin 0 -> 2141 bytes osu.Game.Tests/Skins/SkinDeserialisationTest.cs | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Resources/Archives/modified-classic-20230809.osk create mode 100644 osu.Game.Tests/Resources/Archives/modified-default-20230809.osk diff --git a/osu.Game.Tests/Resources/Archives/modified-classic-20230809.osk b/osu.Game.Tests/Resources/Archives/modified-classic-20230809.osk new file mode 100644 index 0000000000000000000000000000000000000000..b200ab126188d5d056f8d0b11ba37ef9fbc715cf GIT binary patch literal 1603 zcmWIWW@Zs#U|`^2xZ}VX-n-?LnWvYTmwC3|n(vT-fJ^oKq!&#r zDodP7LP|mc6uVUKHMH*S&T$t^U;Mx$rm=s)Bc>^fE30PhjL%Q){5tXCs_(a~Ef)ly z)RDAR4VZ2kP{vzX&lq`H>^HYbDf11zeFfs@q&{<0dz}wrUHe%_MB=G;mZegGn)gh# zwB0EWJ?hfK{FDBPna&F;;_X^+ZEN3KfukiEVzG8vbCQ+SFUIx!yu9#6-Qyq3J+D`- zTODb7_wSqvh5!^FElG=;+y?Z?G9c!K`Y1CmEnhFII6u#{cO%y!0}yzAT>)Sz5C*M&Em(6e<%On^HgA>a-zz4UF-dFCojJbiDOSv zdzYFltCwtZTkfp(MIkfKl==Fo4qn7Dvsn}9P#qxV2jbxTy!7DIoYdqJu#;Cm3knD* z()7~t_c`VH^^EuF@J&H0*t!^9FBgBBEL7a^=S9Q<2igBCI$uzK?Vjf zpsBuznRy}_J{A+TOZ!HTI`PLNh zWQqH$t6L|&J)m{uzn%J&N!t>IS8NeI7=KlPsPWM!U+}m@oe5)HgK+ z?{v~GHl6M%`dt%fZ(Y1++uXD34n|o8O@F~Xmr2TRhJcUA3u_UR`Cp%!Oshrnpf*&+qITO+5 zI;;3kKdaUuHM8miVi#(gpNB|UJ&&wfYkWqt-K?xxoZX z(K^rN|FqNJZ$F80D%ZarIB)u@b(`*Li~Z8z5@8)i2 z7pF-r2lYy;m&r8CYERc@Sa|V3n5dPdy_@=(njo)L@(I-|+~ikAIepvvsp^TY>6bfZ zyc>UK@y?d~qvy`*<2YlAG2=?f%{59ntdaW@RBy%!%|`z5bNl*8=kyv14`%R_t}mfkw^%Ji_e-JG-o^K+#0zOBCfAtoc3_x|!L zIkhZ@^BM|-e%z~4?=;~0YtVI=w{()g(YiS*_o5c;RIEF?pW*oLyFtIcKD+B1e$dcM zNk-*$`m}l7HTK_P=5LXYja!%d)qIoGv4c@-cDDX`-m_(H+T`%7TQA+7CiBJgtgh?R zrg>i_FIS20dCODbbu{I+aKicGS<#V@p76axIMkWyk+yx-e zSO{nYQLy3=T^D*G1J%R8(0B=|3tr@)YemoQ2(8V)G8irMqiaUb)da3BBx literal 0 HcmV?d00001 diff --git a/osu.Game.Tests/Resources/Archives/modified-default-20230809.osk b/osu.Game.Tests/Resources/Archives/modified-default-20230809.osk new file mode 100644 index 0000000000000000000000000000000000000000..a46c20d2b83309aeadcc6a563d504a7db203258b GIT binary patch literal 2141 zcmZ`)2{ha37XMpft$mrG)U+6}L^8EaJ6ijiR>V3zc#XBOB-TMtl13E?+Nz?KVv3ep zYfx&NDiV8JS`td_<)LberIYscy&m3s-*@i$&UerG-Shpvdw=&LtvEQv0RZ3u)bx2B zX*@;jL#$f?=!*vcf_*VqCq)X7Xj4jkBIfpkn`LHK&5qG64&<6xQ57e;|UG1b_;1UR{^{9)8^NC!S zPJUFf(IFY63y+zjuXx$lp^8?iXVY^jJCF0)r`C^ye5#aWBR)LKsqg-XE30qM4n5$K zbafv;H@?k`Iei|!t`}L^rx#tjDTqA8+b<>FGM&X&j12$;zVXIjy>L*UU>r6lrHZc| zCT_BIwd1rczrXoOx4_U;D0ERlmi+>)aG75LA~@CJJ3w}!L$~OYx!zo@eR%C9poi(n z5fM;=$slXU=lRF$WtGQ9Cfa-BpCR&5h7cRtQx`PKyq22wX20!ELuxdQ8qS<23l4Wo z=ty^;n;+AezE%`_=Kh20_}$a*i&GR^$mS%?Ro`mz1zt>R^@z-20yfie+)Q==AV>j# zB#XcWGzM#KZ)}9~55QqPu_3`@6+!lCIeqqJ^^$Nny}t6!?T1j_Ha zQ1Q@l#Pm-NyBnXQFIr$Mi33ley_}0iGZQW=eFuz&u;z)Hvi)3zI*+b*{3nw3g@&KC z9m|5j6?)1ve(+W8{Gob%M+@BDjD#=|Ua?$NobUKHq%sR{C&?|gW&D8%>+n;4dU8hE zgLdgrU0I&Igv6e3VMnoNC?!Z`GS%pjB3ivPPf&`|(zfS}Ae{J^R<%E@LTpCb$?#jR z&2Hzg`Hh(RldHy5EN4xp!gbRlrOBK5VvJV-`L2BPhm1=4ljg)+@L>F-TF(3QS zfR3s&^$BH<^92f)m6L5PrXm?K@fvxCctFjp?Qd3L|2t27iu=aZdfoE+!4t zWed|OH|#Vn{}GqzE#tV>bRFBbUJ;VkdaOPfJR`ioODU#{rw<0_fn@lVP*MU3WNb-+ z5w#?D?(Lw;Odo;{juB~Kvk)yoB~cuC2gzNKF7t(*sh%Y*S<~yS4%J%ddm|)mY~p-YaGuIvQ-E8WS^r3_wM2P} zbAMn?B8QNkOeCRE5hXkAJ`$=|@oTf1;ypUt_lg+L0ahA`Jd4ldh4Y7rjb}CGjfiD`^ zi<=~`Vi=jz8BrMSi&3=cs?^`FQTB#|cFW zwXhvl%NdvU*&3GAQ@8*?h@}==9M;>`)6dgAxFS-@y38-Ohkwo!reSa`>3zayfT!p+JVZ@F0?qW;^)sKl7jwckvTRQHoe8^lU~8YGmLbvA9RV?7f?_VU`W8EBa2s3#!GwB{-5RuD z@wID%49OEN#34kYMeJC=nJtZC4->geDWIF3z8CBeb*hwy(HTEYhS(fv24)9oT|k?j6kWDo%m}X> zxT)-bYOs&jTP=388h#~MBZtp7h(Y_-k1zj*EYH^vBnL7^QZ@z~$IqU;dcR-)x4==+ z@y)Zngc0nD;*6xvN*gs!yvRl~JaHj$%@;(OE}bYe+xskC1n+{x4}oyAVnmB z^LoF36Mivp-gSG`=qmNO`7KTAkggn9s?Kh6E&j#Yk{RXWqo{KG(HODUg-ngZ`8|He z4X?z?D}-f&EJOOCBfK!4ejZ=bTRMwEB7-27YSsv<#YT@6&9NF)!j;HovYuo`$ewqS zuShSI1dvv2?Bc-xAC0WA|5}7E$G->VQPk1F@(sgk)Z5=s{~0q!p+{T#cW48vbpLmQ tKN{m`p?{At$N67ne-wQ57r%o$S-Ls=r${Rh%Lf1;)`qg4C&m5c_BT%1iFW`1 literal 0 HcmV?d00001 diff --git a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs index 72581f5513..7fa10559dc 100644 --- a/osu.Game.Tests/Skins/SkinDeserialisationTest.cs +++ b/osu.Game.Tests/Skins/SkinDeserialisationTest.cs @@ -53,8 +53,10 @@ namespace osu.Game.Tests.Skins "Archives/modified-argon-20230305.osk", // Covers key counters "Archives/modified-argon-pro-20230618.osk", - // Covers rank display - "Archives/modified-argon-20230806.osk" + // Covers default rank display + "Archives/modified-default-20230809.osk", + // Covers legacy rank display + "Archives/modified-classic-20230809.osk" }; /// From 2c3d5dc21a31b4d65d618fbe8dedf714135f32a2 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Wed, 9 Aug 2023 08:44:01 +0800 Subject: [PATCH 11/16] remove unnecesary directive --- osu.Game/Skinning/LegacyRankDisplay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs index b663f52097..38ece4e5e4 100644 --- a/osu.Game/Skinning/LegacyRankDisplay.cs +++ b/osu.Game/Skinning/LegacyRankDisplay.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.Scoring; namespace osu.Game.Skinning From 56eaf48892e23dbb5245cbe78e742be3e0faedd1 Mon Sep 17 00:00:00 2001 From: nanashi-1 Date: Wed, 9 Aug 2023 11:29:52 +0800 Subject: [PATCH 12/16] remove unnecessary archive --- .../Archives/modified-argon-20230806.osk | Bin 1354 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 osu.Game.Tests/Resources/Archives/modified-argon-20230806.osk diff --git a/osu.Game.Tests/Resources/Archives/modified-argon-20230806.osk b/osu.Game.Tests/Resources/Archives/modified-argon-20230806.osk deleted file mode 100644 index e7c035811d62df429b930fd41548457307cbf90a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1354 zcmWIWW@Zs#U|`^2_)x_b{xqpXate^Q9xTGZP@J8ar42}OmnuF-Rk~{%W2L3)BpF`hq7LuxG?;EX_=A3@+2KLW50%z zCJT1*?Tu&XoUtI*VfhwjufoTAdrWT0Ma{Xkf@$w(9SMn5xn44g8x$8lRNOs3(qd74 z%Jfi^|ABpl0Vfx(=r4_R5}XqAe#WUcQ*y4{IN&>P(dHEU0JzIP0$qM&RRUiT(A6D4 z%nQUImuKdsz#gq{ny90<(fJCWZu^Z35nV4SU;s zezd&&{rb(l6CZWTX0CB?f8})STDef8DX&0-clIHVq~7&z*EpW3q-AL+#q+qH5nYgJ zvuyS;c?VC{_qW5o8TKyp>l6GXlhoQW^O(vvN!~iABF$+Be%qw2$$KZ^)3U@X{KluV zAFX*U)-Jnh)Sa;?@cZP{{EfZ~ue1iJ=uZv0$-0a&G2qsM8Pleh$E~n?aL_4X)&OEvgYy;j{w*|8v}ZGzaIeJgDh3p?^IJ1ESF zGT)sN8N0h{)!T)llX3-E3@0gAZY}Elo??03He!zw^Q84#%@-FfE%o^CtvPq`Y8$pg zSCYP5__pSq&1TE$)K6i#i}(ygYP2dW90ip;D#MOSo%?9AdF{Q|rrEbr7rkBBULB-& zWUaVTq;82zB2RwC37_z_-gepkxyRe&*4fsU&hx&LH~;#yyxk>lwrQuGF$|3tWc|ma zJAcbQfjiE2pAt&Fd|$~NUsC@#l0&fIso|-E!Q4_hJLh#pHne=1BslE-~E|J=o2m$7s89QqI{qdu7~e5_aE^w!dV5Of5&o z%suLV`NPbzhb#qp21+&!oeN@4YRUY)bbQ9XTUV_eL*D%;cl`0`ioSyG>dU2b`hNdm zU6LCeyZy1r?)PtUHsoIsS3e$8@YTvc?Y=pGep(76YbrMkWyk z+=U3xSO{nYQLrKfSr@hp4Ale7G`pa>;Mo~nD|+@qXboq?mD$kEKo1Cn86TO^gC)S5 Rl?^1%0)!udv@;8c2LR#77DE64 From 199d31c0f4f68b1049cd0692d172273f57689bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 7 Jun 2024 09:54:00 +0200 Subject: [PATCH 13/16] Fix test not compiling A little ugly but maybe it'll do... --- .../Gameplay/TestSceneSkinnableRankDisplay.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs index dc8b3d994b..d442e69c61 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinnableRankDisplay.cs @@ -3,9 +3,11 @@ using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; using osu.Game.Screens.Play.HUD; using osu.Game.Skinning; @@ -16,6 +18,8 @@ namespace osu.Game.Tests.Visual.Gameplay [Cached] private ScoreProcessor scoreProcessor = new ScoreProcessor(new OsuRuleset()); + private Bindable rank => (Bindable)scoreProcessor.Rank; + protected override Drawable CreateDefaultImplementation() => new DefaultRankDisplay(); protected override Drawable CreateLegacyImplementation() => new LegacyRankDisplay(); @@ -23,15 +27,15 @@ namespace osu.Game.Tests.Visual.Gameplay [Test] public void TestChangingRank() { - AddStep("Set rank to SS Hidden", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.XH); - AddStep("Set rank to SS", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.X); - AddStep("Set rank to S Hidden", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.SH); - AddStep("Set rank to S", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.S); - AddStep("Set rank to A", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.A); - AddStep("Set rank to B", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.B); - AddStep("Set rank to C", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.C); - AddStep("Set rank to D", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.D); - AddStep("Set rank to F", () => scoreProcessor.Rank.Value = Scoring.ScoreRank.F); + AddStep("Set rank to SS Hidden", () => rank.Value = ScoreRank.XH); + AddStep("Set rank to SS", () => rank.Value = ScoreRank.X); + AddStep("Set rank to S Hidden", () => rank.Value = ScoreRank.SH); + AddStep("Set rank to S", () => rank.Value = ScoreRank.S); + AddStep("Set rank to A", () => rank.Value = ScoreRank.A); + AddStep("Set rank to B", () => rank.Value = ScoreRank.B); + AddStep("Set rank to C", () => rank.Value = ScoreRank.C); + AddStep("Set rank to D", () => rank.Value = ScoreRank.D); + AddStep("Set rank to F", () => rank.Value = ScoreRank.F); } } -} \ No newline at end of file +} From 72890bb9acf9ab6b3733dd0d3ede0ad6961a45a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 7 Jun 2024 09:54:27 +0200 Subject: [PATCH 14/16] Add stable-like animation legacy rank display Just substituting the sprite felt pretty terrible. --- osu.Game/Skinning/LegacyRankDisplay.cs | 33 +++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs index 38ece4e5e4..71d487eade 100644 --- a/osu.Game/Skinning/LegacyRankDisplay.cs +++ b/osu.Game/Skinning/LegacyRankDisplay.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Scoring; +using osuTK; namespace osu.Game.Skinning { @@ -25,12 +26,38 @@ namespace osu.Game.Skinning { AutoSizeAxes = Axes.Both; - AddInternal(rank = new Sprite()); + AddInternal(rank = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); } protected override void LoadComplete() { - scoreProcessor.Rank.BindValueChanged(v => rank.Texture = source.GetTexture($"ranking-{v.NewValue}-small"), true); + scoreProcessor.Rank.BindValueChanged(v => + { + var texture = source.GetTexture($"ranking-{v.NewValue}-small"); + + rank.Texture = texture; + + if (texture != null) + { + var transientRank = new Sprite + { + Texture = texture, + Blending = BlendingParameters.Additive, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BypassAutoSizeAxes = Axes.Both, + }; + AddInternal(transientRank); + transientRank.FadeOutFromOne(1200, Easing.Out) + .ScaleTo(new Vector2(1.625f), 1200, Easing.Out) + .Expire(); + } + }, true); + FinishTransforms(true); } } -} \ No newline at end of file +} From 366ef64a2c12e1f7f8a1ff7c975fe0fe5ed7ac90 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2024 16:54:12 +0800 Subject: [PATCH 15/16] Apply NRT to `UpdateableRank` --- osu.Game/Online/Leaderboards/UpdateableRank.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Online/Leaderboards/UpdateableRank.cs b/osu.Game/Online/Leaderboards/UpdateableRank.cs index 46cfe8ec65..717adee79d 100644 --- a/osu.Game/Online/Leaderboards/UpdateableRank.cs +++ b/osu.Game/Online/Leaderboards/UpdateableRank.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 osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Scoring; @@ -22,7 +20,7 @@ namespace osu.Game.Online.Leaderboards Rank = rank; } - protected override Drawable CreateDrawable(ScoreRank? rank) + protected override Drawable? CreateDrawable(ScoreRank? rank) { if (rank.HasValue) { From 9c6e707f00454f9370a8ee3b0424903c9c9b917c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Jun 2024 17:04:16 +0800 Subject: [PATCH 16/16] Adjust transitions --- .../Online/Leaderboards/UpdateableRank.cs | 28 +++++++++++++++++++ osu.Game/Skinning/LegacyRankDisplay.cs | 4 +-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/osu.Game/Online/Leaderboards/UpdateableRank.cs b/osu.Game/Online/Leaderboards/UpdateableRank.cs index 717adee79d..b64fab6861 100644 --- a/osu.Game/Online/Leaderboards/UpdateableRank.cs +++ b/osu.Game/Online/Leaderboards/UpdateableRank.cs @@ -1,14 +1,19 @@ // 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.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; using osu.Game.Scoring; namespace osu.Game.Online.Leaderboards { public partial class UpdateableRank : ModelBackedDrawable { + protected override double TransformDuration => 600; + protected override bool TransformImmediately => true; + public ScoreRank? Rank { get => Model; @@ -20,6 +25,16 @@ namespace osu.Game.Online.Leaderboards Rank = rank; } + protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func createContentFunc, double timeBeforeLoad) + { + return base.CreateDelayedLoadWrapper(createContentFunc, timeBeforeLoad) + .With(w => + { + w.Anchor = Anchor.Centre; + w.Origin = Anchor.Centre; + }); + } + protected override Drawable? CreateDrawable(ScoreRank? rank) { if (rank.HasValue) @@ -33,5 +48,18 @@ namespace osu.Game.Online.Leaderboards return null; } + + protected override TransformSequence ApplyShowTransforms(Drawable drawable) + { + drawable.ScaleTo(1); + return base.ApplyShowTransforms(drawable); + } + + protected override TransformSequence ApplyHideTransforms(Drawable drawable) + { + drawable.ScaleTo(1.8f, TransformDuration, Easing.Out); + + return base.ApplyHideTransforms(drawable); + } } } diff --git a/osu.Game/Skinning/LegacyRankDisplay.cs b/osu.Game/Skinning/LegacyRankDisplay.cs index 71d487eade..70b5ed0278 100644 --- a/osu.Game/Skinning/LegacyRankDisplay.cs +++ b/osu.Game/Skinning/LegacyRankDisplay.cs @@ -52,8 +52,8 @@ namespace osu.Game.Skinning BypassAutoSizeAxes = Axes.Both, }; AddInternal(transientRank); - transientRank.FadeOutFromOne(1200, Easing.Out) - .ScaleTo(new Vector2(1.625f), 1200, Easing.Out) + transientRank.FadeOutFromOne(500, Easing.Out) + .ScaleTo(new Vector2(1.625f), 500, Easing.Out) .Expire(); } }, true);