Skip to content

Commit

Permalink
Note popover only use in the lyric editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Apr 7, 2024
1 parent 70c1c6f commit 984a4ea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Karaoke.Edit.Blueprints.Notes.Components;
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Notes;
using osu.Game.Rulesets.Karaoke.Edit.Components.UserInterfaceV2;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.UI;
using osu.Game.Rulesets.Karaoke.UI.Position;
Expand All @@ -20,7 +17,7 @@

namespace osu.Game.Rulesets.Karaoke.Edit.Blueprints.Notes;

public partial class NoteSelectionBlueprint : KaraokeSelectionBlueprint<Note>, IHasPopover
public partial class NoteSelectionBlueprint : KaraokeSelectionBlueprint<Note>
{
[Resolved]
private INotesChangeHandler notesChangeHandler { get; set; } = null!;
Expand Down Expand Up @@ -72,15 +69,12 @@ protected override void Update()
new OsuMenuItem("Split", MenuItemType.Destructive, () => notesChangeHandler.Split()),
};

public Popover GetPopover() => new NoteEditPopover(HitObject);

protected override bool OnClick(ClickEvent e)
{
// should only select current note before open the popover because note change handler will change property in all selected notes.
beatmap.SelectedHitObjects.Clear();
beatmap.SelectedHitObjects.Add(HitObject);

this.ShowPopover();
return base.OnClick(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Notes;
using osu.Game.Rulesets.Karaoke.Edit.Components.Containers;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Edit.Components.UserInterfaceV2;
namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Compose.BottomEditor.Notes;

public partial class NoteEditPopover : OsuPopover
{
Expand All @@ -40,6 +39,7 @@ public NoteEditPopover(Note note)

private partial class NoteSection : Section
{
[Resolved]
private INotePropertyChangeHandler notePropertyChangeHandler { get; set; } = null!;

protected override LocalisableString Title => "Note property";
Expand Down Expand Up @@ -102,13 +102,5 @@ public NoteSection(Note note)
notePropertyChangeHandler.ChangeDisplayState(v.NewValue);
});
}

[BackgroundDependencyLoader]
private void load(HitObjectComposer composer)
{
// todo: not a good way to get change handler, might remove or found another way eventually.
// cannot get change handler directly in editor screen, so should trying to get from karaoke hit object composer.
notePropertyChangeHandler = composer.Dependencies.Get<INotePropertyChangeHandler>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using osu.Game.Rulesets.Karaoke.Edit.Blueprints.Notes;
using osu.Game.Rulesets.Karaoke.Edit.Blueprints.Notes.Components;
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Notes;
using osu.Game.Rulesets.Karaoke.Edit.Components.UserInterfaceV2;
using osu.Game.Rulesets.Karaoke.Objects;
using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.States.Modes;
using osu.Game.Rulesets.Karaoke.UI.Position;
Expand Down

0 comments on commit 984a4ea

Please sign in to comment.