using System.Collections.Generic; using ET; namespace GFGGame { public class ShopSProxy { public static async ETTask 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 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 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; } } }