Fix verb menu not loading (#13454)
This commit is contained in:
@@ -108,7 +108,6 @@ namespace Content.Client.ContextMenu.UI
|
||||
CancelOpen?.Cancel();
|
||||
CancelOpen = new();
|
||||
Timer.Spawn(HoverDelay, () => OpenSubMenu(element), CancelOpen.Token);
|
||||
OnContextMouseEntered?.Invoke(element);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -64,7 +64,6 @@ namespace Content.Client.ContextMenu.UI
|
||||
{
|
||||
_updating = true;
|
||||
_cfg.OnValueChanged(CCVars.EntityMenuGroupingType, OnGroupingChanged, true);
|
||||
_context.OnContextMouseEntered += OnMouseEntered;
|
||||
_context.OnContextKeyEvent += OnKeyBindDown;
|
||||
|
||||
CommandBinds.Builder
|
||||
@@ -77,7 +76,6 @@ namespace Content.Client.ContextMenu.UI
|
||||
_updating = false;
|
||||
Elements.Clear();
|
||||
_cfg.UnsubValueChanged(CCVars.EntityMenuGroupingType, OnGroupingChanged);
|
||||
_context.OnContextMouseEntered -= OnMouseEntered;
|
||||
_context.OnContextKeyEvent -= OnKeyBindDown;
|
||||
CommandBinds.Unregister<EntityMenuUIController>();
|
||||
}
|
||||
@@ -101,25 +99,6 @@ namespace Content.Client.ContextMenu.UI
|
||||
_context.RootMenu.Open(box);
|
||||
}
|
||||
|
||||
public void OnMouseEntered(ContextMenuElement element)
|
||||
{
|
||||
if (element is not EntityMenuElement entityElement)
|
||||
return;
|
||||
|
||||
// get an entity associated with this element
|
||||
var entity = entityElement.Entity;
|
||||
|
||||
// if there is none, this is a group, so don't open verbs
|
||||
if (entity == null)
|
||||
return;
|
||||
|
||||
// Deleted() automatically checks for null & existence.
|
||||
if (_entityManager.Deleted(entity))
|
||||
return;
|
||||
|
||||
_verb.OpenVerbMenu(entity.Value, popup: element.SubMenu);
|
||||
}
|
||||
|
||||
public void OnKeyBindDown(ContextMenuElement element, GUIBoundKeyEventArgs args)
|
||||
{
|
||||
if (element is not EntityMenuElement entityElement)
|
||||
@@ -241,6 +220,9 @@ namespace Content.Client.ContextMenu.UI
|
||||
{
|
||||
var element = new EntityMenuElement(entity);
|
||||
element.SubMenu = new ContextMenuPopup(_context, element);
|
||||
element.SubMenu.OnPopupOpen += () => _verb.OpenVerbMenu(entity, popup: element.SubMenu);
|
||||
element.SubMenu.OnPopupHide += element.SubMenu.MenuBody.DisposeAllChildren;
|
||||
|
||||
_context.AddElement(_context.RootMenu, element);
|
||||
Elements.TryAdd(entity, element);
|
||||
}
|
||||
@@ -258,6 +240,8 @@ namespace Content.Client.ContextMenu.UI
|
||||
// this group only has a single entity, add a simple menu element
|
||||
var element = new EntityMenuElement(group[0]);
|
||||
element.SubMenu = new ContextMenuPopup(_context, element);
|
||||
element.SubMenu.OnPopupOpen += () => _verb.OpenVerbMenu(group[0], popup: element.SubMenu);
|
||||
element.SubMenu.OnPopupHide += element.SubMenu.MenuBody.DisposeAllChildren;
|
||||
_context.AddElement(_context.RootMenu, element);
|
||||
Elements.TryAdd(group[0], element);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user