public void Show(ContextMenuData context, Vector2 pos) { _root = Utility.CreatePrefab <ContextContainer>("Prefabs/ContextContainer", _rect); _root.Init(context.children.ToArray()); _rect.localPosition = pos; gameObject.SetActive(true); }
private void OnMenuItemClicked(ContextMenuData data, ContextContainer container) { List <ContextContainer> toRemove = new List <ContextContainer>(); foreach (var item in _subContainers) { if (item.depthLevel > data.Level) { toRemove.Add(item); } } foreach (var item in toRemove) { Destroy(item.gameObject); _subContainers.Remove(item); } _subContainers.Add(container); }
public static void InvokeMenuItemClicked(ContextMenuData data, ContextContainer container) { OnMenuItemClicked?.Invoke(data, container); }