Esempio n. 1
0
        public static void DrawCanvas(Rect viewRect)
        {
            DrawBackground();
            if (curNodeGraph == null || curNodeEditorState == null)
            {
                return;
            }
            curNodeEditorState.CurGraphRect = viewRect;
            if (!curNodeGraph.nodes.Exists(res => res.GetId.Equals("初始化")))
            {
                InitGraphNode();
            }
            for (int nodeCnt = 0; nodeCnt < curNodeGraph.nodes.Count; nodeCnt++)
            {
                if (curNodeGraph.nodes[nodeCnt] == null)
                {
                    curNodeGraph.nodes.RemoveAt(nodeCnt);
                    nodeCnt--;
                }
                else
                {
                    try
                    {
                        curNodeGraph.nodes[nodeCnt].Draw();
                    }
                    catch (IndexOutOfRangeException e)
                    {
                        curNodeGraph.Remove(curNodeGraph.nodes[nodeCnt]);
                        nodeCnt--;
                    }
                }
                //try
                //{
                //    curNodeGraph.nodes[nodeCnt].Draw();
                //}
                //catch (NullReferenceException e)
                //{
                //    curNodeEditorState = null;
                //    curNodeGraph = null;
                //    return;
                //}
            }

            if (CurNodeInputInfo == null || CurNodeInputInfo.EdState == null)
            {
                CurNodeInputInfo = new NodeInputInfo("test", curNodeEditorState);
            }
            DrawLink();
            DrawMessage();
            NodeInputSystem.DynamicInvoke(CurNodeInputInfo);
        }
Esempio n. 2
0
 public static void Init()
 {
     IsInit = false;
     NodeTypes.FetchNode();
     NodeInputSystem.Fetch();
     ConnectionType.Fetch();
     TreeNodeReflectionSystem.Fetch();
     NodeEditor.CreateManager();
     UnitEditor.CreateManager();
     IsInit = true;
     if (TrigInit != null)
     {
         TrigInit();
     }
 }