예제 #1
0
        public override void OpenContextual(ToolControl control)
        {
            activatorControl = control;
            var menu = new GenericMenu();

            menu.allowDuplicateNames = true;
            GameObjectContextMenu.Fill(targets, menu, activatorControl.activatorScreenPosition, null);
            menu.DropDown(activatorControl.activatorGuiPosition);
        }
        protected override void ContextClickedItem(int id)
        {
            var item = FindItem(id, rootItem);

            if (item is GameObjectItem gameObjectItem)
            {
                var selection = selectedGameObjects;

                GenericMenu.MenuFunction rename = null;

                if (selection.Length == 1)
                {
                    rename = () => BeginRename(gameObjectItem);
                }

                var activatorPosition = LudiqGUIUtility.GUIToScreenRect(GetItemRect(id));

                var menu = new GenericMenu();
                menu.allowDuplicateNames = true;
                GameObjectContextMenu.Fill(selection, menu, activatorPosition, rename);
                menu.ShowAsContext();
            }
        }