MatchingCompetitionRuleTipsView.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using FairyGUI;
  5. using UI.MatchingCompetition;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. class MatchingCompetitionRuleTipsView : BaseWindow
  10. {
  11. private UI_MatchingCompetitionRuleTips _ui;
  12. private int Season = 1;
  13. public override void Dispose()
  14. {
  15. if (_ui != null)
  16. {
  17. _ui.Dispose();
  18. }
  19. _ui = null;
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. packageName = UI_MatchingCompetitionRuleTips.PACKAGE_NAME;
  26. _ui = UI_MatchingCompetitionRuleTips.Create();
  27. this.viewCom = _ui.target;
  28. modal = true;
  29. this.viewCom.Center();
  30. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  31. _ui.m_rewardList.itemRenderer = RewardItemRender;
  32. }
  33. protected override void AddEventListener()
  34. {
  35. base.AddEventListener();
  36. }
  37. protected override void OnShown()
  38. {
  39. base.OnShown();
  40. Season = MatchingCompetitionDataManager.Instance.MatchingCompetitionSeason;
  41. }
  42. protected override void OnHide()
  43. {
  44. base.OnHide();
  45. }
  46. protected override void RemoveEventListener()
  47. {
  48. base.RemoveEventListener();
  49. }
  50. private void RewardItemRender(int index, GObject obj)
  51. {
  52. UI_MatchingCompetitionRewardItem item = UI_MatchingCompetitionRewardItem.Proxy(obj);
  53. item.m_rankIndex.text = (index + 1).ToString();
  54. if (item.m_rewardList.data == null)
  55. {
  56. item.m_rewardList.itemRenderer = SpecialRewardRender;
  57. }
  58. //item.m_rewardList.data =
  59. //item.m_rewardList.numItems =
  60. UI_MatchingCompetitionRewardItem.ProxyEnd();
  61. }
  62. private static void SpecialRewardRender(int index, GObject obj)
  63. {
  64. var itemInfo = (int[])obj.parent.data;
  65. var itemData = ItemUtil.createItemData(itemInfo);
  66. var itemView = new ItemView(obj as GComponent);
  67. obj.data ??= itemView;
  68. itemView.SetData(itemData);
  69. itemView.ChangeTxtCountStyle();
  70. }
  71. }
  72. }