12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using ET;
- namespace GFGGame
- {
- public class RechargeSProxy
- {
- public static async ETTask ReqRecharge(int rechargeId)
- {
- M2C_Recharge response = null;
- response = (M2C_Recharge)await MessageHelper.SendToServer(new C2M_Recharge() { RechargeId = rechargeId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- RechargeDataManager.Instance.UpdateRechargeData(response.RechargeId, response.RechargedTimes);
- PromptController.Instance.ShowFloatTextPrompt("虚拟充值成功", MessageType.SUCCESS);
- }
- }
- }
- public static async ETTask ReqRechargeInfo()
- {
- M2C_GetRechargeInfo response = null;
- response = (M2C_GetRechargeInfo)await MessageHelper.SendToServer(new C2M_GetRechargeInfo() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- for (int i = 0; i < response.ks.Count; i++)
- {
- RechargeDataManager.Instance.UpdateRechargeData(response.ks[i], response.vs[i]);
- }
- }
- }
- }
- public static async ETTask ReqRequestGiftBagInfo()
- {
- M2C_RequestGiftBagInfo response = null;
- response = (M2C_RequestGiftBagInfo)await MessageHelper.SendToServer(new C2M_RequestGiftBagInfo() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- for (int i = 0; i < response.ks.Count; i++)
- {
- RechargeDataManager.Instance.UpdateGiftData(response.ks[i], response.vs[i]);
- }
- }
- }
- }
- public static async ETTask<bool> ReqBuyGiftBag(int giftId)
- {
- M2C_BuyGiftBag response = null;
- response = (M2C_BuyGiftBag)await MessageHelper.SendToServer(new C2M_BuyGiftBag() { GiftBagId = giftId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- RechargeDataManager.Instance.UpdateGiftData(response.GiftBagId, response.BuyTimes);
- BonusController.TryShowBonusList(GiftBagCfgArray.Instance.GetCfg(response.GiftBagId).itemsArr);
- EventAgent.DispatchEvent(ConstMessage.BUY_GIFT_SUCCESS);
- return true;
- }
- }
- return false;
- }
- public static async ETTask ReqExchangeInfo()
- {
- M2C_RequestShopExchangeInfo response = null;
- response = (M2C_RequestShopExchangeInfo)await MessageHelper.SendToServer(new C2M_RequestShopExchangeInfo() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- for (int i = 0; i < response.ks.Count; i++)
- {
- RechargeDataManager.Instance.UpdateExchangeData(response.ks[i], response.vs[i]);
- }
- }
- }
- }
- public static async ETTask ReqExchangeShopItem(int exchangeId)
- {
- M2C_ExchangeShopItem response = null;
- response = (M2C_ExchangeShopItem)await MessageHelper.SendToServer(new C2M_ExchangeShopItem() { ExchangeId = exchangeId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- RechargeDataManager.Instance.UpdateExchangeData(response.ExchangeId, response.ExchangeTimes);
- }
- }
- }
- }
- }
|