From 2b350c79469ce42536be55b52ffec60a315144f1 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 2 Mar 2023 14:16:58 +0800 Subject: [PATCH 1/7] In order to upgrade the osu.game to the latest, we need to upgrade this package to the latest. --- osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index b0792090c..d78c7d988 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -25,7 +25,7 @@ - + From db0c07375e3662d2ec5ffe17983627aa9db086a4 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 2 Mar 2023 14:18:36 +0800 Subject: [PATCH 2/7] Upgrade the osu.game to the latest. Seems some broken part need to be fixed. --- osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index d78c7d988..cffd91ef1 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -18,7 +18,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From e12100d96fb21711a7ae429b3ec494f47669c588 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 2 Mar 2023 19:19:30 +0800 Subject: [PATCH 3/7] Should use rounded slider bar instead. See: https://github.com/ppy/osu/pull/22432/files --- .../Settings/TimeTags/Components/LabelledOpacityAdjustment.cs | 2 +- .../Screens/Settings/Sections/Gameplay/NoteSettings.cs | 2 +- .../Screens/Settings/Sections/Gameplay/ScoringSettings.cs | 2 +- osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs | 2 +- .../UI/PlayerSettings/ClickablePlayerSliderBar.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/Components/LabelledOpacityAdjustment.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/Components/LabelledOpacityAdjustment.cs index d89545a4c..99f65acd2 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/Components/LabelledOpacityAdjustment.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/Components/LabelledOpacityAdjustment.cs @@ -89,7 +89,7 @@ public Popover GetPopover() } }; - private partial class OpacitySliderBar : OsuSliderBar + private partial class OpacitySliderBar : RoundedSliderBar { public override LocalisableString TooltipText => (Current.Value * 100).ToString("N0") + "%"; } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs index c9f034a6f..867ccdb3d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs @@ -44,7 +44,7 @@ private void load() }; } - private partial class TimeSlider : OsuSliderBar + private partial class TimeSlider : RoundedSliderBar { public override LocalisableString TooltipText => Current.Value.ToString("N0") + "ms"; } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs index 564a9b86d..fd3ea42b1 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs @@ -55,7 +55,7 @@ private void load() }; } - private partial class PitchSlider : OsuSliderBar + private partial class PitchSlider : RoundedSliderBar { public override LocalisableString TooltipText => (Current.Value >= 0 ? "+" : string.Empty) + Current.Value.ToString("N0"); } diff --git a/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs b/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs index a9f04ff76..bc99b65bf 100644 --- a/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs @@ -131,7 +131,7 @@ private void load() }; } - private partial class TimeSlider : OsuSliderBar + private partial class TimeSlider : RoundedSliderBar { public override LocalisableString TooltipText => Current.Value.ToString("N0") + "ms"; } diff --git a/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs b/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs index 5322cbe19..2ca7c0f1d 100644 --- a/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs +++ b/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs @@ -38,7 +38,7 @@ public ClickablePlayerSliderBar() public void TriggerIncrease() => bar.TriggerIncrease(); - private partial class ClickableSliderBar : OsuSliderBar + private partial class ClickableSliderBar : RoundedSliderBar { private readonly ToolTipButton decreaseButton; private readonly ToolTipButton increaseButton; From ae85cf9106d60bfbbd0b5c74fc4046f5965a1be1 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 2 Mar 2023 19:24:25 +0800 Subject: [PATCH 4/7] Use the new object naming. See: https://github.com/ppy/osu/pull/22648/files --- .../Mods/TestSceneKaraokeModPractice.cs | 2 +- .../Skinning/Legacy/KaraokeLegacySkinTransformer.cs | 6 +++--- osu.Game.Rulesets.Karaoke/UI/HUD/SettingButtonsDisplay.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPractice.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPractice.cs index 66632f3b5..9e2b6f8c7 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPractice.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPractice.cs @@ -21,7 +21,7 @@ public void TestAllPanelExist() => CreateModTest(new ModTestData PassCondition = () => { // just need to check has setting button display area. - var skinnableTargetContainers = Player.HUDOverlay.OfType().FirstOrDefault(); + var skinnableTargetContainers = Player.HUDOverlay.OfType().FirstOrDefault(); // todo: because setting buttons display created from skin transform , so might not able to get from here. var hud = skinnableTargetContainers?.Components.OfType().FirstOrDefault(); diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs index a17e793de..b99584a53 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs @@ -30,10 +30,10 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap) { switch (lookup) { - case GlobalSkinComponentLookup targetComponent: - switch (targetComponent.Lookup) + case SkinComponentsContainerLookup targetComponent: + switch (targetComponent.Target) { - case GlobalSkinComponentLookup.LookupType.MainHUDComponents: + case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: var components = base.GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer ?? getTargetComponentsContainerFromOtherPlace(); components?.Add(new SettingButtonsDisplay { diff --git a/osu.Game.Rulesets.Karaoke/UI/HUD/SettingButtonsDisplay.cs b/osu.Game.Rulesets.Karaoke/UI/HUD/SettingButtonsDisplay.cs index fb8b59c7c..59655ce5f 100644 --- a/osu.Game.Rulesets.Karaoke/UI/HUD/SettingButtonsDisplay.cs +++ b/osu.Game.Rulesets.Karaoke/UI/HUD/SettingButtonsDisplay.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Karaoke.UI.HUD { - public partial class SettingButtonsDisplay : CompositeDrawable, ISkinnableDrawable + public partial class SettingButtonsDisplay : CompositeDrawable, ISerialisableDrawable { private readonly CornerBackground background; private readonly FillFlowContainer triggerButtons; From e062da530eea4f87307f492f2cf62d93861feab7 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 2 Mar 2023 19:28:52 +0800 Subject: [PATCH 5/7] Should just use "as container" instead. See: https://github.com/ppy/osu/pull/22647/files --- .../Skinning/Legacy/KaraokeLegacySkinTransformer.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs index b99584a53..465ccad75 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Karaoke.UI.HUD; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; +using Container = osu.Framework.Graphics.Containers.Container; namespace osu.Game.Rulesets.Karaoke.Skinning.Legacy { @@ -34,7 +35,7 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap) switch (targetComponent.Target) { case SkinComponentsContainerLookup.TargetArea.MainHUDComponents: - var components = base.GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer ?? getTargetComponentsContainerFromOtherPlace(); + var components = base.GetDrawableComponent(lookup) as Container ?? getTargetComponentsContainerFromOtherPlace(); components?.Add(new SettingButtonsDisplay { Anchor = Anchor.CentreRight, @@ -67,10 +68,10 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap) return base.GetDrawableComponent(lookup); } - SkinnableTargetComponentsContainer? getTargetComponentsContainerFromOtherPlace() => + Container? getTargetComponentsContainerFromOtherPlace() => Skin switch { - LegacySkin legacySkin => new TempLegacySkin(legacySkin.SkinInfo.Value).GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer, + LegacySkin legacySkin => new TempLegacySkin(legacySkin.SkinInfo.Value).GetDrawableComponent(lookup) as Container, _ => throw new InvalidCastException() }; } From 8b82d9e18495dee534d5f04826a64d687f4f28ed Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 2 Mar 2023 19:34:31 +0800 Subject: [PATCH 6/7] Use better way to get the config manager See: https://github.com/ppy/osu/pull/22635/files --- osu.Game.Rulesets.Karaoke/Mods/KaraokeModFlashlight.cs | 6 ++++-- osu.Game.Rulesets.Karaoke/UI/DrawableKaraokeRuleset.cs | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModFlashlight.cs b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModFlashlight.cs index 7e44213c7..1768e032f 100644 --- a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModFlashlight.cs +++ b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModFlashlight.cs @@ -45,11 +45,13 @@ public override void ApplyToDrawableRuleset(DrawableRuleset dr { base.ApplyToDrawableRuleset(drawableRuleset); - var notePlayfield = (drawableRuleset as DrawableKaraokeRuleset)?.Playfield?.NotePlayfield; + var drawableKaraokeRuleset = drawableRuleset as DrawableKaraokeRuleset; + + var notePlayfield = drawableKaraokeRuleset?.Playfield?.NotePlayfield; if (notePlayfield == null) return; - var flashlight = drawableRuleset.KeyBindingInputManager.Children.OfType().FirstOrDefault(); + var flashlight = drawableKaraokeRuleset?.KeyBindingInputManager.Children.OfType().FirstOrDefault(); if (flashlight == null) return; diff --git a/osu.Game.Rulesets.Karaoke/UI/DrawableKaraokeRuleset.cs b/osu.Game.Rulesets.Karaoke/UI/DrawableKaraokeRuleset.cs index 57200d321..03784ddb7 100644 --- a/osu.Game.Rulesets.Karaoke/UI/DrawableKaraokeRuleset.cs +++ b/osu.Game.Rulesets.Karaoke/UI/DrawableKaraokeRuleset.cs @@ -32,6 +32,8 @@ public partial class DrawableKaraokeRuleset : DrawableScrollingRuleset (KaraokeRulesetConfigManager)base.Config; + public new KaraokeInputManager KeyBindingInputManager => (KaraokeInputManager)base.KeyBindingInputManager; + private readonly Bindable configDirection = new(); [Cached(typeof(INotePositionInfo))] From 31a6069eb16277af6ca34244020b4e4de72f2ae9 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 3 Mar 2023 14:10:58 +0800 Subject: [PATCH 7/7] Fix the test case broken. --- .../Mods/TestSceneKaraokeModFlashlight.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModFlashlight.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModFlashlight.cs index 99345f020..495277b14 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModFlashlight.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModFlashlight.cs @@ -3,6 +3,7 @@ using System.Linq; using NUnit.Framework; +using osu.Framework.Testing; using osu.Game.Rulesets.Karaoke.Mods; using osu.Game.Rulesets.Karaoke.Tests.Beatmaps; using osu.Game.Rulesets.Karaoke.Tests.Extensions; @@ -24,7 +25,7 @@ public void TestFlashlightExist() => CreateModTest(new ModTestData return false; // Should has at least one flashlight - return drawableRuleset.KeyBindingInputManager.Children.OfType().Any(); + return drawableRuleset.KeyBindingInputManager.ChildrenOfType().Any(); } }); }