using System.Collections.Generic; public class DebugPkgCache { private string dataTime; private int code; private static List m_List = new List(); public static void Push(GameNetPackBasic package) { if (m_List.Count != 0) { if (m_List[m_List.Count - 1].code == 258) { return; } } DebugPkgCache _p = new DebugPkgCache(); _p.dataTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); _p.code = package.cmd; m_List.Add(_p); } public static void UpLoad() { var _contents = new System.Text.StringBuilder(); foreach (var _content in m_List) { _contents.Append("["); _contents.Append(_content.dataTime); _contents.Append("]"); _contents.Append(_content.code); _contents.Append("\r\n"); } #if UNITY_EDITOR UnityEngine.Debug.Log("登陆异常: " + _contents.ToString()); #endif _contents = null; m_List.Clear(); } }