diff --git a/osu.Game.Rulesets.Karaoke.Architectures/osu.Game.Rulesets.Karaoke.Architectures.csproj b/osu.Game.Rulesets.Karaoke.Architectures/osu.Game.Rulesets.Karaoke.Architectures.csproj index 08486b3e8..7bcd25024 100644 --- a/osu.Game.Rulesets.Karaoke.Architectures/osu.Game.Rulesets.Karaoke.Architectures.csproj +++ b/osu.Game.Rulesets.Karaoke.Architectures/osu.Game.Rulesets.Karaoke.Architectures.csproj @@ -11,7 +11,7 @@ - + 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.Tests/Skinning/TestSceneDrawableJudgement.cs b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs index 542b45f30..bac4ff048 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs @@ -6,6 +6,7 @@ using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Karaoke.Objects.Drawables; using osu.Game.Rulesets.Karaoke.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; @@ -19,7 +20,7 @@ public TestSceneDrawableJudgement() foreach (var result in Enum.GetValues().Skip(1)) { AddStep("Show " + result.GetDescription(), () => SetContents(_ => - new DrawableNoteJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null) + new DrawableNoteJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, new DrawableNote()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs index 487a4dfd7..f631e52a1 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Beatmaps; @@ -10,13 +11,12 @@ using osu.Game.Rulesets.Karaoke.Stages; using osu.Game.Rulesets.Karaoke.Stages.Preview; using osu.Game.Rulesets.Karaoke.Stages.Types; +using osu.Game.Screens.Edit; namespace osu.Game.Rulesets.Karaoke.Beatmaps; public class KaraokeBeatmapProcessor : BeatmapProcessor { - public new KaraokeBeatmap Beatmap => (KaraokeBeatmap)base.Beatmap; - public KaraokeBeatmapProcessor(IBeatmap beatmap) : base(beatmap) { @@ -24,10 +24,24 @@ public KaraokeBeatmapProcessor(IBeatmap beatmap) public override void PreProcess() { - applyStage(Beatmap); + var karaokeBeatmap = getKaraokeBeatmap(Beatmap); + applyStage(karaokeBeatmap); base.PreProcess(); - applyInvalidProperty(Beatmap); + applyInvalidProperty(karaokeBeatmap); + + static KaraokeBeatmap getKaraokeBeatmap(IBeatmap beatmap) + { + // goes to there while parsing the beatmap. + if (beatmap is KaraokeBeatmap karaokeBeatmap) + return karaokeBeatmap; + + // goes to there while editing the beatmap. + if (beatmap is EditorBeatmap editorBeatmap) + return getKaraokeBeatmap(editorBeatmap.PlayableBeatmap); + + throw new InvalidCastException($"The beatmap is not a {nameof(KaraokeBeatmap)}"); + } } private void applyStage(KaraokeBeatmap beatmap) @@ -36,7 +50,7 @@ private void applyStage(KaraokeBeatmap beatmap) // trying to load the first stage or create a default one. if (beatmap.CurrentStageInfo == null) { - beatmap.CurrentStageInfo = getWorkingStage() ?? createDefaultWorkingStage(); + beatmap.CurrentStageInfo = getWorkingStage(beatmap) ?? createDefaultWorkingStage(); // should invalidate the working property here because the stage info is changed. beatmap.HitObjects.OfType().ForEach(x => @@ -50,10 +64,10 @@ private void applyStage(KaraokeBeatmap beatmap) if (beatmap.CurrentStageInfo is IHasCalculatedProperty calculatedProperty) calculatedProperty.ValidateCalculatedProperty(beatmap); - StageInfo? getWorkingStage() - => Beatmap.StageInfos.FirstOrDefault(); + static StageInfo? getWorkingStage(KaraokeBeatmap beatmap) + => beatmap.StageInfos.FirstOrDefault(); - StageInfo createDefaultWorkingStage() => new PreviewStageInfo(); + static StageInfo createDefaultWorkingStage() => new PreviewStageInfo(); } private void applyInvalidProperty(KaraokeBeatmap beatmap) diff --git a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LabelledRealTimeSliderBar.cs b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LabelledRealTimeSliderBar.cs index 8816d9fd7..ec816d46e 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LabelledRealTimeSliderBar.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LabelledRealTimeSliderBar.cs @@ -1,15 +1,15 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays.Settings; +using System.Numerics; namespace osu.Game.Rulesets.Karaoke.Graphics.UserInterfaceV2; public partial class LabelledRealTimeSliderBar : LabelledSliderBar - where TNumber : struct, IEquatable, IComparable, IConvertible + where TNumber : struct, INumber, IMinMaxValue { protected override SettingsSlider CreateComponent() => base.CreateComponent().With(x => x.TransferValueOnCommit = false); diff --git a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LanguageSelector.cs b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LanguageSelector.cs index 52b378d43..b093fe877 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LanguageSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/UserInterfaceV2/LanguageSelector.cs @@ -85,7 +85,7 @@ protected override void OnFocus(FocusEvent e) { base.OnFocus(e); - GetContainingInputManager().ChangeFocus(filter); + GetContainingFocusManager().ChangeFocus(filter); } private bool enableEmptyOption; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LanguageSelectorPopover.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LanguageSelectorPopover.cs index 0688d849b..11b414988 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LanguageSelectorPopover.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LanguageSelectorPopover.cs @@ -32,6 +32,6 @@ protected override void LoadComplete() { base.LoadComplete(); - GetContainingInputManager().ChangeFocus(languageSelector); + GetContainingFocusManager().ChangeFocus(languageSelector); } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LyricSelector.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LyricSelector.cs index 9847efde4..a966c85ee 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LyricSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Components/UserInterfaceV2/LyricSelector.cs @@ -87,7 +87,7 @@ protected override void OnFocus(FocusEvent e) { base.OnFocus(e); - GetContainingInputManager().ChangeFocus(filter); + GetContainingFocusManager().ChangeFocus(filter); } private partial class LyricSelectionSearchTextBox : SearchTextBox 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/Components/Lyrics/Blueprints/RubyTagSelectionBlueprint.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyTagSelectionBlueprint.cs index de3c78cc2..afb9ca999 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyTagSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/RubyTagSelectionBlueprint.cs @@ -214,7 +214,7 @@ void deleteRubyText() protected override void LoadComplete() { base.LoadComplete(); - ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(labelledRubyTextBox)); + ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(labelledRubyTextBox)); } private partial class DeleteRubyButton : EditorSectionButton diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableCreateRubyTagCaret.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableCreateRubyTagCaret.cs index 6f8f12d77..4f04300ef 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableCreateRubyTagCaret.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableCreateRubyTagCaret.cs @@ -191,7 +191,7 @@ private void addRubyText() if (string.IsNullOrEmpty(rubyText)) { labelledRubyTextBox.Description = "Please enter the ruby text"; - GetContainingInputManager().ChangeFocus(labelledRubyTextBox); + GetContainingFocusManager().ChangeFocus(labelledRubyTextBox); return; } @@ -208,7 +208,7 @@ private void addRubyText() protected override void LoadComplete() { base.LoadComplete(); - ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(labelledRubyTextBox)); + ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(labelledRubyTextBox)); } private partial class CreateRubyLabelledTextBox : LabelledTextBox diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableTypingCaret.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableTypingCaret.cs index 2c13ab474..ff45e94de 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableTypingCaret.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Components/Lyrics/Carets/DrawableTypingCaret.cs @@ -178,7 +178,7 @@ public void FocusInputCaretTextBox() Schedule(() => { inputCaretTextBox.Text = string.Empty; - GetContainingInputManager().ChangeFocus(inputCaretTextBox); + GetContainingFocusManager().ChangeFocus(inputCaretTextBox); }); } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditPopover.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditPopover.cs index f19f11076..8dc28b8f9 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditPopover.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/BottomEditor/Notes/NoteEditPopover.cs @@ -75,7 +75,7 @@ public NoteSection(Note note) ScheduleAfterChildren(() => { - GetContainingInputManager().ChangeFocus(text); + GetContainingFocusManager().ChangeFocus(text); }); text.OnCommit += (sender, newText) => 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/LyricEditorVerifier.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs index 7b1c81c6b..28c673b89 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs @@ -184,7 +184,7 @@ protected override void Dispose(bool isDisposing) base.Dispose(isDisposing); // todo: not very sure - if (!editorBeatmap.IsNull()) + if (editorBeatmap.IsNull()) return; editorBeatmap.HitObjectAdded -= hitObjectAdded; 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 57b4b988c..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,12 +94,15 @@ 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)) return; - GetContainingInputManager().ChangeFocus(Component); + GetContainingFocusManager().ChangeFocus(Component); }); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/LabelledReferenceLyricSelector.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/LabelledReferenceLyricSelector.cs index 2b72ed761..a64d4b1a9 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/LabelledReferenceLyricSelector.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/LabelledReferenceLyricSelector.cs @@ -105,7 +105,7 @@ protected override void LoadComplete() { base.LoadComplete(); - GetContainingInputManager().ChangeFocus(lyricSelector); + GetContainingFocusManager().ChangeFocus(lyricSelector); } } 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 ea69ad890..6567cebbd 100644 --- a/osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs +++ b/osu.Game.Rulesets.Karaoke/UI/DrawableNoteJudgement.cs @@ -5,46 +5,18 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osuTK; namespace osu.Game.Rulesets.Karaoke.UI; public partial class DrawableNoteJudgement : DrawableJudgement { - public DrawableNoteJudgement(JudgementResult result, DrawableHitObject? judgedObject) + public DrawableNoteJudgement(JudgementResult result, DrawableHitObject judgedObject) : base(result, judgedObject) { } - protected override void ApplyMissAnimations() + public DrawableNoteJudgement() { - if (JudgementBody.Drawable is not DefaultKaraokeJudgementPiece) - { - // this is temporary logic until mania's skin transformer returns IAnimatableJudgements - JudgementBody.ScaleTo(1.6f); - JudgementBody.ScaleTo(1, 100, Easing.In); - - JudgementBody.MoveTo(Vector2.Zero); - JudgementBody.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); - - JudgementBody.RotateTo(0); - JudgementBody.RotateTo(40, 800, Easing.InQuint); - JudgementBody.FadeOutFromOne(800); - - LifetimeEnd = JudgementBody.LatestTransformEndTime; - } - - base.ApplyMissAnimations(); - } - - protected override void ApplyHitAnimations() - { - JudgementBody.ScaleTo(0.8f); - JudgementBody.ScaleTo(1, 250, Easing.OutElastic); - - JudgementBody.Delay(50) - .ScaleTo(0.75f, 250) - .FadeOut(200); } protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultKaraokeJudgementPiece(result); @@ -62,5 +34,27 @@ protected override void LoadComplete() JudgementText.Font = JudgementText.Font.With(size: 25); } + + public override void PlayAnimation() + { + switch (Result) + { + case HitResult.None: + case HitResult.Miss: + base.PlayAnimation(); + break; + + default: + this.ScaleTo(0.8f); + this.ScaleTo(1, 250, Easing.OutElastic); + + this.Delay(50) + .ScaleTo(0.75f, 250) + .FadeOut(200); + + // 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 ae05555ae..7b401fc9b 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -10,14 +10,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - +