Exemple #1
0
        static public void OnRightClickNode(Routine routine, Event mouseEvent, Node clickedNode)
        {
            if (mouseEvent.type == EventType.MouseUp)
            {
                GenericMenu menu = new GenericMenu();
                if (clickedNode != routine.finalNode)
                {
                    if (routine.NodeEligibleAsFinal(clickedNode))
                    {
                        SetNodeFinalCallbackObject setNodeFinalCallbackObject = new SetNodeFinalCallbackObject
                        {
                            routine      = routine,
                            newFinalNode = clickedNode
                        };
                        menu.AddItem(new GUIContent("Set as Final node"), false, SetNodeAsFinalNode, setNodeFinalCallbackObject);
                    }

                    DeleteNodeCallbackObject deleteNodeCallbackObject = new DeleteNodeCallbackObject
                    {
                        routine      = routine,
                        nodeToDelete = clickedNode
                    };
                    menu.AddItem(new GUIContent("Delete node/Validate"), false, DeleteNodeCallback, deleteNodeCallbackObject);
                }
                menu.ShowAsContext();
            }
        }
Exemple #2
0
        static private void SetNodeAsFinalNode(object obj)
        {
            SetNodeFinalCallbackObject setNodeFinalCallbackObject = (SetNodeFinalCallbackObject)obj;

            setNodeFinalCallbackObject.routine.finalNode = setNodeFinalCallbackObject.newFinalNode;
        }