MatchingCompetitionWorkListView.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 MatchingCompetitionWorksListView : BaseWindow
  10. {
  11. private UI_MatchingCompetitionWorkListUI _ui;
  12. private int _seasonIndex = 0;
  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_MatchingCompetitionWorkListUI.PACKAGE_NAME;
  26. _ui = UI_MatchingCompetitionWorkListUI.Create();
  27. this.viewCom = _ui.target;
  28. isReturnView = true;
  29. isfullScreen = true;
  30. _ui.m_workList.itemRenderer = RenderRankList;
  31. _ui.m_BtnBack.onClick.Add(OnClickBtnBack);
  32. }
  33. protected override void AddEventListener()
  34. {
  35. base.AddEventListener();
  36. }
  37. protected override void OnShown()
  38. {
  39. base.OnShown();
  40. _ui.m_bg.url = ResPathUtil.GetBgImgPath("pxs_bj");
  41. _ui.m_titleText.text = JudgingRoundOpenCfgArray.Instance.dataArray[MatchingCompetitionDataManager.Instance.MatchingCompetitionSeason - 1].Name;
  42. _seasonIndex = (int)this.viewData;
  43. UpdateView();
  44. }
  45. protected override void OnHide()
  46. {
  47. base.OnHide();
  48. }
  49. protected override void RemoveEventListener()
  50. {
  51. base.RemoveEventListener();
  52. }
  53. private void UpdateView()
  54. {
  55. _ui.m_workList.numItems = MatchingCompetitionDataManager.Instance._BeforeRankList.Count;
  56. }
  57. private void RenderRankList(int index, GObject obj)
  58. {
  59. UI_Component6 item = UI_Component6.Proxy(obj);
  60. if((index +1) >=1 && (index + 1)<=3)
  61. {
  62. item.m_c1.selectedIndex = index + 1;
  63. }
  64. else
  65. {
  66. item.m_c1.selectedIndex = 0;
  67. }
  68. MatchingPhotoWorksData otherdata = MatchingCompetitionDataManager.Instance._BeforeRankList[index];
  69. JudgingRoundRoleInfo otherInfo = otherdata.JudgingInfo;
  70. otherInfo.Rank = index;
  71. RoleInfoManager.Instance.UpdateHead(item.m_head, otherInfo.HeadItemId, otherInfo.HeadBorderItemId);
  72. item.m_nameText.text = otherInfo.RoleName.ToString();
  73. item.m_countText.text = otherInfo.Score.ToString();
  74. if (item.target.data == null)
  75. {
  76. item.target.onClick.Add(OnClickBtnItem);
  77. }
  78. item.target.data = index;
  79. UI_Component6.ProxyEnd();
  80. }
  81. private void OnClickBtnItem(EventContext context)
  82. {
  83. GObject item = context.sender as GObject;
  84. int index = (int)item.data;
  85. MatchingPhotoWorksData otherInfo = MatchingCompetitionDataManager.Instance._BeforeRankList[index];
  86. List<int> AllIdList = new List<int>();
  87. foreach(var info in otherInfo.JudgingInfo.CollocationInfoList)
  88. {
  89. AllIdList.Add(info.ItemId);
  90. }
  91. MatchingCompetitionDataManager.Instance.DetailNtexture = otherInfo.Ntexture;
  92. ViewManager.Show<MatchingCompetitionDetailView>(AllIdList);
  93. }
  94. private void OnClickBtnBack()
  95. {
  96. ViewManager.GoBackFrom(typeof(MatchingCompetitionWorksListView).FullName);
  97. }
  98. }
  99. }