XiuFangView.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System.Collections;
  2. using UnityEngine;
  3. using UI.XiuFang;
  4. using FairyGUI;
  5. using ET;
  6. namespace GFGGame
  7. {
  8. public class XiuFangView : BaseView
  9. {
  10. private UI_XiuFangUI _ui;
  11. public override void Dispose()
  12. {
  13. if (_ui != null)
  14. {
  15. _ui.Dispose();
  16. _ui = null;
  17. }
  18. base.Dispose();
  19. }
  20. protected override void OnInit()
  21. {
  22. base.OnInit();
  23. packageName = UI_XiuFangUI.PACKAGE_NAME;
  24. _ui = UI_XiuFangUI.Create();
  25. this.viewCom = _ui.target;
  26. isfullScreen = true;
  27. isReturnView = true;
  28. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  29. _ui.m_component.m_btnClothingShop.target.onClick.Add(OnClickBtnClothingShop);
  30. _ui.m_component.m_btnSuitSynthetic.target.onClick.Add(OnClickBtnSuitSynthetic);
  31. _ui.m_component.m_btnClothingUpgrade.target.onClick.Add(OnClickBtnClothingUpgrade);
  32. _ui.m_component.m_btnDecompose.target.onClick.Add(OnClickBtnDecompose);
  33. _ui.m_component.m_btnGYP.target.onClick.Add(OnClickBtnGYP);
  34. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xf_bg");
  35. }
  36. protected override void AddEventListener()
  37. {
  38. base.AddEventListener();
  39. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  40. }
  41. protected override void OnShown()
  42. {
  43. base.OnShown();
  44. // _ui.m_component.target.scrollPane.SetPosX(0, false);
  45. _ui.m_component.m_btnClothingShop.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingShopView).Name, false) ? 1 : 0;
  46. _ui.m_component.m_btnSuitSynthetic.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SuitSyntheticView).Name, false) ? 1 : 0;
  47. _ui.m_component.m_btnClothingUpgrade.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingListView).Name, false) ? 1 : 0;
  48. _ui.m_component.m_btnDecompose.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingDecomposeView).Name, false) ? 1 : 0;
  49. _ui.m_component.m_btnGYP.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingSelectView).Name, false) ? 1 : 0;
  50. // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.CLOTHING_DECOMPOSE);
  51. // if (GuideDataManager.currentGuideId == cfg.id)
  52. // {
  53. // _ui.m_component.target.scrollPane.SetPosX(400, false);
  54. // }
  55. UpdateRedDot();
  56. Timers.inst.AddUpdate(CheckGuide);
  57. }
  58. protected override void OnHide()
  59. {
  60. base.OnHide();
  61. Timers.inst.Remove(CheckGuide);
  62. }
  63. protected override void RemoveEventListener()
  64. {
  65. base.RemoveEventListener();
  66. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  67. }
  68. private void OnClickBtnBack()
  69. {
  70. this.Hide();
  71. ViewManager.GoBackFrom(typeof(XiuFangView).FullName);
  72. }
  73. private void OnClickBtnClothingShop()
  74. {
  75. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_DIAN, 1);
  76. ViewManager.Show<ClothingShopView>(null, true);
  77. }
  78. private void OnClickBtnSuitSynthetic()
  79. {
  80. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_HE_CHENG, 1);
  81. ViewManager.Show<SuitSyntheticView>();
  82. }
  83. private void OnClickBtnClothingUpgrade()
  84. {
  85. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_YANG_CHENG, 1);
  86. ViewManager.Show<ClothingListView>(null, true);
  87. // PromptController.Instance.ShowFloatTextPrompt("暂未开放", MessageType.WARNING);
  88. }
  89. private void OnClickBtnDecompose()
  90. {
  91. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_FEN_JIE, 1);
  92. ViewManager.Show<ClothingDecomposeView>();
  93. }
  94. private void OnClickBtnGYP()
  95. {
  96. ViewManager.Show<ClothingSelectView>();
  97. }
  98. private void CheckGuide(object param)
  99. {
  100. if (GuideDataManager.IsGuideFinish(ConstGuideId.SUIT_LIST_VIEW) <= 0)
  101. {
  102. UpdateToCheckGuide(null);
  103. }
  104. else
  105. {
  106. Timers.inst.Remove(CheckGuide);
  107. }
  108. }
  109. private void UpdateRedDot()
  110. {
  111. RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnClothingUpgrade.target, RedDotDataManager.Instance.GetClothingFosterRed(), "", 0, 30);
  112. RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnSuitSynthetic.target, RedDotDataManager.Instance.GetClothingSyntheticRed(), "", -54, 45);
  113. }
  114. protected override void UpdateToCheckGuide(object param)
  115. {
  116. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  117. //GuideController.TryGuide(_ui.m_component.m_btnSuitSynthetic.target, ConstGuideId.CLOTHING_SYNTHETIC, 2, "这里可以查看已获得的服饰图谱。");
  118. //GuideController.TryGuide(_ui.m_component.m_btnDecompose.target, ConstGuideId.CLOTHING_DECOMPOSE, 3, "这里可以消耗重复获得的服饰。");
  119. GuideController.TryGuide(_ui.m_component.m_btnClothingUpgrade.target, ConstGuideId.SUIT_LIST_VIEW, 2, "");
  120. }
  121. }
  122. }