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 a95fce3e2..fef70f0ac 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/osu.Game.Rulesets.Karaoke.Tests.csproj b/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj index 0f403251f..bb51e8352 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj +++ b/osu.Game.Rulesets.Karaoke.Tests/osu.Game.Rulesets.Karaoke.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyAttributes.cs b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyAttributes.cs index 2eb1aaf2e..9c71e2e97 100644 --- a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyAttributes.cs @@ -30,10 +30,7 @@ public class KaraokeDifficultyAttributes : DifficultyAttributes foreach (var v in base.ToDatabaseAttributes()) yield return v; - // Todo: osu!mania doesn't output MaxCombo attribute for some reason. yield return (ATTRIB_ID_DIFFICULTY, StarRating); - yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow); - yield return (ATTRIB_ID_SCORE_MULTIPLIER, ScoreMultiplier); } public override void FromDatabaseAttributes(IReadOnlyDictionary values, IBeatmapOnlineInfo onlineInfo) @@ -41,7 +38,5 @@ public override void FromDatabaseAttributes(IReadOnlyDictionary val base.FromDatabaseAttributes(values, onlineInfo); StarRating = values[ATTRIB_ID_DIFFICULTY]; - GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW]; - ScoreMultiplier = values[ATTRIB_ID_SCORE_MULTIPLIER]; } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/KaraokeBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Edit/KaraokeBlueprintContainer.cs index d072ebe27..5f5ab6e4a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/KaraokeBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/KaraokeBlueprintContainer.cs @@ -2,12 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Karaoke.Edit.Blueprints.Lyrics; using osu.Game.Rulesets.Karaoke.Edit.Blueprints.Notes; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Edit.Compose.Components; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Edit; @@ -27,4 +30,7 @@ public override HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObjec }; protected override SelectionHandler CreateSelectionHandler() => new KaraokeSelectionHandler(); + + protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint blueprint, Vector2[] originalSnapPositions)> blueprints) + => false; } diff --git a/osu.Game.Rulesets.Karaoke/Edit/KaraokeHitObjectComposer.cs b/osu.Game.Rulesets.Karaoke/Edit/KaraokeHitObjectComposer.cs index 8749472cd..bf6649fb8 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/KaraokeHitObjectComposer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/KaraokeHitObjectComposer.cs @@ -117,16 +117,6 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl return null; } - public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) - { - var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType); - - // should not affect x position and time if dragging object in note playfield. - return result.Playfield is EditorNotePlayfield - ? new SnapResult(screenSpacePosition, null, result.Playfield) - : result; - } - protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList mods) { drawableRuleset = new DrawableKaraokeEditorRuleset(ruleset, beatmap, mods); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs index ebaf8959a..08be7cadf 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/RubyBlueprintContainer.cs @@ -8,6 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; +using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; @@ -38,6 +39,9 @@ protected override SelectionBlueprint CreateBlueprintFor(RubyTag item) protected override IEnumerable> SortForMovement(IReadOnlyList> blueprints) => blueprints.OrderBy(b => b.Item.StartIndex); + protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint blueprint, Vector2[] originalSnapPositions)> blueprints) + => false; + protected partial class RubyTagSelectionHandler : LyricPropertySelectionHandler { [Resolved] diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/TimeTagBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/TimeTagBlueprintContainer.cs index 1855f7d85..c531a8060 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/TimeTagBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/Blueprints/TimeTagBlueprintContainer.cs @@ -4,11 +4,13 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.States.Modes; using osu.Game.Screens.Edit.Compose.Components; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content.Components.Lyrics.Blueprints; @@ -28,6 +30,9 @@ protected override SelectionHandler CreateSelectionHandler() protected override SelectionBlueprint CreateBlueprintFor(TimeTag item) => new TimeTagSelectionBlueprint(item); + protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint blueprint, Vector2[] originalSnapPositions)> blueprints) + => false; + protected partial class TimeTagSelectionHandler : LyricPropertySelectionHandler { [Resolved] diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagBlueprintContainer.cs index a0203f47e..c09f22288 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagBlueprintContainer.cs @@ -20,6 +20,7 @@ using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; using osu.Game.Screens.Edit.Compose.Components; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content.Compose.BottomEditor.AdjustTimeTags; @@ -44,15 +45,14 @@ private void load(BindableList timeTags) protected override IEnumerable> SortForMovement(IReadOnlyList> blueprints) => blueprints.OrderBy(b => b.Item.Index); - protected override bool ApplySnapResult(SelectionBlueprint[] blueprints, SnapResult result) + protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint blueprint, Vector2[] originalSnapPositions)> blueprints) { - if (!base.ApplySnapResult(blueprints, result)) - return false; + var result = timeline.FindSnappedPositionAndTime(e.ScreenSpaceMousePosition); if (result.Time == null) return false; - var timeTags = blueprints.OfType().Select(x => x.Item).ToArray(); + var timeTags = blueprints.Select(x => x.blueprint).OfType().Select(x => x.Item).ToArray(); var firstTimeTag = timeTags.FirstOrDefault(); if (firstTimeTag == null) return false; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagScrollContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagScrollContainer.cs index 85c9ea2d1..a4d509a4a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagScrollContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/AdjustTimeTags/AdjustTimeTagScrollContainer.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content.Compose.BottomEditor.AdjustTimeTags; [Cached] -public partial class AdjustTimeTagScrollContainer : TimeTagScrollContainer, IPositionSnapProvider +public partial class AdjustTimeTagScrollContainer : TimeTagScrollContainer { public const float TIMELINE_HEIGHT = 38; @@ -85,7 +85,7 @@ protected override void UpdateAfterChildren() currentTimeMarker?.MoveToX(position); } - public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { double time = TimeAtPosition(Content.ToLocalSpace(screenSpacePosition).X); return new SnapResult(screenSpacePosition, time); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/Notes/NoteEditorBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/Notes/NoteEditorBlueprintContainer.cs index 53b447450..f2fd45704 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/Notes/NoteEditorBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/BottomEditor/Notes/NoteEditorBlueprintContainer.cs @@ -4,10 +4,12 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.States.Modes; using osu.Game.Screens.Edit.Compose.Components; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content.Compose.BottomEditor.Notes; @@ -18,6 +20,12 @@ protected override SelectionBlueprint CreateBlueprintFor(Note hitObject) protected override SelectionHandler CreateSelectionHandler() => new NoteEditorSelectionHandler(); + protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint blueprint, Vector2[] originalSnapPositions)> blueprints) + { + // todo: implement able to drag to change the tone. + return false; + } + [BackgroundDependencyLoader] private void load(BindableList notes) { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimeline.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimeline.cs index f1d845244..6704c0de5 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimeline.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimeline.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Timeline; [Cached] -public partial class EditableTimeline : BindableScrollContainer, IPositionSnapProvider +public partial class EditableTimeline : BindableScrollContainer { [Resolved] private EditorClock editorClock { get; set; } = null!; @@ -63,7 +63,7 @@ public float PositionAtTime(double time) return (float)(time / editorClock.TrackLength * Content.DrawWidth); } - public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All) + public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition) { double time = TimeAtPosition(Content.ToLocalSpace(screenSpacePosition).X); return new SnapResult(screenSpacePosition, time); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimelineBlueprintContainer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimelineBlueprintContainer.cs index f78bed8b7..1e2360362 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimelineBlueprintContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Components/Timeline/EditableTimelineBlueprintContainer.cs @@ -13,11 +13,15 @@ using osu.Game.Rulesets.Edit; using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; using osu.Game.Screens.Edit.Compose.Components; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Timeline; public partial class EditableTimelineBlueprintContainer : BlueprintContainer where TItem : class { + [Resolved] + private EditableTimeline timeline { get; set; } = null!; + protected readonly IBindableList Items = new BindableList(); public EditableTimelineBlueprintContainer() @@ -46,15 +50,14 @@ protected override void SelectAll() SelectedItems.AddRange(Items); } - protected sealed override bool ApplySnapResult(SelectionBlueprint[] blueprints, SnapResult result) + protected override bool TryMoveBlueprints(DragEvent e, IList<(SelectionBlueprint blueprint, Vector2[] originalSnapPositions)> blueprints) { - if (!base.ApplySnapResult(blueprints, result)) - return false; + var result = timeline.FindSnappedPositionAndTime(e.ScreenSpaceMousePosition); if (result.Time == null) return false; - var items = blueprints.Select(x => x.Item).ToArray(); + var items = blueprints.Select(x => x.blueprint.Item).ToArray(); double time = result.Time.Value; return ApplyOffsetResult(items, time); } diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index af37598df..d63eca955 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -9,7 +9,7 @@ - + @@ -17,13 +17,13 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - +