private void 标记节点失败ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (m_SelectionNodes.Count != 1)
            {
                return;
            }
            DebugNode debugNode = DebugManager.Instance.FindByID(m_SelectionNodes[0].ID);

            if (debugNode.Status != DebugNodeStatus.Running)
            {
                MainForm.Instance.ShowMessage("只有Running的节点才能改变状态!!");
                return;
            }

            if (debugNode.Node.NodeType == NodeType.Composite)
            {
                MainForm.Instance.ShowMessage("组合节点不能控制成功或者失败!!");
                return;
            }

            if (debugNode.Node.ClassType == "Wait")
            {
                MainForm.Instance.ShowMessage("Wait节点不能控制成功或者失败!!");
                return;
            }

            if (!debugNode.CanChangeStatus)
            {
                MainForm.Instance.ShowMessage("该节点不能控制成功或者失败!!");
                return;
            }

            debugNode.Status = DebugNodeStatus.Failed;
        }
Exemple #2
0
        void objectAdded(Identified obj)
        {
            var dn = new DebugNode(obj, nicks.ContainsKey(obj.ID) ? nicks[obj.ID] : null);

            nodes.Add(dn);
            if (obj is Client)
            {
                if (dn.bindClient.Connected)
                {
                    clientsOn.Add(dn);
                }
                else
                {
                    clientsOff.Add(dn);
                }
                DebugNode dna = dn.Clone();
                nodes.Add(dna);
                clientsAll.Add(dna);
            }
            else if (obj is Server)
            {
                servers.Add(dn);
                foreach (Link l in dn.bindServer.clients)
                {
                    var ldn = new DebugNode(l, nicks.ContainsKey(obj.ID) ? nicks[obj.ID] : null);
                    nodes.Add(ldn);
                    dn.Nodes.Add(ldn);
                }
            }

            treeView.ExpandAll();
        }
        void treeViewAdv1_Expanding(object sender, TreeViewAdvEventArgs e)
        {
            if (_client.State != XdebugClientState.Break)
            {
                MessageBox.Show(
                    "This property is no longer available. Close the Property window and try running the script again.",
                    "Property invalidated",
                    MessageBoxButtons.OK
                    );

                return;
            }

            DebugNode node = e.Node.Tag as DebugNode;

            if (node != null && !node.Property.isComplete)
            {
                Property p = _client.GetPropertyValue(node.Property.FullName, 0);

                /* We don't want 'p' itself. It will be a copy of the node that
                 * was marked as inComplete. */
                foreach (Property child in p.ChildProperties)
                {
                    DebugNode newNode = this.BuildDebugNode(child, node);

                    node.Nodes.Add(newNode);
                }

                node.Property.isComplete = true;
            }
        }
Exemple #4
0
 void refreshAll(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node is DebugNode dn && nodes.Exists(a => a.ID == dn.ID))
     {
         if (lastSelected != null)
         {
             lastSelected.bind.clearEvents();
         }
         lastSelected = dn;
         Identified idBind = dn.bind;
         idBind.tRaw.ItemAdd     += (a, b) => addRaw(idBind, a);
         idBind.tCommand.ItemAdd += (a, b) => addCommand(idBind, a);
         idBind.tHigh.ItemAdd    += (a, b) => addHigh(idBind, a);
         tableRawMsg.Rows.Clear();
         tableRaw.Rows.Clear();
         tableCommands.Rows.Clear();
         tableHigh.Rows.Clear();
         foreach (object[] row in idBind.tRaw.ToList())
         {
             addRaw(null, row);
         }
         foreach (object[] row in idBind.tCommand.ToList())
         {
             addCommand(null, row);
         }
         foreach (object[] row in idBind.tHigh.ToList())
         {
             addHigh(null, row);
         }
     }
 }
