public void OnFetchData(EB.Sparx.Response res, int reqInstanceID) { if (_ilrObject != null) { _ilrObject.OnFetchData(res, reqInstanceID); } }
public void OnRequestResponse(EB.Sparx.Response res) { LoadingSpinner.Hide(); if (res.sucessful) { var user = EB.Dot.Object("user", res.hashtable, null); if (user == null) { Debug.LogError("Missing user object on set name!!!"); } else { LoginManager.Instance.LocalUser.Update(user); } MessageTemplateManager.ShowMessage(902045); DataLookupsCache.Instance.CacheData("name", InputLabel.value); string name = null; if (DataLookupsCache.Instance.SearchDataByID <string>(string.Format("mainlands.pl.{0}.un", LoginManager.Instance.LocalUserId), out name) && !string.IsNullOrEmpty(name)) { DataLookupsCache.Instance.CacheData(string.Format("mainlands.pl.{0}.un", LoginManager.Instance.LocalUserId), InputLabel.value); } if (isHadRename) { FusionTelemetry.PostBuy(((int)FusionTelemetry.UseHC.hc_playername).ToString(), 1, (int)Hotfix_LT.Data.NewGameConfigTemplateManager.Instance.GetGameConfigValue("changeNameCost")); } controller.Close(); } else { res.CheckAndShowModal(); } }
private void MergeDataHandler(EB.Sparx.Response response) { if (response != null && response.hashtable != null) { GameDataSparxManager.Instance.ProcessIncomingData(response.hashtable, true); } }
public void OnFetchData(EB.Sparx.Response res, int reqInstanceID) { if (ilinstance != null) { ilinstance.OnFetchData(res, reqInstanceID); } }
private void ProcessResult(EB.Sparx.Response response, System.Action <Hashtable> dataHandler) { dataHandler = dataHandler ?? new System.Action <Hashtable>(DefaultDataHandler); if (ExceptionFun != null && response.error != null) //处理Lostemp的异常 { string error = response.error.ToString(); if (ExceptionFun(error)) { ExceptionFun = null; return; } } ExceptionFun = null; if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } }
public void OnNetworkError(EB.Sparx.Response result) { if (result.fatal) { DealError(result); return; } }
private void ProcessResult(EB.Sparx.Response response, Action <Hashtable> dataHandler) { dataHandler = dataHandler ?? new Action <Hashtable>(DefaultDataHandler); if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } }
private void ProcessFriendResultEx(EB.Sparx.Response response, System.Action <EB.Sparx.Response> dataHandler) { dataHandler = dataHandler ?? new System.Action <EB.Sparx.Response>(DefaultDataHandler); if (ProcessResponse(response)) { dataHandler(response); } else { dataHandler(null); } }
public static bool GlobalErrorHandler(EB.Sparx.Response response, EB.Sparx.eResponseCode errCode) { if (response.fatal) { SparxHub.Instance.FatalError(response.localizedError); } else { ShowErrorDialogue(response.localizedError); } return(false); }
public override bool ProcessResponse(EB.Sparx.Response response) { if (!response.sucessful) { EB.Sparx.eResponseCode errCode = CheckError(response.error.ToString()); if (errCode != EB.Sparx.eResponseCode.Success && !ProcessError(response, errCode)) { EB.Debug.LogError("LoginAPI.ProcessResponse: request {0} failed, {1}", response.request.uri, response.error); return(false); } } return(ProcessResult(response)); }
private bool OnApiError(EB.Sparx.Response response, EB.Sparx.eResponseCode errCode) { if (response.error.ToString() == "ID_SPARX_ERROR_TEMP_BANNED" || response.error.ToString() == "ID_SPARX_ERROR_BANNED") { response.ShowErrorModal(delegate() { Hotfix_LT.Messenger.Raise <string, object, bool>(Hotfix_LT.EventName.ShowMenu, "EnterGameUI", null, true); UIStack.Instance.HideLoadingScreen(); }); return(true); } return(false); }
private void ProcessResult(EB.Sparx.Response response, System.Action <Hashtable> dataHandler) { dataHandler = dataHandler ?? new System.Action <Hashtable>(DefaultDataHandler); if (response.error != null) { if (!response.error.Equals("ID_NOT_IN_ACTIVITY_TIME")) { EB.Debug.LogError(response.error); } } if (blockErrorFunc != null) { if (!blockErrorFunc(response))//默认允许的错误return true; { if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } } else { if (response.sucessful) { dataHandler(response.hashtable); } else { dataHandler(null); } } blockErrorFunc = null; } else { if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } } }
private void ProcessInviteResult(EB.Sparx.Response response, System.Action <Hashtable> datahandler) { if (response.sucessful && response.result != null) { ProcessResult(response); datahandler(response.hashtable); } else if (!response.sucessful) { if (!ErrorHandle(response, CheckError(response.error.ToString()))) { ProcessError(response, CheckError(response.error.ToString())); } } }
private void ProcessResult(EB.Sparx.Response response, System.Action <Hashtable> dataHandler) { dataHandler = dataHandler ?? new System.Action <Hashtable>(DefaultDataHandler); if (response.error != null) { EB.Debug.LogError(response.error); } if (errorProcessFun != null) { if (!errorProcessFun(response)) { if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } } else { if (response.sucessful) { dataHandler(response.hashtable); } else { dataHandler(null); } } errorProcessFun = null; } else { if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } } }
public override void OnFetchData(EB.Sparx.Response res, int reqInstanceID) { if (mOnFetchData == null) { mOnFetchData = instance.Type.GetMethod("OnFetchData", 2); } if (mOnFetchData != null && !isOnFetchDataInvoking) { isOnFetchDataInvoking = true; appdomain.Invoke(mOnFetchData, instance, res, reqInstanceID); isOnFetchDataInvoking = false; } else { base.OnFetchData(res, reqInstanceID); } }
private void ProcessError(EB.Sparx.Response response) { if (response.fatal) { EB.Debug.LogError("LTHeroBattleAPI.ProcessError: error {0} occur when request {1}", response.error, response.request.uri); ProcessError(response, CheckError(response.error.ToString())); } else { EB.Sparx.eResponseCode errCode = CheckError(response.error.ToString()); if (errCode != EB.Sparx.eResponseCode.Success && !ProcessError(response, errCode)) { EB.Debug.LogError("LTHeroBattleAPI.ProcessError: request {0} failed, {1}", response.request.uri, response.error); } } }
public static bool CheckAndShowModal(this EB.Sparx.Response response) { if (response.sucessful) { return(true); } if (response.fatal) { SparxHub.Instance.FatalError(response.localizedError); } else { ShowErrorDialogue(response.localizedError); } return(false); }
private void OnSetScrollSkillResponse(EB.Sparx.Response result) { if (!result.sucessful) { if (result.error.Contains("ID_SPARX_NETWORK_ERROR")) { EB.Debug.LogWarning("CombatManager.SetScrollSkill===>Failed, retry! error: ID_SPARX_NETWORK_ERROR"); endPoint.Service(_setscrollskill_request, OnSetScrollSkillResponse); return; } else { EB.Debug.LogError("CombatManager.SetScrollSkill - /combat/setSkill failed: {0}", result.error); OnNetworkError(result); } } _setscrollskill_request = null; }
public static void SuspendHandler(EB.Sparx.Response response) { EB.Sparx.Request request = response.request; if (request.userData != null && request.userData is System.Action <EB.Sparx.Response> ) { EB.Debug.LogWarning("SuspendHandler: callback with empty result, url = {0}", response.url); // callback empty result EB.Sparx.Response empty = new EB.Sparx.Response(request); empty.sucessful = true; Johny.HashtablePool.ReleaseRecursion(empty.hashtable); empty.hashtable = null; System.Action <EB.Sparx.Response> callback = request.userData as System.Action <EB.Sparx.Response>; if (System.Object.ReferenceEquals(callback.Target, null) || !callback.Target.Equals(null)) { callback(empty); } } }
private void ProcessLegionWarResult(EB.Sparx.Response response, System.Action <Hashtable> dataHandler) { dataHandler = dataHandler ?? new System.Action <Hashtable>(DefaultDataHandler); if (ErrorRedultFunc != null) { if (ErrorRedultFunc(response))//ture为允许的错误 { if (response.sucessful) { dataHandler(response.hashtable); } else { dataHandler(null); } } else { if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } } } else { if (ProcessResponse(response)) { dataHandler(response.hashtable); } else { dataHandler(null); } } }
private IEnumerator OnResponseCoroutine(EB.Sparx.Response response, System.Action <EB.Sparx.Response> callback = null, bool cacheData = true) { yield return(new WaitForSeconds(NetworkLatencySimulationDuration)); // simulate network latency if (cacheData) { IDictionary dataDic = response.result as IDictionary; if (dataDic == null) { dataDic = Johny.HashtablePool.Claim(); } dataDic["serverError"] = response.error; HandleIncomingData(dataDic); } if (callback != null) { callback(response); } }
private bool ErrorHandle(EB.Sparx.Response response, EB.Sparx.eResponseCode code) { string errorcode = response.error.ToString(); switch (errorcode) { case "same ip or same device": MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_INVITE_24")); //相同ip或设备 return(true); case "invalid code": MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_INVITE_25")); //错误邀请码 return(true); case "used": MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_INVITE_27")); //只能绑定一次邀请码 return(true); default: break; } return(false); }
private void DealError(EB.Sparx.Response result) { if (result.error.ToString() == "ID_ERROR_NOT_IN_BATTLE") { LoadingSpinner.Hide(); if (!LTCombatEventReceiver.Instance.IsBattleOver) { EB.Sparx.Request request2 = endPoint.Get("/playstate/getPlayState"); endPoint.Service(request2, (result2) => { if (result != null) { DataLookupsCache.Instance.CacheData(result2.hashtable); LTCombatHudController.Instance.ShowBattleResultScreen(SceneLogic.BattleType, MainLandLogic.GetInstance().m_CombatOutCome, false); } }); } } else if (result.error.ToString().Contains("user is in another battle, combat_id = ")) { BattleResultScreenController.DirectExitCombat(); } else if (result.error.ToString().Contains("EndWrite failure") || result.error.ToString().Contains("ID_SPARX_ERROR_NOT_CONNECTED")) { SparxHub.Instance.Disconnect(false); MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_SPARX_ERROR_NOT_CONNECTED")); } else if (result.error.ToString().Contains("socket hang up") || result.error.ToString().Contains("connection timed out")) { EB.Debug.LogError(result.error); SparxHub.Instance.Disconnect(false); MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_SPARX_ERROR_NOT_CONNECTED")); } else { EB.Debug.LogError(result.error); } }
private void DefaultDataHandler(EB.Sparx.Response friend) { EB.Debug.Log("FriendAPI.DefaultDataHandler: call default data handler"); }
public override void OnFetchData(EB.Sparx.Response res, int reqInstanceID) { }
public void OnRequestPlayStateResponse(EB.Sparx.Response result) { if (result.sucessful) { string oldPlayState; DataLookupsCache.Instance.SearchDataByID <string>("playstate.state", out oldPlayState); Hashtable data = result.hashtable; string newPlayState = EB.Dot.String("playstate.state", data, ""); EB.Debug.Log("OnRequestPlayStateResponse {0} {1}", oldPlayState, newPlayState); if (string.IsNullOrEmpty(newPlayState)) { EB.Debug.LogWarning("new PlayState is null"); return; } if (newPlayState == oldPlayState) { IDictionary scenedata = null; switch (newPlayState) { case "MainLand": { scenedata = EB.Dot.Object("mainlands", data, null); } break; case "Campaign": { scenedata = EB.Dot.Object("campaigns", data, null); } break; case "Combat": { if (SceneLogic.SceneState != SceneLogic.eSceneState.CombatLoop) { int cid; DataLookupsCache.Instance.SearchIntByID("playstate.Combat.combat_id", out cid); ResumeCombat(cid, delegate(Response r) { }); } } break; default: { scenedata = null; } break; } if (scenedata != null) { DataLookupsCache.Instance.CacheData(data); string scenetype = EB.Dot.String("scenetype", data, ""); NpcManager.Instance.MergeNpc(scenetype, scenedata); PlayerManagerForFilter.Instance.MergePlayer(scenetype, scenedata); } } else { DataLookupsCache.Instance.CacheData(data); EnterSceneByPlayState(); EB.Debug.LogWarning("PlayState is change"); return; } } else if (result.fatal) { SparxHub.Instance.FatalError(result.localizedError); } }
public static void ShowErrorModal(this EB.Sparx.Response response, System.Action callback) { ShowErrorDialogue(response.localizedError, callback); }
public static void ShowErrorModal(this EB.Sparx.Response response) { ShowErrorDialogue(response.localizedError); }
private bool ErrorHandler(EB.Sparx.Response response, EB.Sparx.eResponseCode errCode) { return(false); }
public virtual void OnFetchData(EB.Sparx.Response res, int reqInstanceID) { }