12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class ShopSProxy
- {
- public static async ETTask<bool> ReqShopInfo()
- {
- S2C_RequestShopInfo response = null;
- response = (S2C_RequestShopInfo)await MessageHelper.SendToServer(new C2S_RequestShopInfo());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- for (int i = 0; i < response.ks.Count; i++)
- {
- ShopDataManager.Instance.UpdateGiftData(response.ks[i], response.vs[i]);
- }
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqShopBuy(int buyId, long buyCount)
- {
- S2C_ShopBuy response = null;
- response = (S2C_ShopBuy)await MessageHelper.SendToServer(new C2S_ShopBuy() { BuyId = buyId, Times = (int)buyCount });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- ShopDataManager.Instance.UpdateGiftData(response.BuyId, response.TotalTimes);
- ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(response.BuyId);
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
- if (LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL && shopCfg.costType == CostType.RMB)
- {
- PromptController.Instance.ShowFloatTextPrompt("虚拟充值成功");
- }
- List<ItemData> itemDatas;
- if (itemCfg.itemType == ConstItemType.GIFT_BAG)
- {
- itemDatas = ItemUtil.CreateItemDataList(itemCfg.itemsArr, response.Times * shopCfg.itemNum);
- }
- else
- {
- itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, response.Times * shopCfg.itemNum);
- }
- BonusController.TryShowBonusList(itemDatas);
- EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
- return true;
- }
- }
- return false;
- }
- }
- }
|