Exemple #5
0
    public override bool DrawContent(Event e)
    {
        DebugNode node             = _node as DebugNode;
        bool      modelNeedsSaving = false;

        if (fieldNames == null)
        {
            CacheFieldNames();
        }

        Rect content = new Rect();

        content.size     = Transform.size;
        content.width   -= 20;
        content.height  -= 20;
        content.position = Transform.position;
        content.x       += 10;
        content.y       += 10;

        int selectedProp = Array.IndexOf(fieldNames, node.propName);

        if (selectedProp == -1)
        {
            Debug.Log("Could not find " + node.propName + "!");
            selectedProp  = 0;
            node.propName = "-message-";
            node.message  = "Prop " + node.propName + " missing for debug node!";
        }

        GUILayout.BeginArea(content);
        GUILayout.BeginVertical();
        GUILayout.Label("Debug Node");
        GUILayout.FlexibleSpace();

        int newProp = EditorGUILayout.Popup(selectedProp, fieldNames);

        if (newProp != selectedProp)
        {
            node.propName    = fieldNames[newProp];
            node.logProp     = newProp != 0;
            modelNeedsSaving = true;
        }

        if (newProp == 0)
        {
            string newMsg = EditorGUILayout.TextField(node.message);
            if (newMsg != node.message)
            {
                node.message     = newMsg;
                modelNeedsSaving = true;
            }
        }

        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.EndArea();

        return(modelNeedsSaving);
    }
            public DebugNode GetOrCreateChild(string name)
            {
                if (_children.ContainsKey(name))
                {
                    return(_children[name]);
                }

                var node = new DebugNode(name);

                _children.Add(name, node);
                return(node);
            }
        public void Display(DebugNode node, Texture texture)
        {
            var payload = node.Widget as TextureWidget;

            if (payload != null)
            {
                payload.SetValue(texture);
            }
            else
            {
                node.Widget = new TextureWidget(texture);
            }

            node.Touch();
        }
        public void Display(DebugNode node, string value)
        {
            var payload = node.Widget as StringWidget;

            if (payload != null)
            {
                payload.SetValue(value);
            }
            else
            {
                // New payload
                node.Widget = new StringWidget(value);
            }
            node.Touch();
        }
        public DebugNode BuildDebugNode(Property p, DebugNode Parent)
        {
            DebugNode newNode = new DebugNode(p);

            if (Parent != null && Parent is DebugNode)
            {
                newNode.Parent = Parent;
            }

            foreach (Property Child in p.ChildProperties)
            {
                DebugNode tmpNode = this.BuildDebugNode(Child, newNode);
            }

            return(newNode);
        }
        public void Log(DebugNode node, string message)
        {
            var payload = node.Widget as Logger;

            if (payload != null)
            {
                // Existing payload
                payload.Log(message);
            }
            else
            {
                // New payload
                var p = new Logger();
                p.Log(message);
                node.Widget = p;
            }
            node.Touch();
        }
        //展示调试菜单
        private void ShowDebugContextMenu()
        {
            if (!DebugManager.Instance.Debugging)
            {
                return;
            }

            for (int i = 0; i < debugContextMenuStrip.Items.Count; i++)
            {
                debugContextMenuStrip.Items[i].Visible = false;
            }

            // 0.标记节点完成
            // 1.标记节点失败
            // 2.停止调试
            // 3.居中

            DebugNode debugNode = null;

            if (m_SelectionNodes.Count > 0)
            {
                debugNode = DebugManager.Instance.FindByID(m_SelectionNodes[0].ID);
            }

            if (debugNode != null)
            {
                debugContextMenuStrip.Items[0].Visible = true;
                debugContextMenuStrip.Items[1].Visible = true;
            }
            else
            {
                debugContextMenuStrip.Items[2].Visible = true;
                debugContextMenuStrip.Items[3].Visible = true;
            }

            debugContextMenuStrip.Show(PointToScreen(m_MouseLocalPoint));
            this.Refresh();
        }
 public void Display(DebugNode node, Vector2 size, Action <Rect> drawAction)
 {
     node.Widget = new CustomUIWidget(size, drawAction);
     node.Touch();
 }
 public void Display(DebugNode node, float value)
 {
     Display(node, value.ToString());
 }
Exemple #14
0
        void notice(Identified obj)
        {
            if (obj is User u)
            {
                if (nicks.ContainsKey(u.ID))
                {
                    nicks[u.ID] = u.Nickname;
                }
                else
                {
                    nicks.Add(u.ID, u.Nickname);
                }
                foreach (DebugNode n in nodes)
                {
                    if (n.ID == u.ID)
                    {
                        n.Text = u.Nickname;
                    }
                }
            }
            else if (obj is Link)
            {
                foreach (DebugNode node in nodes.ToList())
                {
                    if (node.bind == obj)
                    {
                        DebugNode s = nodes.Find(a => a.Nodes.Contains(node));
                        if (s != null)
                        {
                            s.Nodes.Remove(node);
                        }
                        nodes.Remove(node);
                        nicks.Remove(node.ID);
                    }
                }
            }
            else if (obj is Client c)
            {
                DebugNode n = nodes.Find(a => a.ID == c.ID);
                if (n != null)
                {
                    if (c.Connected)
                    {
                        clientsOff.Remove(n);
                        clientsOn.Add(n);
                    }
                    else
                    {
                        clientsOn.Remove(n);
                        clientsOff.Add(n);
                    }
                }
            }
            else if (obj is Server s)
            {
                DebugNode sN   = nodes.Find(a => a.ID == s.ID);
                var       subN = new DebugNode[sN.Nodes.Count];
                sN.Nodes.CopyTo(subN, 0);
                List <DebugNode> subL = subN.ToList();
                foreach (DebugNode sL in subN)
                {
                    if (!s.clients.Contains(sL.bindLink))
                    {
                        sN.Nodes.Remove(sL);
                    }
                }
                foreach (Link l in s.clients)
                {
                    if (!subL.Exists(a => a.bindLink == l))
                    {
                        var ldn = new DebugNode(l, nicks.ContainsKey(obj.ID) ? nicks[obj.ID] : null);
                        nodes.Add(ldn);
                        sN.Nodes.Add(ldn);
                    }
                }
            }

            treeView.ExpandAll();
        }
Exemple #15
0
 public DebugNodeGUIContent(DebugNode node, NodeMachineEditor editor) : base(node, editor)
 {
 }
Exemple #16
0
        public void LoadProperty(Property p, DebugNode Parent)
        {
            DebugNode newNode = this.BuildDebugNode(p, Parent);

            _Model.Nodes.Add(newNode);
        }