EnduringGiftBoxView.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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.costType == CostType.ITEM)
  162. {
  163. //货币
  164. ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(shopCfg.costId);
  165. item.m_btnBuy.m_loaIcon.visible = true;
  166. item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetIconPath(costCfg);
  167. }
  168. else if (shopCfg.costType == 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.m_loaIcon.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. }
  297. //领取按钮点击事件
  298. // ReSharper disable Unity.PerformanceAnalysis
  299. private void OnBtnCurReceiveClick(EventContext context)
  300. {
  301. GObject sender = context.sender as GObject;
  302. GObject obj = sender.parent;
  303. ShopCfg cfg = obj.data as ShopCfg;
  304. bool isSellOut = EnduringGiftBoxDataManager.Instance.DayIsRebateGiftBox(cfg.itemId);
  305. if (isSellOut)
  306. {
  307. EnduringGiftBoxSProxy.ReqGetGiftBagRebate(cfg.id).Coroutine();
  308. }
  309. else
  310. {
  311. PromptController.Instance.ShowFloatTextPrompt("无法领取");
  312. }
  313. }
  314. //购买按钮点击事件
  315. // ReSharper disable Unity.PerformanceAnalysis
  316. private void OnBtnBuyClick(EventContext context)
  317. {
  318. if (_itemId == ConstItemID.POWER && GuideDataManager.IsGuideFinish(ConstGuideId.BUY_POWER) <= 0)
  319. {
  320. GuideController.TryCompleteGuideIndex(ConstGuideId.BUY_POWER, 1);
  321. GuideController.TryCompleteGuide(ConstGuideId.BUY_POWER, 1);
  322. }
  323. GObject sender = context.sender as GObject;
  324. GObject obj = sender.parent;
  325. ShopCfg cfg = obj.data as ShopCfg;
  326. bool isSellOut = cfg.maxBuyNum > 0 &&
  327. cfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(cfg.id) <= 0;
  328. if (isSellOut)
  329. {
  330. PromptController.Instance.ShowFloatTextPrompt("已售罄");
  331. return;
  332. }
  333. if (!ShopDataManager.Instance.GetShopGoodsStateById(cfg.id))
  334. {
  335. PromptController.Instance.ShowFloatTextPrompt(ShopDataManager.Instance.GetShopGoodsStateTips(cfg.id));
  336. return;
  337. }
  338. if (cfg.costType == CostType.FREE)
  339. {
  340. ShopSProxy.ReqShopBuy(cfg.id, 1).Coroutine();
  341. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
  342. }
  343. else
  344. {
  345. ViewManager.Show<ItemExchangeView>(cfg.id);
  346. }
  347. }
  348. // ReSharper disable Unity.PerformanceAnalysis
  349. private void ChildListItemRender(int index, GObject obj)
  350. {
  351. UI_ComItem uiItemChild = UI_ComItem.Proxy(obj);
  352. var shopCfg = uiItemChild.target.parent.data as ShopCfg;
  353. var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
  354. // uiItemChild.m_showRreceives.visible = false;
  355. //var curGiftBoxState = EnduringGiftBoxDataManager.GiftBoxStateDic[shopCfg.id];
  356. int[][] result;
  357. if (shopCfg.refreshType == RefreshType.DAY)
  358. {
  359. result = itemCfg.itemsArr;
  360. // uiItemChild.m_bagYellow.visible = false;
  361. // uiItemChild.m_bagBlue.visible = true;
  362. // uiItemChild.m_bagYellowEx.visible = false;
  363. // uiItemChild.m_bagBlueEx.visible = true;
  364. }
  365. else
  366. {
  367. //周刷
  368. result = itemCfg.param1Arr;
  369. // uiItemChild.m_bagYellow.visible = true;
  370. // uiItemChild.m_bagBlue.visible = false;
  371. // uiItemChild.m_bagYellowEx.visible = true;
  372. // uiItemChild.m_bagBlueEx.visible = false;
  373. }
  374. // if (curGiftBoxState == EnduringGiftBoxBuyStatus.YesGet)
  375. // {
  376. // uiItemChild.m_showRreceives.visible = true;
  377. // }
  378. // else if (curGiftBoxState == EnduringGiftBoxBuyStatus.NoGet)
  379. // {
  380. // uiItemChild.m_showRreceives.visible = false;
  381. // }
  382. var itemArr = result[index];
  383. var itemCfgChild = ItemCfgArray.Instance.GetCfg(itemArr[0]);
  384. uiItemChild.target.data = itemCfgChild;
  385. uiItemChild.m_txtCount.text = itemArr[1].ToString();
  386. uiItemChild.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfgChild);
  387. uiItemChild.m_QualityType.selectedIndex = itemCfgChild.rarity - 1;
  388. UI_ComItem.ProxyEnd();
  389. }
  390. //弹出物品详细描述框
  391. private void OnListSelectorItemClick(EventContext context)
  392. {
  393. GComponent item = context.data as GComponent;
  394. ItemCfg itemCfg = item.data as ItemCfg;
  395. GoodsItemTipsController.ShowItemTips(itemCfg.id);
  396. }
  397. // ReSharper disable Unity.PerformanceAnalysis
  398. // ReSharper disable Unity.PerformanceAnalysis
  399. private async void OnClickBtnSure()
  400. {
  401. if (_maxTimes > 0 && (_buyTimes + _count) > _maxTimes)
  402. {
  403. PromptController.Instance.ShowFloatTextPrompt("购买次数不足");
  404. return;
  405. }
  406. ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _count, out int costId, out int coustNum,
  407. out int buyNum);
  408. Debug.Log(costId + "数量:" + ItemDataManager.GetItemNum(costId));
  409. if (ItemDataManager.GetItemNum(costId) < coustNum)
  410. {
  411. ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId);
  412. if (_itemId == ConstItemID.DIAMOND_PURPLE)
  413. {
  414. PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足,请前往商城选购", costCfg.name));
  415. }
  416. else
  417. {
  418. AlertUI.Show(costCfg.name + "不足,是否前往购买?").SetLeftButton(true).SetRightButton(true, "确认",
  419. (AlertWindow.AlertCallback)((object data) =>
  420. {
  421. long costNeedCount = coustNum - ItemDataManager.GetItemNum(costId);
  422. BuyItemConteoller.Show(costId, costNeedCount, ConstBuyType.TYPE_ITEM, null, true, true,
  423. GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED);
  424. }));
  425. OnClickBtnCancel();
  426. }
  427. return;
  428. }
  429. bool result = await ItemExchangeSProxy.ItemExchange(_itemId, _count);
  430. if (result)
  431. {
  432. PromptController.Instance.ShowFloatTextPrompt("购买成功", MessageType.SUCCESS);
  433. if (_onSuccess != null)
  434. {
  435. _onSuccess();
  436. }
  437. }
  438. UpdateView();
  439. //判断一下是不是从主要界面进来的
  440. if (_type == 0)
  441. {
  442. this.Hide();
  443. }
  444. }
  445. //购买连续礼包之后,更新数据+更新界面
  446. // ReSharper disable Unity.PerformanceAnalysis
  447. private void UpDayRebateAndView(EventContext context)
  448. {
  449. ShopCfg shopCfg = context.data as ShopCfg;
  450. var itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
  451. if (itemCfg.itemType == ConstItemType.USEABLE &&
  452. itemCfg.funType == ConstItemFuncType.CONTINUOUS_REWARD_GIFT)
  453. {
  454. int dayNum = EnduringGiftBoxDataManager.Instance.GetItemRebateDay(itemCfg.id);
  455. int totalDayNum = dayNum + itemCfg.param2Arr[0];
  456. EnduringGiftBoxDataManager.Instance.UpDayAllRebateItemDic(itemCfg.id, totalDayNum);
  457. EnduringGiftBoxDataManager.Instance.AddDayRebateItemIds(itemCfg.id);
  458. }
  459. UpdateView();
  460. }
  461. protected override void OnHide()
  462. {
  463. EffectUIPool.Recycle(_effectUI1);
  464. _effectUI1 = null;
  465. EffectUIPool.Recycle(_effectUI2);
  466. _effectUI2 = null;
  467. EffectUIPool.Recycle(_effectUI3);
  468. _effectUI3 = null;
  469. EffectUIPool.Recycle(_effectUI4);
  470. _effectUI4 = null;
  471. this.RemoveEventListener();
  472. base.Hide();
  473. _onSuccess = null;
  474. Timers.inst.Remove(CheckGuide);
  475. }
  476. private void OnClickBtnCancel()
  477. {
  478. // Dispose();
  479. this.Hide();
  480. }
  481. private void CheckGuide()
  482. {
  483. Timers.inst.AddUpdate(CheckGuide);
  484. }
  485. private void CheckGuide(object param)
  486. {
  487. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_POWER) <= 0)
  488. {
  489. UpdateToCheckGuide(null);
  490. }
  491. else
  492. {
  493. Timers.inst.Remove(CheckGuide);
  494. }
  495. }
  496. protected override void UpdateToCheckGuide(object param)
  497. {
  498. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  499. if (_itemId == ConstItemID.POWER)
  500. {
  501. GuideController.TryGuide(_ui.m_list.GetChildAt(1).asCom.GetChild("btnCurReceive").asButton,
  502. ConstGuideId.BUY_POWER, 1, "这里可以购买体力超值返利包,每天都能领体力哦~");
  503. }
  504. }
  505. }
  506. }