private static void MessageReceiveCallBack(InputNetworkMessageEvent inputEvent) { if (msgs == null || msgs.Count == 0) { return; } foreach (ResendMessage m in msgs) { if (m.removeMT == inputEvent.m_MessgaeType) { Debug.Log("移除重发:" + m.removeMT); msgs.Remove(m); SaveRecord(); if (m.callBack != null) { MessageClassInterface msgInterface = null; Type type = Type.GetType(inputEvent.m_MessgaeType); if (type == null) { Debug.LogError("No MessgaeType :" + inputEvent.m_MessgaeType); } else { object dataObj = JsonUtils.FromJson(type, inputEvent.Data["Content"].ToString()); msgInterface = (MessageClassInterface)dataObj; } m.callBack(msgInterface); } break; } } }
// static Deserializer deserializer = new Deserializer(); private static void MessageReceiveCallBack(InputNetworkMessageEvent inputEvent) { if (ApplicationManager.Instance.m_AppMode != AppMode.Release) { Debug.Log("MessageReceiveCallBack ;" + JsonUtils.ToJson(inputEvent)); } Type type = Type.GetType(inputEvent.m_MessgaeType); if (type == null) { Debug.LogError("No MessgaeType :" + inputEvent.m_MessgaeType); return; } object dataObj = JsonUtils.FromJson(type, inputEvent.Data["Content"].ToString());// deserializer.Deserialize(type, inputEvent.Data["Content"].ToString()); MessageClassInterface msgInterface = (MessageClassInterface)dataObj; msgInterface.DispatchMessage(); if (msgInterface is CodeMessageBase) { CodeMessageBase codeMsg = (CodeMessageBase)msgInterface; GlobalEvent.DispatchEvent(ErrorCodeMessage, codeMsg); } }
private void OnReceiveMsgCallBack(MessageClassInterface resMsg) { StoreBuyGoods2Client e = (StoreBuyGoods2Client)resMsg; StoreName storeName = GetGoodsPayInfo(e.receipt).storeName; Debug.LogWarning("NetworkVerificationImplement StoreBuyGoods2Client=========" + e.id + " storeName:" + storeName); PaymentVerificationManager.OnVerificationResult(e.code, e.id, e.repeatReceipt, e.receipt, null, storeName); }