public void OnBtnClick() { if (mIsScroll) { return; } int price = int.Parse(CostLabel.text); int num = GameItemUtil.GetItemAlreadyHave(CostItem.LTItemData.id, CostItem.LTItemData.type);; if (num < price) { if (CostItem.LTItemData.id == "hc") { LTHotfixGeneralFunc.ShowChargeMess(); } else if (CostItem.LTItemData.id == "gold") { MessageTemplateManager.ShowMessage(901031, null, delegate(int result) { if (result == 0) { InputBlockerManager.Instance.Block(InputBlockReason.FUSION_BLOCK_UI_INTERACTION, 0.5f); GlobalMenuManager.Instance.Open("LTResourceShopUI"); } }); } else { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_codefont_in_LegionLogic_33945")); } //BalanceResourceUtil.HcLessMessage(); return; } //请求 mIsScroll = true; EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/specialactivity/gotReward"); request.AddData("activityId", activityId); LTHotfixApi.GetInstance().BlockService(request, delegate(Hashtable data) { int id = 0; if (data != null) { DataLookupsCache.Instance.CacheData(data); Hashtable hash = EB.Dot.Object(string.Format("tl_acs.{0}.stages", activityId), data, null); foreach (string key in hash.Keys) { id = int.Parse(key); } } OnReponse(data != null, id); }); }
public void BuyDrawCardItem(int times, System.Action <bool> callback = null) { int CurHC = BalanceResourceUtil.GetUserDiamond(); 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 "Read Timed out": { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_codefont_in_LTResourceShopAPI_2956")); return(true); } case "nsf": { LTHotfixGeneralFunc.ShowChargeMess(); return(true); } } } return(false); }; EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/userres/buyLotteryItem"); request.AddData("times", times); LTHotfixApi.GetInstance().BlockService(request, (Hashtable result) => { if (result == null) { if (callback != null) { callback(false); } return; } DataLookupsCache.Instance.CacheData(result); if (callback != null) { callback(result != null); } if (CurHC - BalanceResourceUtil.GetUserDiamond() > 0) { FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.hc, BalanceResourceUtil.GetUserDiamond() - CurHC, "����齱ȯ"); } }); }