From 25686b05101dab6561f16353dfea5e2732c05dce Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 25 Jun 2024 22:08:37 +0800 Subject: [PATCH] Upgrade the lazer to the latest. --- .../ChangeHandlers/BaseChangeHandlerTest.cs | 4 ++++ .../Blueprints/RubyBlueprintContainer.cs | 2 +- .../Beatmaps/Lyrics/Compose/LyricComposer.cs | 5 +---- .../Settings/LabelledObjectFieldTextBox.cs | 3 +++ .../Skinning/Legacy/LegacyHitExplosion.cs | 5 +---- .../Skinning/Legacy/LegacyNotePiece.cs | 20 ++++--------------- .../UI/DrawableNoteJudgement.cs | 2 +- .../osu.Game.Rulesets.Karaoke.csproj | 2 +- 8 files changed, 16 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/BaseChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/BaseChangeHandlerTest.cs index 761f9b9dd..3e9c8f400 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/BaseChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/BaseChangeHandlerTest.cs @@ -251,6 +251,10 @@ public MockEditorChangeHandler(EditorBeatmap editorBeatmap) editorBeatmap.SaveStateTriggered += SaveState; } + public void RestoreState(int direction) + { + } + protected override void UpdateState() { OnStateChange?.Invoke(); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs index 999934d26..537ecd3dd 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs @@ -49,7 +49,7 @@ protected override void OnSelectionChanged() base.OnSelectionChanged(); // only select one ruby tag can let user drag to change start and end index. - SelectionBox.CanScaleX = SelectedItems.Count == 1; + ScaleHandler.CanScaleX.Value = SelectedItems.Count == 1; // should clear delta size before change start/end index. deltaScaleSize = 0; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs index 61b847bb8..8652bfdd8 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs @@ -304,11 +304,8 @@ private void assignBottomEditor(BottomEditorType? bottomEditorType) const double new_animation_time = 200; bool hasOldButtonEditor = bottomEditorContainer.Children.Any(); - var newButtonEditor = createBottomEditor(bottomEditorType).With(x => + var newButtonEditor = createBottomEditor(bottomEditorType)?.With(x => { - if (x == null) - return; - x.RelativePositionAxes = Axes.Y; x.Y = -1; x.Alpha = 0; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LabelledObjectFieldTextBox.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LabelledObjectFieldTextBox.cs index 7f516ed47..475a7bf7e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LabelledObjectFieldTextBox.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LabelledObjectFieldTextBox.cs @@ -94,6 +94,9 @@ private void focus() // Make sure that view is visible in the scroll container. // Give the top spacing larger space to let use able to see the previous item or the description text. var parentScrollContainer = this.FindClosestParent(); + if (parentScrollContainer == null) + throw new InvalidOperationException("Should have a parent scroll container."); + parentScrollContainer.ScrollIntoViewWithSpacing(this, new MarginPadding { Top = 150, Bottom = 50 }); if (IsFocused(focusedDrawable)) diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs index 166b1ad12..0a69ca7fa 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs @@ -39,11 +39,8 @@ private void load(ISkinSource skin, IScrollingInfo scrollingInfo) if (tmp is IFramedAnimation { FrameCount: > 0 } tmpAnimation) frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount); - explosion = skin.GetAnimation(imageName, true, false, frameLength: frameLength).With(d => + explosion = skin.GetAnimation(imageName, true, false, frameLength: frameLength)?.With(d => { - if (d == null) - return; - d.Origin = Anchor.Centre; d.Blending = BlendingParameters.Additive; d.Scale = new Vector2(explosionScale); diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs index 5e04d7795..8e004bcbe 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs @@ -140,20 +140,14 @@ private LayerContainer createLayer(string name, ISkin skin, LegacyKaraokeSkinNot Name = name, Children = new[] { - getSpriteFromLookup(skin, LegacyKaraokeSkinConfigurationLookups.NoteHeadImage, layer).With(d => + getSpriteFromLookup(skin, LegacyKaraokeSkinConfigurationLookups.NoteHeadImage, layer)?.With(d => { - if (d == null) - return; - d.Name = "Head"; d.Anchor = Anchor.CentreLeft; d.Origin = Anchor.Centre; }), - getSpriteFromLookup(skin, LegacyKaraokeSkinConfigurationLookups.NoteBodyImage, layer).With(d => + getSpriteFromLookup(skin, LegacyKaraokeSkinConfigurationLookups.NoteBodyImage, layer)?.With(d => { - if (d == null) - return; - d.Name = "Body"; d.Anchor = Anchor.Centre; d.Origin = Anchor.Centre; @@ -164,11 +158,8 @@ private LayerContainer createLayer(string name, ISkin skin, LegacyKaraokeSkinNot d.Height = d.Texture?.DisplayHeight ?? 0; }), - getSpriteFromLookup(skin, LegacyKaraokeSkinConfigurationLookups.NoteTailImage, layer).With(d => + getSpriteFromLookup(skin, LegacyKaraokeSkinConfigurationLookups.NoteTailImage, layer)?.With(d => { - if (d == null) - return; - d.Name = "Tail"; d.Anchor = Anchor.CentreRight; d.Origin = Anchor.Centre; @@ -195,13 +186,10 @@ private LayerContainer createLayer(string name, ISkin skin, LegacyKaraokeSkinNot return null; } - Sprite? getSpriteByName(string spriteName) => (Sprite?)skin.GetAnimation(spriteName, true, true).With(d => + Sprite? getSpriteByName(string spriteName) => (Sprite?)skin.GetAnimation(spriteName, true, true)?.With(d => { switch (d) { - case null: - return; - case TextureAnimation animation: animation.IsPlaying = false; break; diff --git a/osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs b/osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs index 321bb0973..6567cebbd 100644 --- a/osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs +++ b/osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs @@ -52,7 +52,7 @@ public override void PlayAnimation() .ScaleTo(0.75f, 250) .FadeOut(200); - // osu!mania uses a custom fade length, so the base call is intentionally omitted. + // karaoke uses a custom fade length, so the base call is intentionally omitted. break; } } diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index 502e6083b..8b8c92c45 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -17,7 +17,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - +