private void tcpAPIProcessEvent(BaseSocketRequest request, BaseEvent baseEvent, bool showLoading) { if (mSocket == null && !mSocket.Connected) { // Instance.socketJoinEvent(baseEvent); //req reconnect; return; } string reqParam = ""; string httpUrl = ""; if (request != null) { reqParam = request.ToRequestString(); } else { } // WWW www = new WWW (Constants.QUERY_SERVER_HOST , System.Text.Encoding.UTF8.GetBytes(reqParam)); WWW www = new WWW(reqParam); mReqParam = null; mUrl = ""; mForm = null; //mReqParam = System.Text.Encoding.UTF8.GetBytes(reqParam); mUrl = reqParam; Debug.Log(reqParam); if (UtilMgr.OnPause) { Debug.Log("Request is Canceled cause OnPause"); // return; } StartCoroutine(webAPIProcess(www, baseEvent, showLoading, false)); }
private void tcpAPIProcessEvent(BaseSocketRequest request, BaseEvent baseEvent, bool showLoading) { if(mSocket == null && !mSocket.Connected){ // Instance.socketJoinEvent(baseEvent); //req reconnect; return; } string reqParam = ""; string httpUrl = ""; if (request != null) { reqParam = request.ToRequestString(); } else { } // WWW www = new WWW (Constants.QUERY_SERVER_HOST , System.Text.Encoding.UTF8.GetBytes(reqParam)); WWW www = new WWW(reqParam); mReqParam = null; mUrl = ""; mForm = null; //mReqParam = System.Text.Encoding.UTF8.GetBytes(reqParam); mUrl = reqParam; Debug.Log (reqParam); if(UtilMgr.OnPause){ Debug.Log("Request is Canceled cause OnPause"); // return; } StartCoroutine (webAPIProcess(www, baseEvent, showLoading, false)); }
//聊天Socket的返回处理 void SocketResp_UI(BaseSocketRequest request, BaseResponse response) { ComLoading.Close(); if (response != null && response.status != BaseResponse.ERROR) { SocketRequest sR = request as SocketRequest; switch (sR.Type) { case RequestType.SOCK_WORLDCHATLOGIN: SockLoginWorldChatResponse SockLogin = response as SockLoginWorldChatResponse; _NowCount = SockLogin.data.chatCountPerDay; // mUIMessageMain.SetFreeNum(_NowCount.ToString()); ActivityNetController.isInActivity = false; LoginRequestList(SockLogin.data); break; case RequestType.SOCK_WORLDCHAT: SockWorldChatResponse SockChat = response as SockWorldChatResponse; AddChatArray(SockChat.data); if (string.IsNullOrEmpty(SockChat.data.content)) { return; } if (!CheckNormalOrVideo(SockChat.data.content) && SockChat.data.roleid.ToString() == Core.Data.playerManager.PlayerID) { if (SockChat.data.chatCountPerDay <= 0) { if (Core.SM.CurScenesName == SceneName.GAME_BATTLE) { // RED.AddChild(go.gameObject, BanBattleManager.Instance.go_uiPanel); SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(25129), BanBattleManager.Instance.go_uiPanel); } else { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(25129)); } } else { if (Core.SM.CurScenesName == SceneName.GAME_BATTLE) { SQYAlertViewMove.CreateAlertViewMove(string.Format(Core.Data.stringManager.getString(25053), SockChat.data.chatCountPerDay), BanBattleManager.Instance.go_uiPanel); } else { SQYAlertViewMove.CreateAlertViewMove(string.Format(Core.Data.stringManager.getString(25053), SockChat.data.chatCountPerDay)); } } } if (mUIMessageMain != null) { if (SockChat.data.roleid.ToString().Equals(Core.Data.playerManager.PlayerID)) { _NowCount = SockChat.data.chatCountPerDay; if (mUIMessageMain.gameObject.activeInHierarchy) { mUIMessageMain.SetFreeNum(_NowCount); } } Debug.Log("Here is always connect!"); ShowChatCellUpdata(); } else if (SQYMainController.mInstance != null) { SQYMainController.mInstance.SetChatAnimEnable(true); } break; } } else if (response != null && response.status == BaseResponse.ERROR) { if (Core.SM.CurScenesName == SceneName.GAME_BATTLE) { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode), BanBattleManager.Instance.go_uiPanel); } else { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode)); } } }
void SocketResp_Error(BaseSocketRequest request, string error) { ConsoleEx.DebugLog("---- Socket Resp - Error has ocurred." + error); }
/* * This is for creating command in the Socket client */ public void AppendCmdParam(InternalRequestType requestType) { this.request = new SockInternalRequest(requestType); }
/* * This is for creating Common Socket Task */ public void AppendCommonParam(RequestType requestType, BaseRequestParam param) { this.request = SocketRequestFactory.createHttpRequestInstance(requestType, param); this.relation = SocketRequestFactory.getRelationShip(requestType); }
void SocketRespUI(BaseSocketRequest request, BaseResponse response) { ConsoleEx.DebugLog(" --- Http Resp - running in the main thread, UI purpose --" + response.GetType().ToString()); ConsoleEx.DebugLog("Socket Login Response " + JsonFx.Json.JsonWriter.Serialize(response)); }