EnduringGiftBoxView.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using ET;
  5. using FairyGUI;
  6. using UI.CommonGame;
  7. using UI.EnduringGiftBox;
  8. using UnityEngine;
  9. namespace GFGGame
  10. {
  11. public class EnduringGiftBoxView : BaseWindow
  12. {
  13. private UI_EnduringGiftBoxUI _ui;
  14. private int _itemId; //道具id,该页面目前只给:体力,金币使用
  15. private int _count; //本次购买次数
  16. private int _buyTimes = 0; //已购次数
  17. private int _type = 0; //0从别的地方跳转过来. 1从点击TOP菜单栏icon跳转过来
  18. private Action _onSuccess;
  19. private int _maxTimes = 0;
  20. private string _message = "";
  21. private List<ShopCfg> _shopCfgList = new List<ShopCfg>();
  22. private EffectUI _effectUI1;
  23. private EffectUI _effectUI2;
  24. private EffectUI _effectUI3;
  25. private EffectUI _effectUI4;
  26. protected override void OnInit()
  27. {
  28. base.OnInit();
  29. packageName = UI_EnduringGiftBoxUI.PACKAGE_NAME;
  30. _ui = UI_EnduringGiftBoxUI.Create();
  31. this.viewCom = _ui.target;
  32. this.viewCom.Center();
  33. this.modal = true;
  34. viewAnimationType = EnumViewAnimationType.None;
  35. _ui.m_btnSure.onClick.Add(OnClickBtnSure);
  36. _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
  37. _ui.m_btnBack.onClick.Add(OnClickBtnCancel);
  38. }
  39. public override void Dispose()
  40. {
  41. if (_ui != null)
  42. {
  43. _ui.Dispose();
  44. _ui = null;
  45. }
  46. EnduringGiftBoxController.Dispose();
  47. base.Dispose();
  48. }
  49. protected override void OnShown()
  50. {
  51. base.OnShown();
  52. AddEffect();
  53. _ui.m_t1.Play();
  54. _ui.m_t2.Play();
  55. _ui.m_t3.Play(CheckGuide);
  56. UpdateView();
  57. }
  58. protected override void AddEventListener()
  59. {
  60. base.AddEventListener();
  61. EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpDayRebateAndView);
  62. EventAgent.AddEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, UpdateView);
  63. }
  64. protected override void RemoveEventListener()
  65. {
  66. EventAgent.RemoveEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, UpDayRebateAndView);
  67. EventAgent.RemoveEventListener(ConstMessage.CONTINUOUS_REBATE_GIFT, UpdateView);
  68. base.RemoveEventListener();
  69. }
  70. private void AddEffect()
  71. {
  72. //小人
  73. if (_itemId == ConstItemID.POWER)
  74. {
  75. _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderBaby, "ui_Activity", "Activity_people02");
  76. }
  77. else
  78. {
  79. _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderBaby, "ui_Activity", "Activity_people01");
  80. }
  81. //爆发,大泡泡
  82. _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderPaoMax, "ui_Activity", "Activity_baofa");
  83. //持续的小泡泡
  84. _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_holderPaoMin, "ui_Activity", "Activity_chixu");
  85. //爆发时候的发光
  86. _effectUI4 = EffectUIPool.CreateEffectUI(_ui.m_holderFg, "ui_Activity", "Activity_glow");
  87. }
  88. public void SetParams(int itemId, int count, Action onSuccess, string message = "", int type = 0)
  89. {
  90. _itemId = itemId;
  91. _count = count;
  92. _onSuccess = onSuccess;
  93. _message = message;
  94. _type = type;
  95. }
  96. private void UpdateView()
  97. {
  98. _buyTimes = ItemDataManager.GetItemExchangeTimes(_itemId);
  99. ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _count, out int costId, out int coustNum,
  100. out int buyNum);
  101. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_itemId);
  102. ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
  103. _ui.m_txtNeed.text = string.Format("是否花费{0}{1} 购买{2}{3}", coustNum, costCfg.name, buyNum, itemCfg.name);
  104. _maxTimes = ItemExchangeCfgArray.Instance.GetCfg(_itemId).maxLimit;
  105. string showTxt = string.Empty;
  106. _shopCfgList.Clear();
  107. //常驻礼包
  108. if (_itemId == ConstItemID.POWER)
  109. {
  110. //体力礼包
  111. _shopCfgList = ShopCfgArray.Instance
  112. .GetCfgsBymenu1Andmenu2(ConstStoreTabId.ENDURING_GIFT_BOX, ConstStoreSubId.ENDURING_GIFT_BOX_POWER)
  113. .OrderBy(a => a.refreshType).ToList();
  114. _ui.m_txtNeed.align = AlignType.Center;
  115. int maxLimit = ItemExchangeCfgArray.Instance.GetCfg(ConstItemID.POWER).maxLimit;
  116. int lastBuyCount = maxLimit - ItemDataManager.GetItemExchangeTimes(ConstItemID.POWER);
  117. showTxt = string.Format("每5分钟回复1点体力\n今日剩余购买次数{0}/{1}次", lastBuyCount, maxLimit);
  118. }
  119. else
  120. {
  121. //金币礼包
  122. _shopCfgList = ShopCfgArray.Instance
  123. .GetCfgsBymenu1Andmenu2(ConstStoreTabId.ENDURING_GIFT_BOX, ConstStoreSubId.ENDURING_GIFT_BOX_GOLD)
  124. .OrderBy(a => a.refreshType).ToList();
  125. _ui.m_txtNeed.align = AlignType.Right;
  126. if (_maxTimes != 0)
  127. {
  128. showTxt = string.Format("今日剩余购买次数{0}/{1}", _maxTimes - _buyTimes, _maxTimes);
  129. }
  130. }
  131. _ui.m_txtNum.text = showTxt;
  132. _ui.m_txtPromptExt.text = string.Format("除了上述购买{0}的途径,我们还提供了更多的优惠礼包选择", itemCfg.name);
  133. _ui.m_list.itemRenderer = ListItemRender;
  134. _ui.m_list.numItems = _shopCfgList.Count;
  135. _ui.m_list.visible = true;
  136. }
  137. // ReSharper disable Unity.PerformanceAnalysis
  138. private void ListItemRender(int index, GObject obj)
  139. {
  140. ShopCfg shopCfg = _shopCfgList[index];
  141. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId); //购买的物品-礼包
  142. UI_ComCurSupplyItem item = UI_ComCurSupplyItem.Proxy(obj);
  143. item.target.data = shopCfg;
  144. //返利包
  145. item.m_txtTitle.text = itemCfg.name;
  146. item.m_txtWeekPrompt.visible = false;
  147. item.m_btnIcoWeekPromptTag.visible = false;
  148. if (itemCfg.param2Arr.Length != 0)
  149. {
  150. item.m_txtWeekPrompt.visible = true;
  151. item.m_btnIcoWeekPromptTag.visible = true;
  152. item.m_txtWeekPrompt.text = string.Format("连续{0}天每日获得", itemCfg.param2Arr[0]);
  153. }
  154. int numItems;
  155. var childItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
  156. var remainBuyNum = shopCfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
  157. item.m_comLeftGiftBox.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
  158. item.m_btnBuy.m_txtOldPrice.text = $"{shopCfg.originalPrice}";
  159. item.m_btnBuy.m_loaIcon.visible = false;
  160. string mTxtOldPrice = string.Empty;
  161. if (shopCfg.CostTypeReal == CostType.ITEM)
  162. {
  163. //货币
  164. ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(shopCfg.CostIdReal);
  165. item.m_btnBuy.m_loaIcon.visible = true;
  166. item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetIconPath(costCfg);
  167. }
  168. else if (shopCfg.CostTypeReal == CostType.RMB)
  169. {
  170. //人民币
  171. mTxtOldPrice = "元";
  172. }
  173. else
  174. {
  175. //免费
  176. mTxtOldPrice = $"免费";
  177. item.m_btnBuy.m_txtOldPrice.text = "";
  178. item.m_btnBuy.m_txtNewPrice.align = AlignType.Left;
  179. item.m_btnBuy.m_txtNewPrice.x = 90;
  180. }
  181. item.m_btnBuy.m_txtNewPrice.text = $"{shopCfg.Price + mTxtOldPrice}";
  182. item.m_comLeftGiftBox.target.data = itemCfg;
  183. item.m_comLeftGiftBox.target.onClick.Add(OnListSelectorItemClick);
  184. if (shopCfg.originalPrice != shopCfg.Price)
  185. {
  186. var roundedNumStr = NumberUtil.CalculateDiscount(shopCfg.originalPrice, shopCfg.Price);
  187. item.m_comLeftGiftBox.m_comDiscount.target.visible = true;
  188. item.m_comLeftGiftBox.m_comDiscount.m_txtDiscountNum.text = $"{roundedNumStr}折"; //之后再计算赋值
  189. }
  190. else
  191. {
  192. item.m_comLeftGiftBox.m_comDiscount.target.visible = false;
  193. }
  194. if (shopCfg.refreshType == RefreshType.DAY) //也可以换成人民币来做条件
  195. {
  196. //日刷
  197. item.m_comLeftGiftBox.m_comGouMaiGetText.target.visible = false;
  198. item.m_txtUrc.text = string.Format("今日剩余{0}/{1}", remainBuyNum, shopCfg.maxBuyNum);
  199. item.m_txtLrc.text = string.Format("可获得{0}会员积分", shopCfg.Price * 10);
  200. item.m_txtWeekPrompt.visible = false;
  201. item.m_btnIcoWeekPromptTag.visible = false;
  202. numItems = childItemCfg.itemsArr.Length;
  203. if (remainBuyNum == 0)
  204. {
  205. //已售完
  206. item.m_btnBuy.target.visible = true;
  207. item.m_btnCurReceive.target.visible = false;
  208. item.m_btnBuy.m_bagYellow.visible = false;
  209. item.m_btnBuy.m_bagGrey.visible = true;
  210. }
  211. else
  212. {
  213. //未售完
  214. item.m_btnBuy.target.visible = true;
  215. item.m_btnCurReceive.target.visible = false;
  216. item.m_btnBuy.m_bagYellow.visible = true;
  217. item.m_btnBuy.m_bagGrey.visible = false;
  218. }
  219. }
  220. else
  221. {
  222. //周刷
  223. var weekGiftBoxState = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(shopCfg.itemId);
  224. item.m_comLeftGiftBox.m_comGouMaiGetText.target.visible = true;
  225. var itemArr = itemCfg.itemsArr[0];
  226. ItemCfg getItemCfg = ItemCfgArray.Instance.GetCfg(itemArr[0]); //及时获得的物品,读取第一个显示ICON
  227. item.m_comLeftGiftBox.m_comGouMaiGetText.m_loaIcon.url = ResPathUtil.GetIconPath(getItemCfg);
  228. item.m_comLeftGiftBox.m_comGouMaiGetText.m_txtGetGold.text = itemArr[1].ToString();
  229. item.m_txtUrc.text = string.Format("每周限购{0}/{1}", remainBuyNum, shopCfg.maxBuyNum);
  230. int rebateDay = EnduringGiftBoxDataManager.Instance.GetItemRebateDay(itemCfg.id);
  231. string mTxtLrc = string.Empty;
  232. if (rebateDay != 0)
  233. {
  234. mTxtLrc = string.Format("剩余{0}天", rebateDay);
  235. }
  236. item.m_txtLrc.text = mTxtLrc;
  237. item.m_txtWeekPrompt.visible = true;
  238. item.m_txtWeekPrompt.text =
  239. string.Format("连续{0}天每日获得",
  240. itemCfg.param2Arr[0] + 1); //NumberUtil.GetChiniseNumberText(itemCfg.param2Arr[0])
  241. item.m_btnIcoWeekPromptTag.visible = true;
  242. numItems = childItemCfg.param1Arr.Length;
  243. //领取加红点
  244. RedDotController.Instance.SetComRedDot(item.m_btnCurReceive.target, weekGiftBoxState);
  245. //是否需要领取
  246. if (weekGiftBoxState)
  247. {
  248. item.m_btnBuy.target.visible = false;
  249. item.m_btnCurReceive.target.visible = true;
  250. item.m_btnCurReceive.m_receive.visible = true;
  251. item.m_btnCurReceive.m_received.visible = false;
  252. item.m_btnCurReceive.m_txtRec.text = "领取";
  253. }
  254. else
  255. {
  256. //是否能购买
  257. if (remainBuyNum == 0)
  258. {
  259. //已经领取
  260. if (EnduringGiftBoxDataManager.Instance.DayRebateItemIds.Contains(shopCfg.itemId))
  261. {
  262. item.m_btnBuy.target.visible = false;
  263. item.m_btnCurReceive.target.visible = true;
  264. item.m_btnCurReceive.m_receive.visible = false;
  265. item.m_btnCurReceive.m_received.visible = true;
  266. item.m_btnCurReceive.m_txtRec.text = "已领取";
  267. }
  268. else
  269. {
  270. item.m_btnCurReceive.target.visible = false;
  271. item.m_btnBuy.target.visible = true;
  272. item.m_btnBuy.m_bagGrey.visible = true;
  273. item.m_btnBuy.m_bagYellow.visible = false;
  274. }
  275. }
  276. else
  277. {
  278. //未售完
  279. item.m_btnBuy.target.visible = true;
  280. item.m_btnBuy.m_bagGrey.visible = false;
  281. item.m_btnBuy.m_bagYellow.visible = true;
  282. item.m_btnCurReceive.target.visible = false;
  283. }
  284. }
  285. }
  286. item.m_btnIcoWeekPromptTag.onClick.Add(RuleController.ShowRuleView);
  287. item.m_btnIcoWeekPromptTag.data = 300013;
  288. //领取按钮点击事件
  289. item.m_btnCurReceive.target.onClick.Add(OnBtnCurReceiveClick);
  290. //购买按钮点击事件
  291. item.m_btnBuy.target.onClick.Add(OnBtnBuyClick);
  292. item.m_list.data = shopCfg;
  293. item.m_list.itemRenderer = ChildListItemRender;
  294. //item.m_list.onClickItem.Add(OnListSelectorItemClick);
  295. item.m_list.numItems = numItems;
  296. UI_ComCurSupplyItem.ProxyEnd();
  297. }
  298. //领取按钮点击事件
  299. // ReSharper disable Unity.PerformanceAnalysis
  300. private void OnBtnCurReceiveClick(EventContext context)
  301. {
  302. GObject sender = context.sender as GObject;
  303. GObject obj = sender.parent;
  304. ShopCfg cfg = obj.data as ShopCfg;
  305. bool isSellOut = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(cfg.itemId);
  306. if (isSellOut)
  307. {
  308. EnduringGiftBoxSProxy.ReqGetGiftBagRebate(cfg.id).Coroutine();
  309. }
  310. else
  311. {
  312. PromptController.Instance.ShowFloatTextPrompt("无法领取");
  313. }
  314. }
  315. //购买按钮点击事件
  316. // ReSharper disable Unity.PerformanceAnalysis
  317. private void OnBtnBuyClick(EventContext context)
  318. {
  319. if (_itemId == ConstItemID.POWER && GuideDataManager.IsGuideFinish(ConstGuideId.BUY_POWER) <= 0)
  320. {
  321. GuideController.TryCompleteGuideIndex(ConstGuideId.BUY_POWER, 1);
  322. GuideController.TryCompleteGuide(ConstGuideId.BUY_POWER, 1);
  323. }
  324. GObject sender = context.sender as GObject;
  325. GObject obj = sender.parent;
  326. ShopCfg cfg = obj.data as ShopCfg;
  327. bool isSellOut = cfg.maxBuyNum > 0 &&
  328. cfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(cfg.id) <= 0;
  329. if (isSellOut)
  330. {
  331. PromptController.Instance.ShowFloatTextPrompt("已售罄");
  332. return;
  333. }
  334. if (!ShopDataManager.Instance.GetShopGoodsStateById(cfg.id))
  335. {
  336. PromptController.Instance.ShowFloatTextPrompt(ShopDataManager.Instance.GetShopGoodsStateTips(cfg.id));
  337. return;
  338. }
  339. if (cfg.CostTypeReal == CostType.FREE)
  340. {
  341. ShopSProxy.ReqShopBuy(cfg.id, 1).Coroutine();
  342. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
  343. }
  344. else
  345. {
  346. ViewManager.Show<ItemExchangeView>(cfg.id);
  347. }
  348. }
  349. // ReSharper disable Unity.PerformanceAnalysis
  350. private void ChildListItemRender(int index, GObject obj)
  351. {
  352. UI_ComItem uiItemChild = UI_ComItem.Proxy(obj);
  353. var shopCfg = uiItemChild.target.parent.data as ShopCfg;
  354. var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
  355. // uiItemChild.m_showRreceives.visible = false;
  356. //var curGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
  357. int[][] result;
  358. if (shopCfg.refreshType == RefreshType.DAY)
  359. {
  360. result = itemCfg.itemsArr;
  361. // uiItemChild.m_bagYellow.visible = false;
  362. // uiItemChild.m_bagBlue.visible = true;
  363. // uiItemChild.m_bagYellowEx.visible = false;
  364. // uiItemChild.m_bagBlueEx.visible = true;
  365. }
  366. else
  367. {
  368. //周刷
  369. result = itemCfg.param1Arr;
  370. // uiItemChild.m_bagYellow.visible = true;
  371. // uiItemChild.m_bagBlue.visible = false;
  372. // uiItemChild.m_bagYellowEx.visible = true;
  373. // uiItemChild.m_bagBlueEx.visible = false;
  374. }
  375. // if (curGiftBoxState == EnduringGiftBoxBuyStatus.YesGet)
  376. // {
  377. // uiItemChild.m_showRreceives.visible = true;
  378. // }
  379. // else if (curGiftBoxState == EnduringGiftBoxBuyStatus.NoGet)
  380. // {
  381. // uiItemChild.m_showRreceives.visible = false;
  382. // }
  383. var itemArr = result[index];
  384. var itemCfgChild = ItemCfgArray.Instance.GetCfg(itemArr[0]);
  385. uiItemChild.target.data = itemCfgChild;
  386. uiItemChild.target.onClick.Add(OnListSelectorItemClick);
  387. uiItemChild.m_txtCount.text = itemArr[1].ToString();
  388. uiItemChild.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfgChild);
  389. uiItemChild.m_QualityType.selectedIndex = itemCfgChild.rarity - 1;
  390. UI_ComItem.ProxyEnd();
  391. }
  392. //弹出物品详细描述框
  393. private void OnListSelectorItemClick(EventContext context)
  394. {
  395. GObject item = context.sender as GObject;
  396. ItemCfg itemCfg = item.data as ItemCfg;
  397. GoodsItemTipsController.ShowItemTips(itemCfg.id);
  398. }
  399. // ReSharper disable Unity.PerformanceAnalysis
  400. // ReSharper disable Unity.PerformanceAnalysis
  401. private async void OnClickBtnSure()
  402. {
  403. if (_maxTimes > 0 && (_buyTimes + _count) > _maxTimes)
  404. {
  405. PromptController.Instance.ShowFloatTextPrompt("购买次数不足");
  406. return;
  407. }
  408. ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _count, out int costId, out int coustNum,
  409. out int buyNum);
  410. Debug.Log(costId + "数量:" + ItemDataManager.GetItemNum(costId));
  411. if (ItemDataManager.GetItemNum(costId) < coustNum)
  412. {
  413. ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
  414. if (_itemId == ConstItemID.DIAMOND_PURPLE)
  415. {
  416. PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足,请前往商城选购", costCfg.name));
  417. }
  418. else
  419. {
  420. AlertUI.Show(costCfg.name + "不足,是否前往购买?").SetLeftButton(true).SetRightButton(true, "确认",
  421. (AlertWindow.AlertCallback)((object data) =>
  422. {
  423. long costNeedCount = coustNum - ItemDataManager.GetItemNum(costId);
  424. BuyItemConteoller.Show(costId, costNeedCount, ConstBuyType.TYPE_ITEM, null, true, true,
  425. GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED);
  426. }));
  427. OnClickBtnCancel();
  428. }
  429. return;
  430. }
  431. bool result = await ItemExchangeSProxy.ItemExchange(_itemId, _count);
  432. if (result)
  433. {
  434. PromptController.Instance.ShowFloatTextPrompt("购买成功", MessageType.SUCCESS);
  435. if (_onSuccess != null)
  436. {
  437. _onSuccess();
  438. }
  439. }
  440. UpdateView();
  441. //判断一下是不是从主要界面进来的
  442. if (_type == 0)
  443. {
  444. this.Hide();
  445. }
  446. }
  447. //购买连续礼包之后,更新数据+更新界面
  448. // ReSharper disable Unity.PerformanceAnalysis
  449. private void UpDayRebateAndView(EventContext context)
  450. {
  451. ShopCfg shopCfg = context.data as ShopCfg;
  452. var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
  453. if (itemCfg.itemType == ConstItemType.USEABLE &&
  454. itemCfg.funType == ConstItemFuncType.CONTINUOUS_REWARD_GIFT)
  455. {
  456. int dayNum = EnduringGiftBoxDataManager.Instance.GetItemRebateDay(itemCfg.id);
  457. int totalDayNum = dayNum + itemCfg.param2Arr[0];
  458. EnduringGiftBoxDataManager.Instance.UpDayAllRebateItemDic(itemCfg.id, totalDayNum);
  459. EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(itemCfg.id);
  460. }
  461. UpdateView();
  462. }
  463. protected override void OnHide()
  464. {
  465. EffectUIPool.Recycle(_effectUI1);
  466. _effectUI1 = null;
  467. EffectUIPool.Recycle(_effectUI2);
  468. _effectUI2 = null;
  469. EffectUIPool.Recycle(_effectUI3);
  470. _effectUI3 = null;
  471. EffectUIPool.Recycle(_effectUI4);
  472. _effectUI4 = null;
  473. this.RemoveEventListener();
  474. base.Hide();
  475. _onSuccess = null;
  476. Timers.inst.Remove(CheckGuide);
  477. }
  478. private void OnClickBtnCancel()
  479. {
  480. // Dispose();
  481. this.Hide();
  482. }
  483. private void CheckGuide()
  484. {
  485. Timers.inst.AddUpdate(CheckGuide);
  486. }
  487. private void CheckGuide(object param)
  488. {
  489. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_POWER) <= 0)
  490. {
  491. UpdateToCheckGuide(null);
  492. }
  493. else
  494. {
  495. Timers.inst.Remove(CheckGuide);
  496. }
  497. }
  498. protected override void UpdateToCheckGuide(object param)
  499. {
  500. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  501. if (_itemId == ConstItemID.POWER)
  502. {
  503. GuideController.TryGuide(_ui.m_list.GetChildAt(1).asCom.GetChild("btnCurReceive").asButton,
  504. ConstGuideId.BUY_POWER, 1, "这里可以购买体力超值返利包,每天都能领体力哦~");
  505. }
  506. }
  507. }
  508. }