Пример #1
0
        protected override void InitCanvas()
        {
            titleContent = new GUIContent("AI Designer");
            base.InitCanvas();
            GraphCanvas.LocalRect = new Rect(-50000, -50000, 100000, 100000);

            mWires = new BTWireGUI(this);
            GraphCanvas.AddElement(mWires);

            AIGraph           = new EditorGUICanvas();
            AIGraph.LocalRect = new Rect(-50000, -50000, 100000, 100000);
            GraphCanvas.AddElement(AIGraph);

            RootNode = new BTRootNodeGUI(this);
            AIGraph.AddElement(RootNode);

            BlackboardMonitor           = new BlackboardMonitorGUI(this);
            BlackboardMonitor.LocalRect = new Rect(0, 0, 200, 180);
            RootCanvas.AddElement(BlackboardMonitor);

            HelpBox           = new BehaviourHelpGUI();
            HelpBox.SortOrder = -10;
            RootCanvas.AddElement(HelpBox);

            mSelectionRect         = new EditorSelection();
            mSelectionRect.Visible = false;
            GraphCanvas.AddElement(mSelectionRect);

            Tip = new TipBox();
            RootCanvas.AddElement(Tip);

            RootCanvas.Resort(true);
        }
Пример #2
0
        public void Show(EditorGUICanvas canvas, Vector2 localPos)
        {
            if (Parent != null || canvas == null)
            {
                return;
            }
            Installizer.contentStyle.fontSize = 12;
            Vector2 size = Installizer.SizeOfContent(mText ?? "") + new Vector2(10, 10);
            Rect    r    = new Rect();

            r.size     = size;
            r.position = localPos - r.size * 0.5f;
            LocalRect  = r;
            mTick      = JDateTime.NowMillies;
            canvas.AddElement(this);
        }
Пример #3
0
        public BehaviourTreeDesignerWindow() : base()
        {
            mMaxScale            = 2;
            GraphCanvas.GridSize = 200;
            SelectionRect        = new SelectionGUI();
            RootCanvas.AddElement(SelectionRect);
            ScaledCanvas.Pivot = new Vector2(0.5f, 0.25f);
            GraphCanvas.Pivot  = new Vector2(0.5f, 0.1f);
            Rect r = GraphCanvas.LocalRect;

            r.position            = new Vector2(-0.5f * r.width, -0.1f * r.height);
            GraphCanvas.LocalRect = r;

            TreeGraph = new Graph <PaintElement>(1);

            Rect grect = new Rect(-GraphCanvas.LocalRect.size * 0.5f, GraphCanvas.LocalRect.size);
            BehaviourTreeWireGUI wires = new BehaviourTreeWireGUI(this);

            wires.LocalRect = grect;
            GraphCanvas.AddElement(wires);

            TreeCanvas           = new EditorGUICanvas();
            TreeCanvas.LocalRect = grect;
            GraphCanvas.AddElement(TreeCanvas);

            CommentCanvas           = new EditorGUICanvas();
            CommentCanvas.SortOrder = -2;
            CommentCanvas.LocalRect = grect;
            GraphCanvas.AddElement(CommentCanvas);

            ContextMenu = new BehaviourTreeContextMenuGUI(this);
            GraphCanvas.AddElement(ContextMenu);

            BlackboardMonitorGUI blackboard = new BlackboardMonitorGUI(this);

            blackboard.LocalRect = new Rect(0, 0, 200, 180);
            RootCanvas.AddElement(blackboard);

            RootCanvas.Resort(true);

            GraphCanvas.OnDragBegin  = OnGraphDragBegin;
            GraphCanvas.OnDrag       = OnGraphDrag;
            GraphCanvas.OnDragEnd    = OnGraphDragEnd;
            GraphCanvas.OnMouseClick = OnGraphClick;
            GraphCanvas.OnKeyUp      = OnGraphKeyUp;
        }
        protected virtual void InitCanvas()
        {
            RootCanvas       = new EditorGUICanvas();
            RootCanvas.Pivot = new Vector2(0, 0);

            ScaledCanvas           = new EditorGUICanvas();
            ScaledCanvas.SortOrder = -1;
            RootCanvas.AddElement(ScaledCanvas);

            GraphCanvas = new EditorGUICanvas();
            ScaledCanvas.AddElement(GraphCanvas);

            GraphCanvas.GridLineColor = new Color(0.2f, 0.2f, 0.2f, 1f);
            GraphCanvas.ShowGridLine  = true;
            GraphCanvas.GridSize      = 100;
            GraphCanvas.LocalRect     = new Rect(-10000, -10000, 20000, 20000);
        }