private static void DoSendMessage()
        {
            while (true)
            {
                try
                {
                    if (m_sendThread == null)
                    {
                        UnityEngine.Debug.LogError("<color=#ff0000>m_sendThread null</color>");
                        return;
                    }
                    if (m_sampleQueue.Count > 0)
                    {
                        while (m_sampleQueue.Count > 0)
                        {
                            NetBase s = null;
                            lock (m_sampleQueue)
                            {
                                s = m_sampleQueue.Dequeue();
                            }
                            bw.Write(PACK_HEAD);
                            if (s is Sample)
                            {
                                bw.Write((int)0);
                            }
                            else if (s is LuaRefInfo)
                            {
                                bw.Write((int)1);
                            }
                            Serialize(s, bw);
                            s.Restore();
                        }
                    }
                    else if (m_frameCount != HookLuaSetup.frameCount)
                    {
                        bw.Write(PACK_HEAD);
                        //写入message 头编号
                        bw.Write((int)0);
                        Sample s = Sample.Create(0, (int)LuaLib.GetLuaMemory(LuaProfiler.mainL), "");
                        Serialize(s, bw);
                        s.Restore();
                        m_frameCount = HookLuaSetup.frameCount;
                    }
                    Thread.Sleep(10);
                }
#pragma warning disable 0168
                catch (ThreadAbortException e) { }
                catch (Exception e)
                {
                    UnityEngine.Debug.Log(e);
                    Close();
                }
#pragma warning restore 0168
            }
        }
Exemplo n.º 2
0
        private static void DoSendMessage()
        {
            while (true)
            {
                try
                {
                    if (m_sendThread == null)
                    {
                        return;
                    }
                    if (m_sampleQueue.Count > 0)
                    {
                        while (m_sampleQueue.Count > 0)
                        {
                            NetBase s = null;
                            lock (m_sampleQueue)
                            {
                                s = m_sampleQueue.Dequeue();
                            }
                            bw.Write(PACK_HEAD);
                            if (s is Sample)
                            {
                                bw.Write((int)0);
                            }
                            else if (s is LuaRefInfo)
                            {
                                bw.Write((int)1);
                            }
                            else if (s is LuaDiffInfo)
                            {
                                bw.Write((int)2);
                            }
                            Serialize(s, bw);
                            s.Restore();
                        }
                    }
                    Thread.Sleep(10);
                }
#pragma warning disable 0168
                catch (ThreadAbortException e) { }
                catch (Exception e)
                {
                    Close();
                }
#pragma warning restore 0168
            }
        }