Example #1
0
 public static void Closed()
 {
     if (null != window)
     {
         window.Close();
         window = null;
     }
 }
Example #2
0
        public static void ShowWindow()
        {
            window          = EditorWindow.GetWindow <TreeNodeWindow>();
            window.position = windowsPosition;
            window.autoRepaintOnSceneChange = true;
            window.Show();

            EditorPrefs.SetFloat(BehaviorTreeX, windowsPosition.x);
            EditorPrefs.SetFloat(BehaviorTreeY, windowsPosition.y);
            EditorPrefs.SetFloat(BehaviorTreeWidth, windowsPosition.width);
            EditorPrefs.SetFloat(BehaviorTreeHeight, windowsPosition.height);
        }
Example #3
0
        // 绘制节点
        private void DrawNodeWindows(List <NodeValue> nodeList)
        {
            Action CallBack = () =>
            {
                for (int i = 0; i < nodeList.Count; i++)
                {
                    NodeValue nodeValue = nodeList[i];
                    int       xConst    = 330;
                    int       yConst    = 0;
                    if (nodeValue.position.x < xConst || nodeValue.position.y < yConst)
                    {
                        float x = (nodeValue.position.x < xConst ? (xConst - nodeValue.position.x + 30) : 0);
                        float y = (nodeValue.position.y < yConst ? (yConst - nodeValue.position.y + 30) : 0);

                        Vector2 offset = new Vector2(x, y);
                        nodeValue.position.x += offset.x;
                        nodeValue.position.y += offset.y;

                        SyncChildNodePosition(nodeValue, offset);
                    }

                    GUI.enabled = !BehaviorDataController.Instance.CurrentOpenConfigSubTree();
                    string     name    = string.Format("{0}", nodeValue.nodeName);
                    GUIContent nameGui = new GUIContent(name, name);
                    Rect       rect    = GUI.Window(i, RectTool.RectTToRect(nodeValue.position), DrawNodeWindow, nameGui);
                    if (!BehaviorDataController.Instance.CurrentOpenConfigSubTree())
                    {
                        ResetNodePosition(nodeValue, rect);
                    }
                    GUI.enabled = true;

                    if (nodeValue.NodeType != (int)NODE_TYPE.SUB_TREE)
                    {
                        DrawToChildCurve(nodeValue);
                    }
                }
            };

            TreeNodeWindow._drawWindowCallBack(CallBack);
        }