コード例 #1
0
        void DrawTree()
        {
            if (!_hasTarget)
            {
                var oldBg = GUI.backgroundColor;
                GUI.backgroundColor = ColorHelper.ByRGBA(200, 200, 200, 150);
                var rect = CanvasRect;
                rect.width  = 300;
                rect.height = 100;
                rect.x      = (CanvasRect.width - rect.width) * .5f;
                rect.y      = (CanvasRect.height - rect.height) * .5f;
                var style = new GUIStyle(EditorStyles.helpBox)
                {
                    fontSize  = 16,
                    alignment = TextAnchor.MiddleCenter,
                    richText  = true,
                };
                GUI.Box(rect, "选中的对象上没有行为树\n<i><size=14>当然也就没法编辑了</size></i>", style);
                GUI.backgroundColor = oldBg;
                return;
            }

            if (_treeData == null)
            {
                return;
            }

            GUI.BeginClip(CanvasRect);
            // draw windows
            BeginWindows();
            DrawNodeRecrusively(_treeData.rootNode, null, 0, 0, _tree._frameResult);
            EndWindows();
            GUI.EndClip();
        }