Merge `EditorContextMenuContainer` into `OsuContextMenuContainer`

This commit is contained in:
jkh675 2024-08-04 21:00:43 +08:00
parent 7c83d6a883
commit 2145368d17
6 changed files with 20 additions and 35 deletions

View File

@ -13,11 +13,18 @@ public partial class OsuContextMenuContainer : ContextMenuContainer
[Cached]
private OsuContextMenuSamples samples = new OsuContextMenuSamples();
public OsuContextMenuContainer()
private OsuContextMenu menu = null!;
protected override Menu CreateMenu() => menu = new OsuContextMenu(true);
public void ShowMenu()
{
AddInternal(samples);
menu.Show();
}
protected override Menu CreateMenu() => new OsuContextMenu(true);
public void CloseMenu()
{
menu.Close();
}
}
}

View File

@ -32,6 +32,7 @@
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Skinning;
using osu.Game.Graphics.Cursor;
namespace osu.Game.Overlays.SkinEditor
{
@ -101,7 +102,7 @@ public partial class SkinEditor : VisibilityContainer, ICanAcceptFiles, IKeyBind
private IDialogOverlay? dialogOverlay { get; set; }
[Cached]
public EditorContextMenuContainer ContextMenuContainer { get; private set; } = new EditorContextMenuContainer
public OsuContextMenuContainer ContextMenuContainer { get; private set; } = new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
};

View File

@ -1,27 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Edit.Components
{
public partial class EditorContextMenuContainer : OsuContextMenuContainer
{
public override bool ChangeFocusOnClick => true;
private OsuContextMenu menu = null!;
protected override Framework.Graphics.UserInterface.Menu CreateMenu() => menu = new OsuContextMenu(true);
public void ShowMenu()
{
menu.Show();
}
public void CloseMenu()
{
menu.Close();
}
}
}

View File

@ -15,6 +15,7 @@
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Edit;
@ -46,6 +47,9 @@ public abstract partial class BlueprintContainer<T> : CompositeDrawable, IKeyBin
protected readonly BindableList<T> SelectedItems = new BindableList<T>();
[Resolved(CanBeNull = true)]
private OsuContextMenuContainer contextMenuContainer { get; set; }
protected BlueprintContainer()
{
RelativeSizeAxes = Axes.Both;

View File

@ -16,11 +16,11 @@
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK;
using osuTK.Input;
@ -61,7 +61,7 @@ public abstract partial class SelectionHandler<T> : CompositeDrawable, IKeyBindi
public SelectionScaleHandler ScaleHandler { get; private set; }
[Resolved]
private EditorContextMenuContainer editorContextMenuContainer { get; set; }
private OsuContextMenuContainer editorContextMenuContainer { get; set; }
protected SelectionHandler()
{

View File

@ -31,6 +31,7 @@
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Localisation;
@ -42,7 +43,6 @@
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Menus;
using osu.Game.Screens.Edit.Compose;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
@ -77,7 +77,7 @@ public partial class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<Gl
public const float WAVEFORM_VISUAL_OFFSET = 20;
[Cached]
public EditorContextMenuContainer ContextMenuContainer { get; private set; } = new EditorContextMenuContainer
public OsuContextMenuContainer ContextMenuContainer { get; private set; } = new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both
};