| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using cfg.GfgCfg;
- using ET;
- using FairyGUI;
- using UI.CommonGame;
- 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 int _type = 0; //0从别的地方跳转过来. 1从点击TOP菜单栏icon跳转过来
- private Action _onSuccess;
- private int _maxTimes = 0;
- private string _message = "";
- private List<ShopCfg> _shopCfgList = new List<ShopCfg>();
- private EffectUI _effectUI1;
- private EffectUI _effectUI2;
- private EffectUI _effectUI3;
- private EffectUI _effectUI4;
- 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()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- EnduringGiftBoxController.Dispose();
- base.Dispose();
- }
- protected override void OnShown()
- {
- base.OnShown();
- AddEffect(() =>
- {
- // 确保所有特效加载完成后再播放动画
- if (_effectUI1 != null && _effectUI1.IsLoaded &&
- _effectUI2 != null && _effectUI2.IsLoaded &&
- _effectUI3 != null && _effectUI3.IsLoaded &&
- _effectUI4 != null && _effectUI4.IsLoaded)
- {
- _ui.m_t1.Play();
- _ui.m_t2.Play();
- _ui.m_t3.Play(CheckGuide);
- }
- UpdateView();
- });
- UpdateView();
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpDayRebateAndView);
- EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, 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(Action onComplete)
- {
- int effectsToLoad = 4;
- int loadedCount = 0;
- bool hasError = false;
- Action effectLoaded = () =>
- {
- loadedCount++;
- if (loadedCount == effectsToLoad)
- {
- if (hasError)
- {
- // 处理加载失败的情况
- PromptController.Instance.ShowFloatTextPrompt("部分特效加载失败");
- }
- onComplete?.Invoke();
- }
- };
- // 小人
- if (_itemId == ConstItemID.POWER)
- {
- EffectUIPool.CreateEffectUI(_ui.m_holderBaby, "ui_Activity", "Activity_people02",
- scale: 100, onComplete: (effect) =>
- {
- if (effect != null)
- {
- _effectUI1 = effect;
- }
- else
- {
- hasError = true;
- }
- effectLoaded();
- });
- }
- else
- {
- EffectUIPool.CreateEffectUI(_ui.m_holderBaby, "ui_Activity", "Activity_people01",
- scale: 100, onComplete: (effect) =>
- {
- if (effect != null)
- {
- _effectUI1 = effect;
- }
- else
- {
- hasError = true;
- }
- effectLoaded();
- });
- }
- // 爆发,大泡泡
- EffectUIPool.CreateEffectUI(_ui.m_holderPaoMax, "ui_Activity", "Activity_baofa",
- scale: 100, onComplete: (effect) =>
- {
- if (effect != null)
- {
- _effectUI2 = effect;
- }
- else
- {
- hasError = true;
- }
- effectLoaded();
- });
- // 持续的小泡泡
- EffectUIPool.CreateEffectUI(_ui.m_holderPaoMin, "ui_Activity", "Activity_chixu",
- scale: 100, onComplete: (effect) =>
- {
- if (effect != null)
- {
- _effectUI3 = effect;
- }
- else
- {
- hasError = true;
- }
- effectLoaded();
- });
- // 爆发时候的发光
- EffectUIPool.CreateEffectUI(_ui.m_holderFg, "ui_Activity", "Activity_glow",
- scale: 100, onComplete: (effect) =>
- {
- if (effect != null)
- {
- _effectUI4 = effect;
- }
- else
- {
- hasError = true;
- }
- effectLoaded();
- });
- }
- public void SetParams(int itemId, int count, Action onSuccess, string message = "", int type = 0)
- {
- _itemId = itemId;
- _count = count;
- _onSuccess = onSuccess;
- _message = message;
- _type = type;
- }
- private void UpdateView()
- {
- _buyTimes = ItemDataManager.GetItemExchangeTimes(_itemId);
- ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _count, out int costId, out int coustNum,
- out int buyNum);
- ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(_itemId);
- ItemCfg costCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(costId);
- _ui.m_txtNeed.text = string.Format("是否花费{0}{1} 购买{2}{3}", coustNum, costCfg.Name, buyNum, itemCfg.Name);
- _maxTimes = CommonDataManager.Tables.TblItemExchangeCfg.GetOrDefault(_itemId).MaxLimit;
- string showTxt = string.Empty;
- _shopCfgList.Clear();
- //常驻礼包
- if (_itemId == ConstItemID.POWER)
- {
- //体力礼包
- _shopCfgList = CommonDataManager.Tables.TblShopCfg.DataList
- .Where(a => a.Menu1 == ConstStoreTabId.ENDURING_GIFT_BOX &&
- a.Menu2 == ConstStoreSubId.ENDURING_GIFT_BOX_POWER).OrderBy(a => a.RefreshType)
- .ToList();
- _ui.m_txtNeed.align = AlignType.Center;
- int maxLimit = CommonDataManager.Tables.TblItemExchangeCfg.GetOrDefault(ConstItemID.POWER).MaxLimit;
- int lastBuyCount = maxLimit - ItemDataManager.GetItemExchangeTimes(ConstItemID.POWER);
- showTxt = string.Format("每5分钟回复1点体力\n今日剩余购买次数{0}/{1}次", lastBuyCount, maxLimit);
- }
- else
- {
- //金币礼包
- _shopCfgList = CommonDataManager.Tables.TblShopCfg.DataList
- .Where(a => a.Menu1 == ConstStoreTabId.ENDURING_GIFT_BOX &&
- a.Menu2 == ConstStoreSubId.ENDURING_GIFT_BOX_GOLD).OrderBy(a => a.RefreshType).ToList();
- _ui.m_txtNeed.align = AlignType.Right;
- if (_maxTimes != 0)
- {
- showTxt = string.Format("今日剩余购买次数{0}/{1}", _maxTimes - _buyTimes, _maxTimes);
- }
- }
- _ui.m_txtNum.text = showTxt;
- _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;
- }
- // ReSharper disable Unity.PerformanceAnalysis
- private void ListItemRender(int index, GObject obj)
- {
- ShopCfg shopCfg = _shopCfgList[index];
- ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(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_btnIcoWeekPromptTag.visible = false;
- if (itemCfg.Param2.Count != 0)
- {
- item.m_txtWeekPrompt.visible = true;
- item.m_btnIcoWeekPromptTag.visible = true;
- item.m_txtWeekPrompt.text = string.Format("连续{0}天每日获得", itemCfg.Param2[0]);
- }
- int numItems;
- var childItemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(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_loaIcon.visible = false;
- string mTxtOldPrice = string.Empty;
- if (shopCfg.CostTypeReal == CostType.ITEM)
- {
- //货币
- ItemCfg costCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(shopCfg.CostIdReal);
- item.m_btnBuy.m_loaIcon.visible = true;
- item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetIconPath(costCfg);
- }
- else if (shopCfg.CostTypeReal == CostType.RMB)
- {
- //人民币
- mTxtOldPrice = "元";
- }
- else
- {
- //免费
- mTxtOldPrice = $"免费";
- item.m_btnBuy.m_txtOldPrice.text = "";
- item.m_btnBuy.m_txtNewPrice.align = AlignType.Left;
- item.m_btnBuy.m_txtNewPrice.x = 90;
- }
- item.m_btnBuy.m_txtNewPrice.text = $"{shopCfg.Price + mTxtOldPrice}";
- item.m_comLeftGiftBox.target.data = itemCfg;
- item.m_comLeftGiftBox.target.onClick.Add(OnListSelectorItemClick);
- if (shopCfg.OriginalPrice != shopCfg.Price)
- {
- var roundedNumStr = NumberUtil.CalculateDiscount(shopCfg.OriginalPrice, shopCfg.Price);
- item.m_comLeftGiftBox.m_comDiscount.target.visible = true;
- item.m_comLeftGiftBox.m_comDiscount.m_txtDiscountNum.text = $"{roundedNumStr}折"; //之后再计算赋值
- }
- else
- {
- item.m_comLeftGiftBox.m_comDiscount.target.visible = false;
- }
- if (shopCfg.RefreshType == RefreshType.DAY) //也可以换成人民币来做条件
- {
- //日刷
- 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_btnIcoWeekPromptTag.visible = false;
- numItems = childItemCfg.Items.Count;
- 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_comGouMaiGetText.target.visible = true;
- var itemArr = itemCfg.Items[0];
- ItemCfg getItemCfg =
- CommonDataManager.Tables.TblItemCfg.GetOrDefault(itemArr.ItemId); //及时获得的物品,读取第一个显示ICON
- item.m_comLeftGiftBox.m_comGouMaiGetText.m_loaIcon.url = ResPathUtil.GetIconPath(getItemCfg);
- item.m_comLeftGiftBox.m_comGouMaiGetText.m_txtGetGold.text = itemArr.Count.ToString();
- item.m_txtUrc.text = string.Format("每周限购{0}/{1}", remainBuyNum, shopCfg.MaxBuyNum);
- int rebateDay = EnduringGiftBoxDataManager.Instance.GetItemRebateDay(itemCfg.Id);
- string mTxtLrc = string.Empty;
- if (rebateDay != 0)
- {
- mTxtLrc = string.Format("剩余{0}天", rebateDay);
- }
- item.m_txtLrc.text = mTxtLrc;
- item.m_txtWeekPrompt.visible = true;
- item.m_txtWeekPrompt.text =
- string.Format("连续{0}天每日获得",
- itemCfg.Param2[0] + 1); //NumberUtil.GetChiniseNumberText(itemCfg.param2Arr[0])
- item.m_btnIcoWeekPromptTag.visible = true;
- numItems = childItemCfg.Param1.Count;
- //领取加红点
- RedDotController.Instance.SetComRedDot(item.m_btnCurReceive.target, weekGiftBoxState);
- //是否需要领取
- 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_btnIcoWeekPromptTag.onClick.Add(RuleController.ShowRuleView);
- item.m_btnIcoWeekPromptTag.data = 300013;
- //领取按钮点击事件
- 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.onClickItem.Add(OnListSelectorItemClick);
- item.m_list.numItems = numItems;
- UI_ComCurSupplyItem.ProxyEnd();
- }
- //领取按钮点击事件
- // ReSharper disable Unity.PerformanceAnalysis
- 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("无法领取");
- }
- }
- //购买按钮点击事件
- // ReSharper disable Unity.PerformanceAnalysis
- private void OnBtnBuyClick(EventContext context)
- {
- if (_itemId == ConstItemID.POWER && GuideDataManager.IsGuideFinish(ConstGuideId.BUY_POWER) <= 0)
- {
- GuideController.TryCompleteGuideIndex(ConstGuideId.BUY_POWER, 1);
- GuideController.TryCompleteGuide(ConstGuideId.BUY_POWER, 1);
- }
- 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.CostTypeReal == CostType.FREE)
- {
- ShopSProxy.ReqShopBuy(cfg.Id, 1).Coroutine();
- LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
- }
- else
- {
- ViewManager.Show<ItemExchangeView>(cfg.Id);
- }
- }
- // ReSharper disable Unity.PerformanceAnalysis
- private void ChildListItemRender(int index, GObject obj)
- {
- UI_ComItem uiItemChild = UI_ComItem.Proxy(obj);
- var shopCfg = uiItemChild.target.parent.data as ShopCfg;
- var itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(shopCfg.ItemId);
- // uiItemChild.m_showRreceives.visible = false;
- //var curGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
- List<ItemParamProto> result;
- if (shopCfg.RefreshType == RefreshType.DAY)
- {
- result = itemCfg.Items.ToGfgGameItemParam();
- // uiItemChild.m_bagYellow.visible = false;
- // uiItemChild.m_bagBlue.visible = true;
- // uiItemChild.m_bagYellowEx.visible = false;
- // uiItemChild.m_bagBlueEx.visible = true;
- }
- else
- {
- //周刷
- result = itemCfg.Param1.ToGfgGameItemParam();
- // 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 = CommonDataManager.Tables.TblItemCfg.GetOrDefault(itemArr.ItemId);
- uiItemChild.target.data = itemCfgChild;
- uiItemChild.target.onClick.Add(OnListSelectorItemClick);
- uiItemChild.m_txtCount.text = itemArr.Count.ToString();
- uiItemChild.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfgChild);
- uiItemChild.m_QualityType.selectedIndex = itemCfgChild.Rarity - 1;
- UI_ComItem.ProxyEnd();
- }
- //弹出物品详细描述框
- private void OnListSelectorItemClick(EventContext context)
- {
- GObject item = context.sender as GObject;
- ItemCfg itemCfg = item.data as ItemCfg;
- GoodsItemTipsController.ShowItemTips(itemCfg.Id);
- }
- // ReSharper disable Unity.PerformanceAnalysis
- // ReSharper disable Unity.PerformanceAnalysis
- 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 = CommonDataManager.Tables.TblItemCfg.GetOrDefault(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();
- }
- }
- UpdateView();
- //判断一下是不是从主要界面进来的
- if (_type == 0)
- {
- this.Hide();
- }
- }
- //购买连续礼包之后,更新数据+更新界面
- // ReSharper disable Unity.PerformanceAnalysis
- private void UpDayRebateAndView(EventContext context)
- {
- ShopCfg shopCfg = context.data as ShopCfg;
- var itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(shopCfg.ItemId);
- if (itemCfg.ItemType == ConstItemType.USEABLE &&
- itemCfg.FunType == ConstItemFuncType.CONTINUOUS_REWARD_GIFT)
- {
- int dayNum = EnduringGiftBoxDataManager.Instance.GetItemRebateDay(itemCfg.Id);
- int totalDayNum = dayNum + itemCfg.Param2[0];
- EnduringGiftBoxDataManager.Instance.UpDayAllRebateItemDic(itemCfg.Id, totalDayNum);
- EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(itemCfg.Id);
- }
- UpdateView();
- }
- protected override void OnHide()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- EffectUIPool.Recycle(_effectUI2);
- _effectUI2 = null;
- EffectUIPool.Recycle(_effectUI3);
- _effectUI3 = null;
- EffectUIPool.Recycle(_effectUI4);
- _effectUI4 = null;
- this.RemoveEventListener();
- base.Hide();
- _onSuccess = null;
- Timers.inst.Remove(CheckGuide);
- }
- private void OnClickBtnCancel()
- {
- // Dispose();
- this.Hide();
- }
- private void CheckGuide()
- {
- Timers.inst.AddUpdate(CheckGuide);
- }
- private void CheckGuide(object param)
- {
- if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_POWER) <= 0)
- {
- UpdateToCheckGuide(null);
- }
- else
- {
- Timers.inst.Remove(CheckGuide);
- }
- }
- protected override void UpdateToCheckGuide(object param)
- {
- if (!ViewManager.CheckIsTopView(this.viewCom)) return;
- if (_itemId == ConstItemID.POWER)
- {
- GuideController.TryGuide(_ui.m_list.GetChildAt(1).asCom.GetChild("btnCurReceive").asButton,
- ConstGuideId.BUY_POWER, 1, "这里可以购买体力超值返利包,每天都能领体力哦~");
- }
- }
- }
- }
|