コード例 #1
0
 private void playButton_Click(object sender, EventArgs e)
 {
     if (Settings.Default.BreakAPP)
     {
         TimelineDock.Continue();
     }
     else
     {
         if (Plugin.UpdateMode == UpdateModes.Continue)
         {
             setUpdateMode(UpdateModes.Break, "Break manually.");
         }
         else
         {
             setUpdateMode(UpdateModes.Continue, ".");
         }
     }
 }
コード例 #2
0
        private static UpdateModes processMessage(string _msg)
        {
            try {
                //skip index
                //string msg = _msg.Substring(10);
                int    pos = _msg.IndexOf("][");
                string msg = _msg.Substring(pos + 1);

                //Console.WriteLine(msg.Trim());
                if (msg.StartsWith("[workspace]"))
                {
                    processWorkspace(msg);

                    TimelineDock.Continue();
                }
                else if (msg.StartsWith("[connected]"))
                {
                    processConnected();
                }
                else if (msg.StartsWith("[frame]"))
                {
                    // [frame]0
                    AgentDataPool.TotalFrames = (int.Parse(msg.Substring(7)));
                }
                else if (msg.StartsWith("[property]"))
                {
                    processProperty(msg);
                }
                else if (msg.StartsWith("[tick]"))
                {
                    processTick(msg);
                }
                else if (msg.StartsWith("[jump]"))
                {
                    processJump(msg);
                }
                else if (msg.StartsWith("[return]"))
                {
                    processReturn(msg);
                }
                else if (msg.StartsWith("[plan_"))
                {
                    string m = msg.Trim();

                    //Console.WriteLine(m);

                    processPlanning(m);
                }
                else if (msg.StartsWith("[breaked]"))
                {
                    processBreaked(msg);
                }
                else if (msg.StartsWith("[continue]"))
                {
                    if (MessageQueue.ContinueHandler != null)
                    {
                        MessageQueue.ContinueHandler(msg);
                    }
                }
                else if (msg.StartsWith("[applog]"))
                {
                    int frame = AgentDataPool.TotalFrames;
                    FrameStatePool.AddAppLog(frame, msg);
                }
                else if (msg.StartsWith("[log]"))
                {
                    int frame = AgentDataPool.TotalFrames;
                    FrameStatePool.AddLog(frame, msg);
                }
                else if (msg.StartsWith("[profiler]"))
                {
                    //[profiler]ships\0_basic.xml->BehaviorTree[-1] 685
                    string[] tokens = msg.Substring(10).Split(new char[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                    if (tokens.Length == 2)
                    {
                        string[] nodes = tokens[0].Split(new string[] { "->" }, StringSplitOptions.RemoveEmptyEntries);

                        if (nodes.Length == 2)
                        {
                            string behaviorFilename = nodes[0];

                            string[] ids = nodes[1].Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);

                            if (ids.Length == 2)
                            {
                                FrameStatePool.SetProfileInfo(AgentDataPool.TotalFrames, behaviorFilename, ids[1], 0.001f * int.Parse(tokens[1]));
                            }
                        }
                    }
                }
            } catch {
                string errorInfo = string.Format("The message \"{0}\" was not processed.", _msg);
                Console.WriteLine(errorInfo);
                MessageBox.Show(errorInfo, "Error", MessageBoxButtons.OK);
            }

            return(Plugin.UpdateMode);
        }