示例#1
0
 public virtual void DrawConnection()
 {
     foreach (BaseNodule nodule in nodules.OfType <OutputNodule> ())
     {
         foreach (BaseNodule connectedNodule in nodule.Nodules)
         {
             CanvasGUI.DrawConnection(nodule, connectedNodule, Color.cyan);
         }
     }
 }
        public static void OnGUI(EditorStates states)
        {
            States = states;
            EditorState curState = states.curState;

            CanvasGUI.BeginGroup(new Rect(curState.panDelta, curState.canvasSize), (states.curSpace | EventSpace.CanvasSpace) == EventSpace.CanvasSpace);

            for (int i = 0; i < Cache.Nodes.Count; i++)
            {
                Cache.Nodes.Get(i).DrawConnection();
            }

            if (curState.connectionIndex > -1)
            {
                BaseNodule startNodule = curState.selectedObject as BaseNodule;

                if (curState.connectionIndex > startNodule.Nodules.Count - 1)
                {
                    InputHandlers.OnSelectConnection(states);
                }
                else
                {
                    CanvasGUI.DrawConnection(startNodule, startNodule.Nodules.Get(curState.connectionIndex), Color.red);
                }
            }
            Cache.Nodes.OnGUI();

            CanvasGUI.EndGroup();
            CanvasGUI.BeginGroup(CanvasGUI.OptionRect, GUI.skin.box, states.curSpace == EventSpace.Actor);

            switch (tab)
            {
            case OptionTab.actor:
                Cache.Actors.OnGUI();
                break;

            case OptionTab.condition:
                Cache.Conditions.OnGUI();
                break;
            }

            if (CanvasGUI.Button(new Rect(5, 5, 70, 20), "Conditions"))
            {
                tab = OptionTab.condition;
            }
            else if (CanvasGUI.Button(new Rect(80, 5, 50, 20), "Actors"))
            {
                tab = OptionTab.actor;
            }

            CanvasGUI.EndGroup();
        }