Esempio n. 1
0
        /// <summary>
        /// Handles when a behaviour is supposed to be presented to the user.
        /// </summary>
        /// <param name="node">The behaviour which will be presented to the user.</param>
        private BehaviorTreeViewDock behaviorTreeList_ShowBehavior(BehaviorNode node)
        {
            // check if there is a tab for the behaviour
            BehaviorTreeViewDock dock    = BehaviorTreeViewDock.GetBehaviorTreeViewDock(node);
            BehaviorTreeView     control = dock == null ? null : dock.BehaviorTreeView;

            // if not create one.
            if (control == null)
            {
                control                  = new BehaviorTreeView();
                control.Dock             = DockStyle.Fill;
                control.RootNode         = node;
                control.EdgePen          = _edgePen;
                control.EdgePenReadOnly  = _edgePenReadOnly;
                control.BehaviorTreeList = behaviorTreeList;

                control.ClickNode       += new BehaviorTreeView.ClickNodeEventDelegate(control_ClickNode);
                control.ClickEvent      += new BehaviorTreeView.ClickEventEventDelegate(control_ClickEvent);
                control.DoubleClickNode += new BehaviorTreeView.ClickNodeEventDelegate(control_DoubleClickNode);

                dock                  = new BehaviorTreeViewDock();
                dock.Text             = ((Node)node).Label;
                dock.TabText          = ((Node)node).Label;
                dock.BehaviorTreeView = control;
                dock.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
            }

            dock.Focus();

            return(dock);
        }
Esempio n. 2
0
        /// <summary>
        /// Handles when a behaviour is supposed to be presented to the user.
        /// </summary>
        /// <param name="node">The behaviour which will be presented to the user.</param>
        private BehaviorTreeViewDock behaviorTreeList_ShowBehavior(BehaviorNode node)
        {
            // check if there is a tab for the behaviour
            BehaviorTreeViewDock dock    = BehaviorTreeViewDock.GetBehaviorTreeViewDock(node);
            BehaviorTreeView     control = dock == null ? null : dock.BehaviorTreeView;

            // if not create one.
            if (control == null)
            {
                dock       = new BehaviorTreeViewDock();
                dock.Title = ((Node)node).Label;

                control = dock.BehaviorTreeView;

                control.RootNode = node;

                control.EdgePen          = _edgePen;
                control.EdgePenReadOnly  = _edgePenReadOnly;
                control.BehaviorTreeList = behaviorTreeList;

                control.ClickNode       += control_ClickNode;
                control.ClickEvent      += control_ClickEvent;
                control.DoubleClickNode += control_DoubleClickNode;

                dock.Show(dockManager);
                dock.Activate();
            }

            dock.Focus();

            return(dock);
        }
Esempio n. 3
0
        /// <summary>
        /// Handles when a behaviour is supposed to be presented to the user.
        /// </summary>
        /// <param name="node">The behaviour which will be presented to the user.</param>
        private BehaviorTreeViewDock behaviorTreeList_ShowBehavior(BehaviorNode node)
        {
            // check if there is a tab for the behaviour
            BehaviorTreeViewDock dock= BehaviorTreeViewDock.GetBehaviorTreeViewDock(node);
            BehaviorTreeView control= dock ==null ? null : dock.BehaviorTreeView;

            // if not create one.
            if(control ==null)
            {
                control= new BehaviorTreeView();
                control.Dock= DockStyle.Fill;
                control.RootNode= node;
                control.EdgePen= _edgePen;
                control.EdgePenReadOnly= _edgePenReadOnly;
                control.BehaviorTreeList= behaviorTreeList;

                control.ClickNode+= new BehaviorTreeView.ClickNodeEventDelegate(control_ClickNode);
                control.ClickEvent+= new BehaviorTreeView.ClickEventEventDelegate(control_ClickEvent);
                control.DoubleClickNode+= new BehaviorTreeView.ClickNodeEventDelegate(control_DoubleClickNode);

                dock= new BehaviorTreeViewDock();
                dock.Text= ((Node)node).Label;
                dock.TabText= ((Node)node).Label;
                dock.BehaviorTreeView= control;
                dock.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
            }

            dock.Focus();

            return dock;
        }