예제 #1
0
 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);
 }
예제 #2
0
        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);
        }
예제 #3
0
 public static void InvokeMenuItemClicked(ContextMenuData data, ContextContainer container)
 {
     OnMenuItemClicked?.Invoke(data, container);
 }