3065 优化游戏查看封包 ,添加封包日志打印工具。
| | |
| | | using UnityEngine;
|
| | | using System;
|
| | | using System.Text;
|
| | | using System.IO;
|
| | |
|
| | | public class NetPkgCtl
|
| | | {
|
| | |
| | | {
|
| | | return _tempNetPkgLst;
|
| | | }
|
| | |
|
| | | public static void WriteAllNetLog()
|
| | | {
|
| | | if (_typeLst != null)
|
| | | {
|
| | | var count = 0;
|
| | | var lines = new List<string>();
|
| | | for (int i = _typeLst.Count - 1; i >= 0; i--)
|
| | | {
|
| | | if (count > 20000)
|
| | | {
|
| | | break;
|
| | | }
|
| | |
|
| | | var package = _typeLst[i];
|
| | | var line = string.Empty;
|
| | | line = StringUtility.Contact(package.NetPkgTp == NetPkgType.Client ? "【发送】" : "【接收】", package.SendOrGetTime, ":", package.GameNetName, "\r\n");
|
| | | if (package.fieldDetails != null)
|
| | | {
|
| | | for (int j = 0; j < package.fieldDetails.Count; j++)
|
| | | {
|
| | | line = StringUtility.Contact(line, "\t\t\t", package.fieldDetails[j], "\r\n");
|
| | | }
|
| | | }
|
| | |
|
| | | lines.Add(line);
|
| | | count++;
|
| | | }
|
| | |
|
| | | File.WriteAllLines(Application.dataPath + "/PackageLogs" + "_" + DateTime.Now.ToString("HH_mm_ss") + ".txt", lines.ToArray());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public class NetPkg
|