public void _onReceiveData(JSONObject Params, AsyncResponse res) { try { if (_isStart && _isRun) { if (_isEnd) { res.Call(); } else { if (_receivedData.ContainsKey(Params["dataId"])) { res.Call(); } else { OnReceiveData(Params, res); } } } else { var queueData = new Dictionary <string, object> { { "Params", Params }, { "res", res } }; _receiveDataQueue.Add(queueData); } } catch (Exception e) { Debug.LogError("Exception: " + e.Message); } }
private void HandlePushMessageContent(JSONObject Params, AsyncResponse res) { // Debug.Log("handlePushMessageContent_1 " + PrettyJson(Params)); try { var message = JSON.Parse(Params["content"]).AsObject; var senderMessageId = Params["senderMessageId"].AsInt.ToString(); var messageType = message["type"].AsInt; var data = JSON.Parse(message["content"]).AsObject; if (messageType == PushMessageContentTypes.DataPack) { OnReceiveDataPackAction(data, res); } else { if (!_gameCenterMessagesId.ContainsKey(senderMessageId)) { switch (messageType) { case PushMessageContentTypes.RequestIdState: Debug.Log("REQUEST_ID_STATE " + data); OnReceiveRequestIdStateAction(data); break; case PushMessageContentTypes.MatchNew: Debug.Log("MATCH_NEW " + data); OnReceiveNewMatchAction(data); break; case PushMessageContentTypes.MatchStart: Debug.Log("MATCH_START " + data); OnReceiveStartMatchAction(data); break; case PushMessageContentTypes.MatchResume: Debug.Log("MATCH_RESUME " + data); OnReceiveResumeMachAction(data); break; case PushMessageContentTypes.MatchPause: Debug.Log("MATCH_PAUSE " + data); OnReceivePauseMatchAction(data); break; case PushMessageContentTypes.MatchRequest: Debug.Log("MATCH_REQUEST " + data); OnReceiveRequestMatchAction(data); break; case PushMessageContentTypes.MatchResult: Debug.Log("MATCH_RESULT " + data); OnReceiveMatchResultAction(data); break; case PushMessageContentTypes.Message: Debug.Log("MESSAGE " + data); OnReceiveMessageAction(data); break; case PushMessageContentTypes.MatchReconnect: Debug.Log("MATCH_RECONNECT " + data); OnReceiveResumeMachAction(data); break; case PushMessageContentTypes.MatchLeave: Debug.Log("MATCH_LEAVE " + data); OnReceiveLeaveMachAction(data); break; } _gameCenterMessagesId.Add(senderMessageId, true); res.Call(); } else { res.Call(); } } } catch (Exception e) { Debug.LogError("Exception: " + e.Message); } }