public int ServiceWithError(EB.Sparx.Request request, System.Action <object, Hashtable> dataHandler) { return(endPoint.Service(request, delegate(EB.Sparx.Response res) { if (res.error != null) { dataHandler(res.error, null); } else { ProcessResult(res, delegate(Hashtable data) { dataHandler(null, data); }); } })); }
static StackObject *set_numRetries_4(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @value = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); EB.Sparx.Request instance_of_this_method = (EB.Sparx.Request) typeof(EB.Sparx.Request).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.numRetries = value; return(__ret); }
public void SyncTokens(System.Action <string, ArrayList> callback) { EB.Sparx.Request request = this.endPoint.Get("/gacha/getTokens"); request.AddData("api", GachaAPIVersion); this.endPoint.Service(request, delegate(Response result) { if (result.sucessful) { callback(null, result.arrayList); } else { EB.Debug.Log("SyncTokens Error: {0}", result.localizedError); callback(result.localizedError, null); } }); }
public void FetchSets(string[] groups, System.Action <string, Hashtable> callback) { EB.Sparx.Request setRequest = this.endPoint.Get("/gacha/getSet"); setRequest.numRetries = 3; setRequest.AddData("groups", string.Join(",", groups)); setRequest.AddData("api", GachaAPIVersion); this.endPoint.Service(setRequest, delegate(Response result){ if (result.sucessful == true) { callback(null, result.hashtable); } else { callback(result.localizedError, null); } }); }
private int Service(EB.Sparx.Request request, Func <EB.Sparx.Response, bool> responseFunc) { return(endPoint.Service(request, delegate(EB.Sparx.Response response) { if (responseFunc != null && !responseFunc(response)) //如果没有处理完成 { ProcessError(response); } else { if (!response.sucessful) { ProcessError(response); } } })); }
public void FetchStatus(System.Action <string, Hashtable> cb) { EB.Sparx.Request request = this.endPoint.Post("/levelrewards/fetch"); request.AddData("api", LevelRewardsAPIVersion); this.endPoint.Service(request, delegate(Response result) { if (result.sucessful) { cb(null, result.hashtable); } else { EB.Debug.Log("ExecuteLevelRewardsFetchStatus Error: {0}", result.localizedError); cb(result.localizedError, null); } }); }
static StackObject *AddData_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Hashtable @data = (System.Collections.Hashtable) typeof(System.Collections.Hashtable).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); EB.Sparx.Request instance_of_this_method = (EB.Sparx.Request) typeof(EB.Sparx.Request).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.AddData(@data); return(__ret); }
public override IEnumerator OnAddToStack() { yield return(base.OnAddToStack()); if (!hasRequest) { EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/lostchallengecampaign/getTeamViews"); request.AddData("level", LTInstanceMapModel.Instance.CurLevelNum); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { if (data != null) { hasRequest = true; var array = Hotfix_LT.EBCore.Dot.Array("teamView", data, null); TheFast.OnFill(null, EB.Localizer.GetString("ID_PASS_INFO_TIME")); TheNear.OnFill(null, EB.Localizer.GetString("ID_PASS_INFO_TIME2")); if (array != null) { for (int i = 0; i < array.Count; ++i) { Hashtable hash = array[i] as Hashtable; string type = EB.Dot.String("type", hash, null); if (type.Equals(TheFastStr)) { int time = EB.Dot.Integer("fastTime", hash, 0); string timeTemp = string.Format(EB.Localizer.GetString("ID_PASS_INFO_TIME3"), time / 60 / 60, time / 60 % 60, time % 60); string timeStr = string.Format("{0}{1}", EB.Localizer.GetString("ID_PASS_INFO_TIME"), timeTemp); TheFast.OnFill(EB.Dot.Object("teamView", hash, null), timeStr); } else if (type.Equals(TheNearStr)) { int time = EB.Dot.Integer("ts", hash, 0); DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 DateTime dt = startTime.AddSeconds(time); string timeTemp = string.Format(EB.Localizer.GetString("ID_PASS_INFO_TIME4"), dt.Year, dt.Month, dt.Day); string timeStr = string.Format("{0}{1}", EB.Localizer.GetString("ID_PASS_INFO_TIME2"), timeTemp); TheNear.OnFill(EB.Dot.Object("teamView", hash, null), timeStr); } } } } }); } }
public void GetLiveHash(System.Action <string, Hashtable> callback) { EB.Sparx.Request request = this.endPoint.Get("/gacha/getTimestamp"); request.AddData("api", GachaAPIVersion); request.numRetries = 3; this.endPoint.Service(request, delegate(Response result) { if (result.sucessful) { callback(null, result.hashtable); } else { EB.Debug.Log("Timestamp Error: {0}", result.localizedError); callback(result.localizedError, null); } } ); }
//请求所有结果 public void RequestAllResult(int group, System.Action <int, bool> act) { #region Send EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/buddyrun/getAllResult"); request.AddData("groupId", group); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { var strJson = EB.JSON.Stringify(data); EB.Debug.LogError(strJson); if (data.ContainsKey("buddyRun")) { HandleRacingResponse(data, act); } else { act.Invoke(group, false); } }); #endregion }
public void OnUseBtnClick() { if (headFrameStr.Equals(string.Format("{0}_{1}", Id, Num))) { return; } int sceneId = SceneLogicManager.CurrentSceneLogic.SceneId; EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/headframe/useHeadFrame"); request.AddData("id", Id); request.AddData("num", Num); request.AddData("sceneId", sceneId); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { DataLookupsCache.Instance.CacheData(data); headFrameStr = null; SelectEvent(Id, Num, false); }); }
public void instantCreate(string targetEconomyId, int count, System.Action <bool, string> callback) { DataLookupSparxManager lookupsManager = EB.Sparx.Hub.Instance.GetManager <DataLookupSparxManager>(); EB.Sparx.Request request = lookupsManager.EndPoint.Post("/synthesis/instantCreate"); request.AddData("targetEconomyId", targetEconomyId); request.AddData("number", count); lookupsManager.Service(request, delegate(Response result) { if (result.sucessful) { callback(result.sucessful, ""); } else { callback(result.sucessful, result.error.ToString()); } }, true); }
static StackObject *AddData_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Object @value = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.String @key = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); EB.Sparx.Request instance_of_this_method = (EB.Sparx.Request) typeof(EB.Sparx.Request).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.AddData(@key, @value); return(__ret); }
public void OneKeyReceive(Action <Hashtable> dataHandler) { EB.Sparx.Request request = endPoint.Post("/mailbox/receiveGiftByOneKey"); errorProcessFun = (EB.Sparx.Response response) => { if (response.error != null) { string strObjects = (string)response.error; string[] strObject = strObjects.Split(",".ToCharArray(), 2); switch (strObject[0]) { case "MAX_EQUIPMENT_NUM": { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_codefont_in_MailApi_1124")); return(true); } } } return(false); }; BlockService(request, dataHandler); }
public void EnchantItem(int itemInvID, int luckstoneInvID, System.Action <bool> callback) { DataLookupSparxManager data_lookups_mgr = SparxHub.Instance.GetManager <DataLookupSparxManager>(); EB.Sparx.Request req = data_lookups_mgr.EndPoint.Post("/enchantments/enchant"); //req.AddData ("itemID", itemInvID); req.AddData("inventoryId", itemInvID); if (luckstoneInvID != -1) { req.AddData("luckStoneID", luckstoneInvID); } data_lookups_mgr.Service(req, (response) => { var jobject = response.result as Hashtable; var jobject2 = jobject["enchantments"] as Hashtable; bool enchantSuccess = (bool)jobject2["success"]; callback(enchantSuccess); }); }
public void PickFromBox(string group, string version, string set, string box, string payment, System.Action <string, Hashtable> callback) { EB.Sparx.Request request = this.endPoint.Post("/gacha/pick"); request.AddData("group", group); request.AddData("api", GachaAPIVersion); request.AddData("version", version); request.AddData("set", set); request.AddData("box", box); request.AddData("payment", payment); request.AddData("nonce", EB.Sparx.Nonce.Generate()); this.endPoint.Service(request, delegate(Response result) { if (result.sucessful) { callback(null, result.hashtable); } else { EB.Debug.Log("PickFromBox Error: {0}", result.localizedError); callback(result.localizedError, null); } }); }
private int BlockService(EB.Sparx.Request request, Func <EB.Sparx.Response, bool> responseFunc) { LoadingSpinner.Show(); return(endPoint.Service(request, delegate(EB.Sparx.Response response) { LoadingSpinner.Hide(); if (responseFunc != null) { if (!responseFunc(response))//如果没有处理完成 { ProcessError(response); } } else { if (!response.sucessful) { ProcessError(response); } } })); }
private void SendRecieveReward() { if (m_ItemData.RequiredWins > m_ItemData.WinCount) { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_REWARD_NO_TIP")); return; } CheckException(); EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/specialactivity/gotReward"); request.AddData("activityId", m_ItemData.ActivityID); request.AddData("stageId", m_ItemData.ID); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { DataLookupsCache.Instance.CacheData(data); List <LTShowItemData> awardDatas = GameUtils.ParseAwardArr(Hotfix_LT.EBCore.Dot.Array("reward", data, null)); GlobalMenuManager.Instance.Open("LTShowRewardView", awardDatas); Messenger.Raise(EventName.OnURScoreRewardRecieve); DataLookupsCache.Instance.SearchDataByID("tl_acs." + m_ItemData.ActivityID, out Hashtable activityData); m_ItemData.Controller.RefreshRewardData(activityData); }); }
private void SendRecieveScoreReward() { LTHotfixApi.GetInstance().ExceptionFunc = (EB.Sparx.Response response) => { if (response.error != null) { string strObjects = (string)response.error; string[] strObject = strObjects.Split(",".ToCharArray(), 2); switch (strObject[0]) { case "insufficient num": { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_ACTIVITY_REALM_CHALLENGE_ERROR")); LTMainHudManager.Instance.UpdateActivityLoginData(null); //刷新界面 return(true); } case "stage not reach": { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_ACTIVITY_REALM_CHALLENGE_ERROR")); return(true); } } } return(false); }; EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/specialactivity/gotReward"); request.AddData("activityId", itemData.activityid); request.AddData("stageId", itemData.id); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { DataLookupsCache.Instance.CacheData(data); List <LTShowItemData> awardDatas = GameUtils.ParseAwardArr(Hotfix_LT.EBCore.Dot.Array("reward", data, null)); GlobalMenuManager.Instance.Open("LTShowRewardView", awardDatas); Messenger.Raise(EventName.OnURScoreRewardRecieve); }); }
static StackObject *Service_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Action <EB.Sparx.Response> @callback = (System.Action <EB.Sparx.Response>) typeof(System.Action <EB.Sparx.Response>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); EB.Sparx.Request @request = (EB.Sparx.Request) typeof(EB.Sparx.Request).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); EB.Sparx.EndPoint instance_of_this_method = (EB.Sparx.EndPoint) typeof(EB.Sparx.EndPoint).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.Service(@request, @callback); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return(__ret + 1); }
public void RequestBuyLotteryItem(int times, Action <Hashtable> dataHandler) { EB.Sparx.Request request = endPoint.Post("/userres/buyLotteryItem"); request.AddData("times", times); blockErrorFunc = (EB.Sparx.Response response) => { if (response.error != null) { string strObjects = (string)response.error; string[] strObject = strObjects.Split(",".ToCharArray(), 2); switch (strObject[0]) { case "Read Timed out": { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_codefont_in_LTDrawCardAPI_3009")); return(true); } case "nsf": { MessageTemplateManager.ShowMessage(eMessageUIType.MessageDialogue_4, EB.Localizer.GetString("ID_DRAWCARD_BUY_HC"), delegate(int result) { if (result == 0) { InputBlockerManager.Instance.Block(InputBlockReason.FUSION_BLOCK_UI_INTERACTION, 0.5f); GlobalMenuManager.Instance.Open("LTChargeStoreHud", null); } }); return(true); } } } return(false); }; BlockService(request, dataHandler); }
public void Fetch(string device, string CPU, string GPU, int platform, int memorySize, System.Action <string, object> callback, string profileName) { EB.Sparx.Request request = this.endPoint.Get("/performance/profile"); request.AddData("device", device); request.AddData("cpu", CPU); request.AddData("gpu", GPU); request.AddData("platform", platform); request.AddData("memory", memorySize); //request.AddData("profileName", "High");//²âÊÔ if (profileName != null) { request.AddData("profileName", profileName); //Low Medium High } this.endPoint.Service(request, delegate(Response res){ if (res.sucessful == true) { callback(null, res.result); } else { callback(res.localizedError, null); } }); }
public void OnReceiveBtnClick() { switch (m_Type) { case ItemType.Welfare: { LTWelfareModel.Instance.ReceiveSevendayAward(StageDta.Id, delegate(bool successful) { if (successful) { UpdateReceiveState(eReceiveState.have); string cachePath = string.Format("user_prize_data.sevenday_reward.{0}", StageDta.Id); DataLookupsCache.Instance.CacheData(cachePath, true); for (int i = 0; i < StageDta.Awards.Count; i++) { if (StageDta.Awards[i].id == "hc") { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.hc, StageDta.Awards[i].count, "福利七日登录"); } if (StageDta.Awards[i].id == "gold") { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.gold, StageDta.Awards[i].count, "福利七日登录"); } } GlobalMenuManager.Instance.Open("LTShowRewardView", StageDta.Awards); } }); }; break; case ItemType.Activity: { EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/specialactivity/gotReward"); request.AddData("activityId", StageDta.ActivityId); request.AddData("stageId", StageDta.Id); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { if (data != null) { UpdateReceiveState(eReceiveState.have); DataLookupsCache.Instance.CacheData(data); for (int i = 0; i < StageDta.Awards.Count; i++) { if (StageDta.Awards[i].id == "hc") { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.hc, StageDta.Awards[i].count, "福利七日登录"); } if (StageDta.Awards[i].id == "gold") { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.gold, StageDta.Awards[i].count, "福利七日登录"); } } List <LTShowItemData> awardDatas = GameUtils.ParseAwardArr(Hotfix_LT.EBCore.Dot.Array("reward", data, null)); GlobalMenuManager.Instance.Open("LTShowRewardView", awardDatas); } }); }; break; case ItemType.ComeBack: { EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/sign_in/drawAfterDaysLoginReward"); request.AddData("achievementId", StageDta.Id); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { if (data != null) { UpdateReceiveState(eReceiveState.have); string cachePath = string.Format("user_prize_data.afterdays_login_reward.{0}", StageDta.Id); DataLookupsCache.Instance.CacheData(cachePath, true); DataLookupsCache.Instance.CacheData(data); for (int i = 0; i < StageDta.Awards.Count; i++) { if (StageDta.Awards[i].id == "hc") { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.hc, StageDta.Awards[i].count, "福利七日登录"); } if (StageDta.Awards[i].id == "gold") { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.gold, StageDta.Awards[i].count, "福利七日登录"); } } GlobalMenuManager.Instance.Open("LTShowRewardView", StageDta.Awards); } }); }; break; } }
public void RequestMove(Hashtable pos, System.Action <Hashtable> dataHandler) { EB.Sparx.Request request = SparxHub.Instance.ApiEndPoint.Post("/monopoly/move"); request.AddData("pos", pos); BlockService(request, dataHandler); }
public void RequestFinish(System.Action <Hashtable> dataHandler) { EB.Sparx.Request request = SparxHub.Instance.ApiEndPoint.Post("/monopoly/finish"); BlockService(request, dataHandler); }
public void RequestEnterMonopoly(System.Action <Hashtable> dataHandler) { EB.Sparx.Request request = SparxHub.Instance.ApiEndPoint.Post("/monopoly/enterChapter"); BlockService(request, dataHandler); }
public void GetAllianceMercenaries(Action <Hashtable> callback) { EB.Sparx.Request request = endPoint.Post("/mercenary/getAllianceMercenaries"); BlockService(request, callback); }
public void ReqMercenaryReward(Action <Hashtable> dataHandler) { EB.Sparx.Request request = endPoint.Post("/alliances/getHireReward"); request.AddData("aid", LegionModel.GetInstance().legionData.legionID); BlockService(request, dataHandler); }
public void GetAllianceFightRank(int aid, System.Action <Hashtable> dataHandler) { EB.Sparx.Request request = endPoint.Post("/alliances/getAllianceFightRank"); request.AddData("aid", aid); BlockService(request, dataHandler); }
public void RejectAll(System.Action <Hashtable> dataHandler) { EB.Sparx.Request request = endPoint.Post("/escortAndRob/rejectAll"); BlockService(request, dataHandler); }