Example #1
0
//    [DidReloadScripts(1)]
//    static void DidReloadScripts()
//    {
//        Debug.Log( "Did Reload Scripts" );
//        //if( _instance == null )
//        //{
//        //    GetInstance().nodes.Clear();
//
//        //}
//
//    }
    public override void OnXGUI()
    {
        //TODO List

        Event e = Event.current;

        mousePosition = e.mousePosition;

        if (e.button == 0 || e.button == 1)
        {
            ChooseNode();
        }
        bool isFixUpConfig = false;

        if (e.button == 1 && e.type == EventType.MouseUp)
        {
            GraphMenu m = new GraphMenu(SelectedIndex);
            e.Use();
        }
        else if (e.button == 0 && e.type == EventType.MouseUp && IsTransition)
        {
            if (IsClickNode && !SelectedNode.Equals(InputNode))
            {
                SelectedNode.SetInputNode(InputNode, mousePosition);
            }

            isFixUpConfig = true;
        }
        BeginWindows();

        for (int i = 0; i < nodes.Count; i++)
        {
            //  nodes[i].GraphRect = GUI.Window(i, nodes[i].GraphRect, DrawNodeGraph, nodes[i].GraphTitle);
            nodes [i].Draw(i);
        }
        if (isFixUpConfig)
        {
            IsTransition = false;
        }

        EndWindows();

        if (IsTransition)
        {
            DrawTransitionCurve();
        }
        for (int i = 0; i < nodes.Count; i++)
        {
            nodes [i].DrawCurves();
        }
    }