/// <summary> /// 打印接收消息日志 /// </summary> /// <param name="bytes"></param> public void ShowReciveMsgLog <T>(T tbuff) { if (tbuff is HallBeatS2C || tbuff is BattleBeatS2C) { return; } var logVO = new LogVO(); logVO.stackTrace = ""; logVO.type = LogType.Log; try { logVO.message = gameMgrProxy.systemDateTime.ToString("yyyy-MM-dd HH:mm:ss:ffff") + " 接到消息 " + JsonMapper.ToJson(tbuff); } catch (Exception e) { Debug.LogError(string.Format("{0} {1}", e.Message, e.StackTrace)); } GlobalData.logs.Add(logVO); if (GlobalData.logs.Count > GlobalData.maxLogs) { GlobalData.logs.RemoveAt(0); } }
/// <summary> /// 打印发送消息 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="tbuff"></param> public void ShowSendMsgLog <T>(MsgNoC2S msgNo, T tbuff, int clientIndex = 0) { var logVO = new LogVO(); logVO.stackTrace = ""; logVO.type = LogType.Log; try { logVO.message = gameMgrProxy.systemDateTime.ToString("yyyy-MM-dd HH:mm:ss:ffff") + string.Format("发送消息 消息:{0} 消息号:{1} 消息体:{2} 客户端:{3}", msgNo.ToString(), msgNo.GetHashCode(), JsonMapper.ToJson(tbuff), clientIndex); } catch (Exception e) { Debug.LogError(string.Format("{0} {1}", e.Message, e.StackTrace)); } GlobalData.logs.Add(logVO); if (GlobalData.logs.Count > GlobalData.maxLogs) { GlobalData.logs.RemoveAt(0); } }