示例#1
0
        private static void updateUI(int frame)
        {
            if (_timelineDock != null)
            {
                if (MessageQueue.IsConnected)
                {
                    HighlightBreakPoint breakPoint = HighlightBreakPoint.Instance;
                    string agentName = Plugin.DebugAgentInstance;

                    if (breakPoint != null || agentName == Plugin.DebugAgentInstance)
                    {
                        List <string> transitionIds    = null;
                        List <string> highlightNodeIds = null;
                        List <string> updatedNodeIds   = null;
                        Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = null;

                        if (!string.IsNullOrEmpty(agentName))
                        {
                            string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentName, frame);

                            if (!string.IsNullOrEmpty(behaviorFilename))
                            {
                                transitionIds    = FrameStatePool.GetHighlightTransitionIds(agentName, frame, behaviorFilename);
                                highlightNodeIds = FrameStatePool.GetHighlightNodeIds(agentName, frame, behaviorFilename);
                                updatedNodeIds   = FrameStatePool.GetUpdatedNodeIds(agentName, frame, behaviorFilename);
                                profileInfos     = FrameStatePool.GetProfileInfos(frame, behaviorFilename);
                            }
                        }

                        _timelineDock.updateHighlights(agentName, frame, transitionIds, highlightNodeIds, updatedNodeIds, breakPoint, profileInfos);

                        if (breakPoint != null)
                        {
                            string prompt = string.Format("Break: {0}->{1}[{2}]:{3}", breakPoint.BehaviorFilename, breakPoint.NodeType, breakPoint.NodeId, breakPoint.ActionName);

                            if (breakPoint.ActionResult == "success" || breakPoint.ActionResult == "failure")
                            {
                                prompt += string.Format(" [{0}]", breakPoint.ActionResult);
                            }

                            if (_timelineDock != null)
                            {
                                _timelineDock.setUpdateMode(UpdateModes.Break, prompt);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// Draws the graph.
        /// </summary>
        /// <param name="graphics">The graphics object we want to draw to.</param>
        /// <param name="currentNode">The node the mouse is currently hovering over.</param>
        /// <param name="selectedNode">The node which is currently selected.</param>
        /// <param name="graphMousePos">The mouse's position in the graph.</param>
        internal void DrawGraph(Graphics graphics, PointF graphMousePos,
                                NodeViewData currentNode                = null,
                                NodeViewData selectedNode               = null,
                                List <string> highlightedNodeIds        = null,
                                List <string> updatedNodeIds            = null,
                                List <string> highligltedTransitionIds  = null,
                                HighlightBreakPoint highlightBreakPoint = null,
                                Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = null)
        {
            // draw the node count of the root node
            if (_rootNodeLayout.RootBehavior == _rootNodeLayout.Node)
            {
                _rootNodeLayout.DrawCount(graphics);
            }

            // setup drawing
            graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBilinear;
            graphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            graphics.Transform         = new System.Drawing.Drawing2D.Matrix(_scale, 0.0f, 0.0f, _scale, _offset.X, _offset.Y);

            // update display bounding boxes
            _rootNodeLayout.UpdateDisplay(_offset.X, _offset.Y, _scale);

            // draw comment backgrounds
            if (!_skipLabels)
            {
                _rootNodeLayout.DrawCommentBackground(graphics, _renderDepth, _padding);
            }

            // draw the edges
            if (_edgePen != null && _renderDepth > 0)
            {
                _rootNodeLayout.DrawEdges(graphics, highlightedNodeIds, updatedNodeIds, highligltedTransitionIds, _edgePen, _edgePenSelected, _edgePenHighLighted, _edgePenUpdate, _edgePenReadOnly, _renderDepth - 1);
            }

            // draw the nodes
            _rootNodeLayout.Draw(graphics, _skipLabels, graphMousePos, _renderDepth, currentNode, selectedNode, highlightedNodeIds, updatedNodeIds, highlightBreakPoint, profileInfos);

            // draw comment text
            if (!_skipLabels)
            {
                _rootNodeLayout.DrawCommentText(graphics, _renderDepth);
            }

            // draw last mouse pos
            //e.Graphics.DrawRectangle(Pens.Red, graphMousePos.X -1.0f, graphMousePos.Y -1.0f, 2.0f, 2.0f);
        }
示例#3
0
        private static void updateUI(int frame)
        {
            if (_timelineDock != null)
            {
                //when breaking cpp, only check breakpoints after [connected], i.e. skip breakpoints before connecting
                if (!Settings.Default.BreakAPP || MessageQueue.IsConnected)
                {
                    HighlightBreakPoint breakPoint = HighlightBreakPoint.Instance;
                    string agentName = Plugin.DebugAgentInstance;

                    if (breakPoint != null || agentName == Plugin.DebugAgentInstance)
                    {
                        List <string> highlightNodeIds = null;
                        List <string> updatedNodeIds   = null;
                        Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos = null;

                        if (!string.IsNullOrEmpty(agentName))
                        {
                            string behaviorFilename = FrameStatePool.GetBehaviorFilename(agentName, frame);
                            if (!string.IsNullOrEmpty(behaviorFilename))
                            {
                                highlightNodeIds = FrameStatePool.GetHighlightNodeIds(agentName, frame, behaviorFilename);
                                updatedNodeIds   = FrameStatePool.GetUpdatedNodeIds(agentName, frame, behaviorFilename);
                                profileInfos     = FrameStatePool.GetProfileInfos(frame, behaviorFilename);
                            }
                        }

                        _timelineDock.updateHighlights(agentName, frame, highlightNodeIds, updatedNodeIds, breakPoint, profileInfos);

                        if (breakPoint != null)
                        {
                            string prompt = string.Format("Break: {0}->{1}[{2}]:{3}", breakPoint.BehaviorFilename, breakPoint.NodeType, breakPoint.NodeId, breakPoint.ActionName);
                            if (breakPoint.ActionResult == "success" || breakPoint.ActionResult == "failure")
                            {
                                prompt += string.Format(" [{0}]", breakPoint.ActionResult);
                            }

                            _timelineDock.setUpdateMode(UpdateModes.Break, prompt);
                        }
                    }
                }
            }
        }
示例#4
0
        /// <summary>
        /// Show the behavior tree view with highlights.
        /// </summary>
        /// <param name="agentFullname">The fullname of an agent instance, as the format of "agnetType::instanceName".</param>
        /// <param name="frame">The current frame when connecting or playing.</param>
        public static BehaviorNode ShowBehaviorTree(string agentFullname, int frame, List <string> highlightedTransitionIds, List <string> highlightNodeIds, List <string> updatedNodeIds, HighlightBreakPoint highlightBreakPoint, Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos)
        {
            string behaviorFilename = (highlightBreakPoint != null) ? highlightBreakPoint.BehaviorFilename : FrameStatePool.GetBehaviorFilename(agentFullname, frame);

            if (!string.IsNullOrEmpty(behaviorFilename))
            {
                BehaviorTreeView behaviorTreeView = ShowBehaviorTree(behaviorFilename);

                if (behaviorTreeView != null)
                {
                    if (!Settings.Default.ShowProfilingInfo)
                    {
                        profileInfos = null;
                    }

                    behaviorTreeView.SetHighlights(highlightedTransitionIds, highlightNodeIds, updatedNodeIds, highlightBreakPoint, profileInfos);
                    //behaviorTreeView.Focus();

                    return(behaviorTreeView.RootNode);
                }
            }

            return(null);
        }
示例#5
0
 private void updateHighlights(string agentFullname, int frame, List <string> highlightedTransitionIds, List <string> highlightNodeIds, List <string> updatedNodeIds, HighlightBreakPoint breakPoint, Dictionary <string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos)
 {
     if (agentFullname == Plugin.DebugAgentInstance || breakPoint != null)
     {
         BehaviorNode behavior = UIUtilities.ShowBehaviorTree(agentFullname, frame, highlightedTransitionIds, highlightNodeIds, updatedNodeIds, breakPoint, profileInfos);
     }
 }