예제 #1
0
        private void HandleContextMenu()
        {
            Event current = Event.current;

            if (current.type != EventType.ContextClick)
            {
                return;
            }
            GenericMenu genericMenu = new GenericMenu();

            genericMenu.AddItem(new GUIContent("Create State/Empty"), false, new GenericMenu.MenuFunction2(this.AddStateEmptyCallback), Event.current.mousePosition);
            if (GraphGUI.HasMotionSelected())
            {
                genericMenu.AddItem(new GUIContent("Create State/From Selected Clip"), false, new GenericMenu.MenuFunction2(this.AddStateFromSelectedMotionCallback), Event.current.mousePosition);
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("Create State/From Selected Clip"));
            }
            genericMenu.AddItem(new GUIContent("Create State/From New Blend Tree"), false, new GenericMenu.MenuFunction2(this.AddStateFromNewBlendTreeCallback), Event.current.mousePosition);
            genericMenu.AddItem(new GUIContent("Create Sub-State Machine"), false, new GenericMenu.MenuFunction2(this.AddStateMachineCallback), Event.current.mousePosition);
            if (Unsupported.HasStateMachineDataInPasteboard())
            {
                genericMenu.AddItem(new GUIContent("Paste"), false, new GenericMenu.MenuFunction2(this.PasteCallback), Event.current.mousePosition);
            }
            else
            {
                genericMenu.AddDisabledItem(new GUIContent("Paste"));
            }
            genericMenu.AddItem(new GUIContent("Copy current StateMachine"), false, new GenericMenu.MenuFunction2(this.CopyStateMachineCallback), Event.current.mousePosition);
            genericMenu.ShowAsContext();
        }