public void SendJson(int cmd, int type, string json) { Msg msg = new Msg(); msg.Cmd = cmd; msg.Type = type; msg.Args = json; string str = JsonUtility.ToJson(msg); var dat = Encoding.UTF8.GetBytes(str); link.Send(EnvelopeType.Json, dat); }
void Log(string condtion, string stack, LogType type) { for (int i = 0; i < logs.Count; i++) { if (logs[i].condition == condtion) { if (logs[i].stackTrace == stack) { logs[i].count++; return; } } } LogData log = new LogData(); log.count = 1; log.condition = condtion; log.stackTrace = stack; log.type = type; logs.Add(log); var str = JsonUtility.ToJson(log); logLink.Send(EnvelopeType.String, Encoding.UTF8.GetBytes(str)); }