ActivityGetYuanXiaoSuccessView.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System.Collections;
  2. using UnityEngine;
  3. using UI.ActivityGetYuanXiao;
  4. using System.Collections.Generic;
  5. using FairyGUI;
  6. namespace GFGGame
  7. {
  8. public class ActivityGetYuanXiaoSuccessView : BaseWindow
  9. {
  10. private UI_ActivityGetYuanXiaoSuccessUI _ui;
  11. private PickUpGame _cfg;
  12. private List<ItemData> itemDatas;
  13. protected override void OnInit()
  14. {
  15. base.OnInit();
  16. packageName = UI_ActivityGetYuanXiaoSuccessUI.PACKAGE_NAME;
  17. _ui = UI_ActivityGetYuanXiaoSuccessUI.Create();
  18. viewCom = _ui.target;
  19. viewCom.Center();
  20. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  21. modal = true;
  22. clickBlankToClose = false;
  23. _ui.m_listReward.itemRenderer = RenderListRewardItem;
  24. _ui.m_btnExit.onClick.Add(OnClickBtnExit);
  25. }
  26. public override void Dispose()
  27. {
  28. if (_ui != null)
  29. {
  30. _ui.Dispose();
  31. _ui = null;
  32. }
  33. base.Dispose();
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _cfg = (PickUpGame)viewData;
  39. _ui.m_btnRetry.visible = (_cfg.isAgain != 0);
  40. itemDatas = ItemUtil.CreateItemDataList(_cfg.bonusWinArr);
  41. _ui.m_listReward.numItems = itemDatas.Count;
  42. }
  43. private void RenderListRewardItem(int index, GObject obj)
  44. {
  45. if (index >= itemDatas.Count)
  46. {
  47. return;
  48. }
  49. ItemData reward = itemDatas[index];
  50. if (obj.data == null)
  51. {
  52. obj.data = new ItemView(obj as GComponent);
  53. }
  54. (obj.data as ItemView).SetData(reward);
  55. }
  56. private void OnClickBtnExit()
  57. {
  58. Hide();
  59. ViewManager.Hide<ActivityGetYuanXiaoView>();
  60. }
  61. }
  62. }