|
@@ -0,0 +1,483 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using ET;
|
|
|
+using FairyGUI;
|
|
|
+using UI.EnduringGiftBox;
|
|
|
+using UnityEngine;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ public class EnduringGiftBoxView : BaseWindow
|
|
|
+ {
|
|
|
+ private UI_EnduringGiftBoxUI _ui;
|
|
|
+
|
|
|
+ private int _itemId; //道具id,该页面目前只给:体力,金币使用
|
|
|
+ private int _count; //本次购买次数
|
|
|
+ private int _buyTimes = 0; //已购次数
|
|
|
+
|
|
|
+ private Action _onSuccess;
|
|
|
+ private int _maxTimes = 0;
|
|
|
+ private string _message = "";
|
|
|
+ private List<ShopCfg> _shopCfgList = new List<ShopCfg>();
|
|
|
+ private GameObject _gameObject1;
|
|
|
+ private GameObject _gameObject2;
|
|
|
+ private GameObject _gameObject3;
|
|
|
+ private GameObject _gameObject4;
|
|
|
+
|
|
|
+ private GoWrapper _wrapper1;
|
|
|
+ private GoWrapper _wrapper2;
|
|
|
+ private GoWrapper _wrapper3;
|
|
|
+ private GoWrapper _wrapper4;
|
|
|
+
|
|
|
+ protected override void OnInit()
|
|
|
+ {
|
|
|
+ base.OnInit();
|
|
|
+ packageName = UI_EnduringGiftBoxUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_EnduringGiftBoxUI.Create();
|
|
|
+ this.viewCom = _ui.target;
|
|
|
+ this.viewCom.Center();
|
|
|
+ this.modal = true;
|
|
|
+ viewAnimationType = EnumViewAnimationType.None;
|
|
|
+
|
|
|
+ _ui.m_btnSure.onClick.Add(OnClickBtnSure);
|
|
|
+ _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
|
|
|
+ _ui.m_btnBack.onClick.Add(OnClickBtnCancel);
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ SceneController.DestroyObjectFromView(_gameObject1, _wrapper1);
|
|
|
+ SceneController.DestroyObjectFromView(_gameObject2, _wrapper2);
|
|
|
+ SceneController.DestroyObjectFromView(_gameObject3, _wrapper3);
|
|
|
+ SceneController.DestroyObjectFromView(_gameObject4, _wrapper4);
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ _ui = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ EnduringGiftBoxController.Dispose();
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnShown()
|
|
|
+ {
|
|
|
+ base.OnShown();
|
|
|
+ AddEffect();
|
|
|
+ _ui.m_t1.Play();
|
|
|
+ _ui.m_t2.Play();
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+ EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpDayRebateAndView);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, UpdateView);
|
|
|
+ //EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpDayRebateAndView);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, UpdateView);
|
|
|
+ base.RemoveEventListener();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void AddEffect()
|
|
|
+ {
|
|
|
+ string resPath3;
|
|
|
+ if (_itemId == ConstItemID.POWER)
|
|
|
+ {
|
|
|
+ resPath3 = ResPathUtil.GetViewEffectPath("ui_Activity", "Activity_people02");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ resPath3 = ResPathUtil.GetViewEffectPath("ui_Activity", "Activity_people01");
|
|
|
+ }
|
|
|
+
|
|
|
+ //小人
|
|
|
+ SceneController.AddObjectToView(null, null, _ui.m_holderBaby, resPath3,
|
|
|
+ out _gameObject3, out _wrapper3);
|
|
|
+
|
|
|
+ //爆发,大泡泡
|
|
|
+ string resPath1 = ResPathUtil.GetViewEffectPath("ui_Activity", "Activity_baofa");
|
|
|
+ SceneController.AddObjectToView(null, null, _ui.m_holderPaoMax, resPath1,
|
|
|
+ out _gameObject1, out _wrapper1);
|
|
|
+
|
|
|
+ //持续的小泡泡
|
|
|
+ string resPath2 = ResPathUtil.GetViewEffectPath("ui_Activity", "Activity_chixu");
|
|
|
+ SceneController.AddObjectToView(null, null, _ui.m_holderPaoMin, resPath2,
|
|
|
+ out _gameObject2, out _wrapper2);
|
|
|
+
|
|
|
+ //爆发时候的发光
|
|
|
+ string resPath4 = ResPathUtil.GetViewEffectPath("ui_Activity", "Activity_glow");
|
|
|
+ SceneController.AddObjectToView(null, null, _ui.m_holderFg, resPath4,
|
|
|
+ out _gameObject4, out _wrapper4);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void SetParams(int itemId, int count, Action onSuccess, string message = "")
|
|
|
+ {
|
|
|
+ _itemId = itemId;
|
|
|
+ _count = count;
|
|
|
+
|
|
|
+ _onSuccess = onSuccess;
|
|
|
+ _message = message;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateView()
|
|
|
+ {
|
|
|
+ _buyTimes = ItemDataManager.GetItemExchangeTimes(_itemId);
|
|
|
+
|
|
|
+ ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _count, out int costId, out int coustNum,
|
|
|
+ out int buyNum);
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_itemId);
|
|
|
+ ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
|
|
|
+ _ui.m_txtNeed.text = string.Format("是否花费{0}{1} 购买{2}{3}", coustNum, costCfg.name, buyNum, itemCfg.name);
|
|
|
+
|
|
|
+ _ui.m_txtNum.text = "";
|
|
|
+ _maxTimes = ItemExchangeCfgArray.Instance.GetCfg(_itemId).maxLimit;
|
|
|
+ if (_maxTimes != 0)
|
|
|
+ {
|
|
|
+ _ui.m_txtNum.text = string.Format("今日剩余购买次数{0}/{1}", _maxTimes - _buyTimes, _maxTimes);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_message != "")
|
|
|
+ {
|
|
|
+ _ui.m_txtNum.text = _message;
|
|
|
+ }
|
|
|
+
|
|
|
+ _shopCfgList.Clear();
|
|
|
+ //常驻礼包
|
|
|
+ if (_itemId == ConstItemID.POWER)
|
|
|
+ {
|
|
|
+ //体力礼包
|
|
|
+ _shopCfgList = ShopCfgArray.Instance
|
|
|
+ .GetCfgsBymenu1Andmenu2(ConstStoreTabId.ENDURING_GIFT_BOX, ConstStoreSubId.ENDURING_GIFT_BOX_POWER)
|
|
|
+ .OrderBy(a => a.refreshType).ToList();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //金币礼包
|
|
|
+ _shopCfgList = ShopCfgArray.Instance
|
|
|
+ .GetCfgsBymenu1Andmenu2(ConstStoreTabId.ENDURING_GIFT_BOX, ConstStoreSubId.ENDURING_GIFT_BOX_GOLD)
|
|
|
+ .OrderBy(a => a.refreshType).ToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ _ui.m_txtPromptExt.text = string.Format("除了上述购买{0}的途径,我们还提供了更多的优惠礼包选择", itemCfg.name);
|
|
|
+ _ui.m_list.itemRenderer = ListItemRender;
|
|
|
+ _ui.m_list.numItems = _shopCfgList.Count;
|
|
|
+ _ui.m_list.visible = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ListItemRender(int index, GObject obj)
|
|
|
+ {
|
|
|
+ ShopCfg shopCfg = _shopCfgList[index];
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId); //购买的物品-礼包
|
|
|
+ UI_ComCurSupplyItem item = UI_ComCurSupplyItem.Proxy(obj);
|
|
|
+ item.target.data = shopCfg;
|
|
|
+
|
|
|
+ //返利包
|
|
|
+ item.m_txtTitle.text = itemCfg.name;
|
|
|
+ item.m_txtWeekPrompt.visible = false;
|
|
|
+ item.m_icoWeekPromptTag.visible = false;
|
|
|
+ if (itemCfg.param2Arr.Length != 0)
|
|
|
+ {
|
|
|
+ item.m_txtWeekPrompt.visible = true;
|
|
|
+ item.m_icoWeekPromptTag.visible = true;
|
|
|
+ item.m_txtWeekPrompt.text = string.Format("连续{0}天每日获得", itemCfg.param2Arr[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ int numItems;
|
|
|
+ var childItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
|
|
|
+ var remainBuyNum = shopCfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
|
|
|
+ item.m_comLeftGiftBox.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
+ item.m_btnBuy.m_txtOldPrice.text = $"{shopCfg.originalPrice}";
|
|
|
+ item.m_btnBuy.m_txtNewPrice.text = $"{shopCfg.price}元";
|
|
|
+ item.m_comLeftGiftBox.target.data = itemCfg;
|
|
|
+ item.m_comLeftGiftBox.m_loaIcon.onClick.Add(OnListSelectorItemClick);
|
|
|
+
|
|
|
+ if (shopCfg.refreshType == RefreshType.DAY) //也可以换成人民币来做条件
|
|
|
+ {
|
|
|
+ //日刷
|
|
|
+ item.m_comLeftGiftBox.m_comDiscount.target.visible = true;
|
|
|
+ item.m_comLeftGiftBox.m_comDiscount.m_txtDiscountNum.text = "1.5折"; //之后再计算赋值
|
|
|
+ item.m_comLeftGiftBox.m_comGouMaiGetText.target.visible = false;
|
|
|
+ item.m_txtUrc.text = string.Format("今日剩余{0}/{1}", remainBuyNum, shopCfg.maxBuyNum);
|
|
|
+ item.m_txtLrc.text = string.Format("可获得{0}会员积分", shopCfg.price * 10);
|
|
|
+ item.m_txtWeekPrompt.visible = false;
|
|
|
+ item.m_icoWeekPromptTag.visible = false;
|
|
|
+ numItems = childItemCfg.itemsArr.Length;
|
|
|
+
|
|
|
+ if (remainBuyNum == 0)
|
|
|
+ {
|
|
|
+ //已售完
|
|
|
+ item.m_btnBuy.target.visible = true;
|
|
|
+ item.m_btnCurReceive.target.visible = false;
|
|
|
+ item.m_btnBuy.m_bagYellow.visible = false;
|
|
|
+ item.m_btnBuy.m_bagGrey.visible = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //未售完
|
|
|
+ item.m_btnBuy.target.visible = true;
|
|
|
+ item.m_btnCurReceive.target.visible = false;
|
|
|
+ item.m_btnBuy.m_bagYellow.visible = true;
|
|
|
+ item.m_btnBuy.m_bagGrey.visible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //周刷
|
|
|
+ var weekGiftBoxState = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(shopCfg.itemId);
|
|
|
+ item.m_comLeftGiftBox.m_comDiscount.target.visible = false;
|
|
|
+ item.m_comLeftGiftBox.m_comGouMaiGetText.target.visible = true;
|
|
|
+ var itemArr = itemCfg.itemsArr[0];
|
|
|
+ ItemCfg getItemCfg = ItemCfgArray.Instance.GetCfg(itemArr[0]); //及时获得的物品,读取第一个显示ICON
|
|
|
+ item.m_comLeftGiftBox.m_comGouMaiGetText.m_loaIcon.url = ResPathUtil.GetIconPath(getItemCfg);
|
|
|
+ item.m_comLeftGiftBox.m_comGouMaiGetText.m_txtGetGold.text = itemArr[1].ToString();
|
|
|
+ item.m_txtUrc.text = string.Format("每周限购{0}/{1}", remainBuyNum, shopCfg.maxBuyNum);
|
|
|
+ item.m_txtLrc.text = string.Format("剩余{0}天", "");
|
|
|
+ item.m_txtWeekPrompt.visible = true;
|
|
|
+ item.m_txtWeekPrompt.text =
|
|
|
+ string.Format("连续{0}天每日获得", NumberUtil.GetChiniseNumberText(itemCfg.param2Arr[0]));
|
|
|
+ item.m_icoWeekPromptTag.visible = true;
|
|
|
+
|
|
|
+ numItems = childItemCfg.param1Arr.Length;
|
|
|
+
|
|
|
+ //是否需要领取
|
|
|
+ if (weekGiftBoxState)
|
|
|
+ {
|
|
|
+ item.m_btnBuy.target.visible = false;
|
|
|
+ item.m_btnCurReceive.target.visible = true;
|
|
|
+ item.m_btnCurReceive.m_receive.visible = true;
|
|
|
+ item.m_btnCurReceive.m_received.visible = false;
|
|
|
+ item.m_btnCurReceive.m_txtRec.text = "领取";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //是否能购买
|
|
|
+ if (remainBuyNum == 0)
|
|
|
+ {
|
|
|
+ //已经领取
|
|
|
+ if (EnduringGiftBoxDataManager.Instance.DayRebateItemIds.Contains(shopCfg.itemId))
|
|
|
+ {
|
|
|
+ item.m_btnBuy.target.visible = false;
|
|
|
+ item.m_btnCurReceive.target.visible = true;
|
|
|
+ item.m_btnCurReceive.m_receive.visible = false;
|
|
|
+ item.m_btnCurReceive.m_received.visible = true;
|
|
|
+ item.m_btnCurReceive.m_txtRec.text = "已领取";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.m_btnCurReceive.target.visible = false;
|
|
|
+ item.m_btnBuy.target.visible = true;
|
|
|
+ item.m_btnBuy.m_bagGrey.visible = true;
|
|
|
+ item.m_btnBuy.m_bagYellow.visible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //未售完
|
|
|
+ item.m_btnBuy.target.visible = true;
|
|
|
+ item.m_btnBuy.m_bagGrey.visible = false;
|
|
|
+ item.m_btnBuy.m_bagYellow.visible = true;
|
|
|
+ item.m_btnCurReceive.target.visible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //领取按钮点击事件
|
|
|
+ item.m_btnCurReceive.target.onClick.Add(OnBtnCurReceiveClick);
|
|
|
+ //购买按钮点击事件
|
|
|
+ item.m_btnBuy.target.onClick.Add(OnBtnBuyClick);
|
|
|
+
|
|
|
+ item.m_list.data = shopCfg;
|
|
|
+ item.m_list.itemRenderer = ChildListItemRender;
|
|
|
+ item.m_list.numItems = numItems;
|
|
|
+ }
|
|
|
+
|
|
|
+ //领取按钮点击事件
|
|
|
+ private void OnBtnCurReceiveClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject sender = context.sender as GObject;
|
|
|
+ GObject obj = sender.parent;
|
|
|
+ ShopCfg cfg = obj.data as ShopCfg;
|
|
|
+ bool isSellOut = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(cfg.itemId);
|
|
|
+
|
|
|
+ if (isSellOut)
|
|
|
+ {
|
|
|
+ EnduringGiftBoxSProxy.ReqGetGiftBagRebate(cfg.id).Coroutine();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("无法领取");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //购买按钮点击事件
|
|
|
+ private void OnBtnBuyClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject sender = context.sender as GObject;
|
|
|
+ GObject obj = sender.parent;
|
|
|
+ ShopCfg cfg = obj.data as ShopCfg;
|
|
|
+ bool isSellOut = cfg.maxBuyNum > 0 &&
|
|
|
+ cfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(cfg.id) <= 0;
|
|
|
+
|
|
|
+ if (isSellOut)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("已售罄");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!ShopDataManager.Instance.GetShopGoodsStateById(cfg.id))
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt(ShopDataManager.Instance.GetShopGoodsStateTips(cfg.id));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cfg.costType == CostType.FREE)
|
|
|
+ {
|
|
|
+ ShopSProxy.ReqShopBuy(cfg.id, 1).Coroutine();
|
|
|
+ LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ViewManager.Show<ItemExchangeView>(cfg.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ChildListItemRender(int index, GObject obj)
|
|
|
+ {
|
|
|
+ UI_ComRewardIconItem uiItemChild = UI_ComRewardIconItem.Proxy(obj);
|
|
|
+ var shopCfg = uiItemChild.target.parent.data as ShopCfg;
|
|
|
+ var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
|
|
|
+ // uiItemChild.m_showRreceives.visible = false;
|
|
|
+
|
|
|
+ //var curGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
|
|
|
+ int[][] result;
|
|
|
+ if (shopCfg.refreshType == RefreshType.DAY)
|
|
|
+ {
|
|
|
+ result = itemCfg.itemsArr;
|
|
|
+ uiItemChild.m_bagYellow.visible = false;
|
|
|
+ uiItemChild.m_bagBlue.visible = true;
|
|
|
+ uiItemChild.m_bagYellowEx.visible = false;
|
|
|
+ uiItemChild.m_bagBlueEx.visible = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //周刷
|
|
|
+ result = itemCfg.param1Arr;
|
|
|
+ uiItemChild.m_bagYellow.visible = true;
|
|
|
+ uiItemChild.m_bagBlue.visible = false;
|
|
|
+ uiItemChild.m_bagYellowEx.visible = true;
|
|
|
+ uiItemChild.m_bagBlueEx.visible = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (curGiftBoxState == EnduringGiftBoxBuyStatus.YesGet)
|
|
|
+ // {
|
|
|
+ // uiItemChild.m_showRreceives.visible = true;
|
|
|
+ // }
|
|
|
+ // else if (curGiftBoxState == EnduringGiftBoxBuyStatus.NoGet)
|
|
|
+ // {
|
|
|
+ // uiItemChild.m_showRreceives.visible = false;
|
|
|
+ // }
|
|
|
+
|
|
|
+ var itemArr = result[index];
|
|
|
+ var itemCfgChild = ItemCfgArray.Instance.GetCfg(itemArr[0]);
|
|
|
+ uiItemChild.m_loaIcon.onClick.Add(OnListSelectorItemClick);
|
|
|
+ uiItemChild.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfgChild);
|
|
|
+ uiItemChild.m_num.text = itemArr[1].ToString();
|
|
|
+ uiItemChild.target.data = itemCfgChild;
|
|
|
+ UI_ComRewardIconItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ //弹出物品详细描述框
|
|
|
+ private void OnListSelectorItemClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject sender = context.sender as GObject;
|
|
|
+ GObject obj = sender.parent;
|
|
|
+ ItemCfg itemCfg = obj.data as ItemCfg;
|
|
|
+ GoodsItemTipsController.ShowItemTips(itemCfg.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ private async void OnClickBtnSure()
|
|
|
+ {
|
|
|
+ if (_maxTimes > 0 && (_buyTimes + _count) > _maxTimes)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("购买次数不足");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _count, out int costId, out int coustNum,
|
|
|
+ out int buyNum);
|
|
|
+
|
|
|
+ Debug.Log(costId + "数量:" + ItemDataManager.GetItemNum(costId));
|
|
|
+ if (ItemDataManager.GetItemNum(costId) < coustNum)
|
|
|
+ {
|
|
|
+ ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
|
|
|
+ if (_itemId == ConstItemID.DIAMOND_PURPLE)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足,请前往商城选购", costCfg.name));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ AlertUI.Show(costCfg.name + "不足,是否前往购买?").SetLeftButton(true).SetRightButton(true, "确认",
|
|
|
+ (AlertWindow.AlertCallback)((object data) =>
|
|
|
+ {
|
|
|
+ long costNeedCount = coustNum - ItemDataManager.GetItemNum(costId);
|
|
|
+ BuyItemConteoller.Show(costId, costNeedCount, ConstBuyType.TYPE_ITEM, null, true, true,
|
|
|
+ GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED);
|
|
|
+ }));
|
|
|
+ OnClickBtnCancel();
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ bool result = await ItemExchangeSProxy.ItemExchange(_itemId, _count);
|
|
|
+
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("购买成功", MessageType.SUCCESS);
|
|
|
+ if (_onSuccess != null)
|
|
|
+ {
|
|
|
+ _onSuccess();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.Hide();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpDayRebateAndView(EventContext context)
|
|
|
+ {
|
|
|
+ ShopCfg shopCfg = context.data as ShopCfg;
|
|
|
+ var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
|
|
|
+
|
|
|
+ if (itemCfg.itemType == ConstItemType.GIFT_BAG &&
|
|
|
+ itemCfg.subType == ConstItemSubType.CONTINUOUS_REWARD_GIFT)
|
|
|
+ {
|
|
|
+ EnduringGiftBoxDataManager.Instance.AddDayAllRebateItemIds(itemCfg.id);
|
|
|
+ EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(itemCfg.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ this.RemoveEventListener();
|
|
|
+ Dispose();
|
|
|
+ base.Hide();
|
|
|
+ _onSuccess = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnCancel()
|
|
|
+ {
|
|
|
+ // Dispose();
|
|
|
+ this.Hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|