MatchingCompetitionSelectView.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 MatchingCompetitionSelectView : BaseWindow
  10. {
  11. private UI_MatchingCompetitionSelectUI _ui;
  12. private int _seasonIndex = 0;
  13. private bool isRefresh = false;
  14. public override void Dispose()
  15. {
  16. if (_ui != null)
  17. {
  18. _ui.Dispose();
  19. }
  20. _ui = null;
  21. base.Dispose();
  22. }
  23. protected override void OnInit()
  24. {
  25. base.OnInit();
  26. packageName = UI_MatchingCompetitionSelectUI.PACKAGE_NAME;
  27. _ui = UI_MatchingCompetitionSelectUI.Create();
  28. this.viewCom = _ui.target;
  29. isReturnView = true;
  30. isfullScreen = true;
  31. _ui.m_BtnBack.onClick.Add(OnClickBtnBack);
  32. _ui.m_select1.target.onClick.Add(OnClickBtnSelect1);
  33. _ui.m_select2.target.onClick.Add(OnClickBtnSelect2);
  34. _ui.m_ruleBtn.onClick.Add(MatchingCompetitionDataManager.Instance.OnClickBtnRule);
  35. }
  36. protected override void AddEventListener()
  37. {
  38. base.AddEventListener();
  39. }
  40. protected override void OnShown()
  41. {
  42. base.OnShown();
  43. _ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj");
  44. _ui.m_BtnBack.touchable = true;
  45. isRefresh = (bool)this.viewData;
  46. UpdateView();
  47. UpdatePlayer();
  48. }
  49. protected override void OnHide()
  50. {
  51. base.OnHide();
  52. }
  53. protected override void RemoveEventListener()
  54. {
  55. base.RemoveEventListener();
  56. }
  57. private void UpdatePlayer()
  58. {
  59. _ui.m_playerShow1.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.LeftRoleInfo.Ntexture;
  60. _ui.m_playerShow2.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.RightRoleInfo.Ntexture;
  61. MatchingPhotoWorksData otherLeftdata = MatchingTwoDataManager.Instance.LeftRoleInfo;
  62. JudgingRoundRoleInfo otherInfo = otherLeftdata.JudgingInfo;
  63. RoleInfoManager.Instance.UpdateHead(_ui.m_player1.m_head, otherInfo.HeadItemId, otherInfo.HeadBorderItemId);
  64. _ui.m_player1.m_nameText.text = otherInfo.RoleName.ToString();
  65. MatchingPhotoWorksData otherRightdata = MatchingTwoDataManager.Instance.RightRoleInfo;
  66. JudgingRoundRoleInfo otherRightInfo = otherRightdata.JudgingInfo;
  67. RoleInfoManager.Instance.UpdateHead(_ui.m_player2.m_head, otherRightInfo.HeadItemId, otherRightInfo.HeadBorderItemId);
  68. _ui.m_player2.m_nameText.text = otherInfo.RoleName.ToString();
  69. }
  70. private void UpdateView()
  71. {
  72. _ui.m_selectText1.alpha = 0;
  73. _ui.m_selectText2.alpha = 0;
  74. _ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
  75. }
  76. private void OnClickBtnBack()
  77. {
  78. _ui.m_BtnBack.touchable = true;
  79. ViewManager.GoBackFrom(typeof(MatchingCompetitionSelectView).FullName);
  80. }
  81. private void OnClickBtnSelect1()
  82. {
  83. if(MatchingCompetitionDataManager.Instance.MatchingRemainingTimes<=0)
  84. {
  85. PromptController.Instance.ShowFloatTextPrompt("评选次数不足");
  86. return;
  87. }
  88. _ui.m_select1.m_c1.selectedIndex = 1;
  89. _ui.m_select1.m_numText.text = string.Format("心动值{0}", 0);
  90. _ui.m_BtnBack.touchable = false;
  91. _ui.m_t0.Play(()=>OnClickBtnBack());
  92. }
  93. private void OnClickBtnSelect2()
  94. {
  95. if (MatchingCompetitionDataManager.Instance.MatchingRemainingTimes <= 0)
  96. {
  97. PromptController.Instance.ShowFloatTextPrompt("评选次数不足");
  98. return;
  99. }
  100. _ui.m_select2.m_c1.selectedIndex = 1;
  101. _ui.m_select2.m_numText.text = string.Format("心动值{0}", 0);
  102. _ui.m_BtnBack.touchable = false;
  103. _ui.m_t1.Play(() => OnClickBtnBack());
  104. }
  105. }
  106. }