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); } } }
public void RequestRemoteData(string subsystemName, System.Action <string, object> callback) { EB.Sparx.Request request = m_Api.Get("/" + subsystemName + "/async"); m_Api.Service(request, delegate(EB.Sparx.Response response) { if (response.sucessful == true) { if (callback != null) { callback(null, response.result); } } else { if (callback != null) { callback(response.localizedError, null); } } }); }
public void RequestQuitCampaign(int campaignId, System.Action <Response> callback) { EB.Sparx.Request request = m_endPoint.Post("/scenes/campaign/quitCampaign"); request.AddData("campaignId", campaignId); m_endPoint.Service(request, callback); }
public void RequestCombatResumeToScene(System.Action <Response> callback) { EB.Sparx.Request request = m_endPoint.Get("/playstate/getPlayState"); m_endPoint.Service(request, callback); }
public void Provoke(long uid, System.Action <Response> callback) { EB.Sparx.Request request = m_endPoint.Post("/social/provoke"); request.AddData("targetUid", uid); m_endPoint.Service(request, callback); }
public void SaveReceivePkRequest(bool isReceive, System.Action <Response> callback) { EB.Sparx.Request request = m_endPoint.Post("/social/saveReceivePkRequest"); request.AddData("isReceive", isReceive); m_endPoint.Service(request, callback); }
//reject invite_id [xxx,xxx] public void Reject(string[] invites, System.Action <Response> callback) { EB.Sparx.Request request = m_endPoint.Post("/invites/reject"); request.AddData("invite_id", invites); m_endPoint.Service(request, callback); }
public void ReceiveGifts(int level, Action <Hashtable> dataHandler) { EB.Sparx.Request request = endPoint.Post("/vip/buyVipPrize"); request.AddData("level", level); BlockService(request, dataHandler); }
public void LevelWarRequire(int cambatID) { EB.Sparx.Request request = endPoint.Post("/combat/leaveWatch"); request.AddData("combat_id", cambatID); s_endpoint.Service(request, null); }
public void PingImmediately() { m_pingprocessing = true; EB.Sparx.Request request = endPoint.Post("/combat/ping"); request.AddData("combat_id", Hotfix_LT.Combat.CombatSyncData.Instance.CombatId); request.numRetries = 0; request.suspendMethod = EB.Sparx.Request.eSuspendMethod.Finish; LoadingSpinner.Show(); //endpoint need an error handler endPoint.Service(request, delegate(EB.Sparx.Response result) { if (!result.sucessful) { if (result.error.ToString() == "ID_ERROR_NOT_IN_BATTLE") { LoadingSpinner.Hide(); if (LTCombatEventReceiver.Instance != null && !LTCombatEventReceiver.Instance.IsBattleOver) { EB.Sparx.Request request2 = endPoint.Get("/playstate/getPlayState"); endPoint.Service(request2, (result2) => { LoadingSpinner.Hide(); if (result != null) { DataLookupsCache.Instance.CacheData(result2.hashtable); LTCombatHudController.Instance.ShowBattleResultScreen(SceneLogic.BattleType, MainLandLogic.GetInstance().m_CombatOutCome, false); } }); } return; } else { m_failedpingcount++; } } else { LoadingSpinner.Hide(); int subEid = EB.Dot.Integer("subEid", result.result, 0); if (subEid <= 0) { m_failedpingcount++; } else { if (subEid + 1 != Hotfix_LT.Combat.CombatSyncData.Instance.getCurrentSubEid()) { if (CombatLogic.Instance.LocalPlayerIsObserver) { CombatManager.Instance.ClientWatchReady(Hotfix_LT.Combat.CombatSyncData.Instance.CombatId); } else { ClientCombatReady(Hotfix_LT.Combat.CombatSyncData.Instance.CombatId); } } } } ClearPingTime(); m_pingprocessing = false; }); }
public void Service(EB.Sparx.Request request, System.Action <EB.Sparx.Response> callback = null, bool cacheData = true) { System.Action <EB.Sparx.Response> onResponse = obj => StartCoroutine(OnResponseCoroutine(obj, callback, cacheData)); m_endPoint.Service(request, onResponse); }