Ejemplo n.º 1
0
        public void SendNetMessage(NetMessage message)
        {
            if (!IsConnected())
            {
                Debugger.Log("Connection already down, send message failed!"); return;
            }

            try
            {
                if (SendingFilter != null)
                {
                    if (SendingFilter(message))
                    {
                        ByteBuffer buffer = message.Serialize();
                        _socket.Send(buffer.GetInternalBuffer());
                    }
                    else
                    {
                        if (OnSendingFiltered != null)
                        {
                            OnSendingFiltered(message);
                        }
                    }
                }
                else
                {
                    ByteBuffer buffer = message.Serialize();
                    _socket.Send(buffer.GetInternalBuffer());
                }
            }
            catch (Exception e) { Debugger.LogError(e); }
        }
Ejemplo n.º 2
0
        //[Conditional("DEBUG")]
        public static void BeginSubLog(string strSubModuleName)
        {
            if (!s_bEnableAnlysis)
            {
                return;
            }

            Debugger.LogError("==================== 开始分析子对象: " + strSubModuleName);
            s_strSubModuleName = strSubModuleName;
            s_fSubLastTime     = Time.realtimeSinceStartup;
            s_fSubTotalTime    = 0;
        }
Ejemplo n.º 3
0
        public static void LogTotalTime()
        {
            if (!s_bEnableAnlysis)
            {
                return;
            }

            var fCurTime = Time.realtimeSinceStartup;

            var fDeltaTime = fCurTime - s_fLastTime;

            s_fTotalTime += fDeltaTime;

            if (fDeltaTime > 0.1f)
            {
                Debugger.LogError("==================== " + fDeltaTime + ":" + "杂项加载时间");
            }

            Debugger.LogError("============= 总时间: " + s_fTotalTime + " =============");
        }
Ejemplo n.º 4
0
        //[Conditional("DEBUG")]
        public static void LogTime(string strMsg = null)
        {
            if (!s_bEnableAnlysis)
            {
                return;
            }

            if (strMsg == null)
            {
                strMsg = "";
            }

            var fDeltaTime = Time.realtimeSinceStartup - s_fLastTime;

            s_fTotalTime += fDeltaTime;

            Debugger.LogError("==================== " + fDeltaTime + ":" + strMsg);

            s_fLastTime = Time.realtimeSinceStartup;
        }
Ejemplo n.º 5
0
        public static void EndSubLog()
        {
            if (!s_bEnableAnlysis)
            {
                return;
            }

            var fCurTime = Time.realtimeSinceStartup;

            var fDeltaTime = fCurTime - s_fSubLastTime;

            s_fSubTotalTime += fDeltaTime;

            if (fDeltaTime > 0.1f)
            {
                Debugger.LogError("         -------------------------- " + fDeltaTime + ":" + "杂项加载时间");
            }

            Debugger.LogError("==================== " + s_fSubTotalTime + ":" + s_strSubModuleName);

            s_fLastTime   = Time.realtimeSinceStartup;
            s_fTotalTime += s_fSubTotalTime;
        }