123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- 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 = 1)
- {
- 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 &&
- (itemCfg.subType == ConstItemSubType.GIFT_BAG_AUTO ||
- itemCfg.subType == ConstItemSubType.CONTINUOUS_REWARD_GIFT))
- {
- itemDatas = ItemUtil.CreateItemDataList(itemCfg.itemsArr, response.Times * shopCfg.itemNum);
- }
- else
- {
- itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, response.Times * shopCfg.itemNum);
- }
-
- EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, shopCfg);
- BonusController.TryShowBonusList(itemDatas);
- EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);
- return true;
- }
- }
- return false;
- }
- /**********************************************会员中心**********************************************/
- //领取VIP等级礼包
- public static async ETTask<bool> ReqGetVipGiftBag(int vipLv)
- {
- S2C_GetVipLevelGift response = null;
- response = (S2C_GetVipLevelGift)await MessageHelper.SendToServer(new C2S_GetVipLevelGift() { VipLevel = vipLv });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- return true;
- }
- }
- return false;
- }
- //领取VIP周礼包
- public static async ETTask<bool> ReqGetVipWeekGiftBag(int vipLv)
- {
- S2C_GetVipWeekGift response = null;
- response = (S2C_GetVipWeekGift)await MessageHelper.SendToServer(new C2S_GetVipWeekGift() { VipLevel = vipLv });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- return true;
- }
- }
- return false;
- }
- /*********************************************************月卡***************************************************/
- //领取每日返还珍珠
- public static async ETTask<bool> ReqGetMonthCardReward(int monthCardType)
- {
- S2C_GetMonthCardReward response = null;
- response = (S2C_GetMonthCardReward)await MessageHelper.SendToServer(new C2S_GetMonthCardReward() { MonthCardType = monthCardType });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- return true;
- }
- }
- return false;
- }
- //领取专属单品
- public static async ETTask<bool> ReqGetMonthCardItem(int month)
- {
- S2C_GetMonthCardItem response = null;
- response = (S2C_GetMonthCardItem)await MessageHelper.SendToServer(new C2S_GetMonthCardItem());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- MonthlyCardClothesCfg clothesCfg = MonthlyCardClothesCfgArray.Instance.GetCfgByyearAndmonth(TimeUtil.GetCurYear(), month);
- List<ItemData> itemDatas = ItemUtil.CreateItemDataList(clothesCfg.clothesArr[0], clothesCfg.clothesArr[1]);
- BonusController.TryShowBonusList(itemDatas);
- return true;
- }
- }
- return false;
- }
- }
- }
|