XiuFangView.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 : BaseWindow
  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. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  28. _ui.m_component.m_btnClothingShop.target.onClick.Add(OnClickBtnClothingShop);
  29. _ui.m_component.m_btnSuitSynthetic.target.onClick.Add(OnClickBtnSuitSynthetic);
  30. _ui.m_component.m_btnClothingUpgrade.target.onClick.Add(OnClickBtnClothingUpgrade);
  31. _ui.m_component.m_btnDecompose.target.onClick.Add(OnClickBtnDecompose);
  32. _ui.m_bg.url = ResPathUtil.GetBgImgPath("xf_bg");
  33. }
  34. protected override void AddEventListener()
  35. {
  36. base.AddEventListener();
  37. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  38. }
  39. protected override void OnShown()
  40. {
  41. base.OnShown();
  42. // _ui.m_component.target.scrollPane.SetPosX(0, false);
  43. _ui.m_component.m_btnClothingShop.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingShopView).Name, false) ? 1 : 0;
  44. _ui.m_component.m_btnSuitSynthetic.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SuitSyntheticView).Name, false) ? 1 : 0;
  45. _ui.m_component.m_btnClothingUpgrade.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingListView).Name, false) ? 1 : 0;
  46. _ui.m_component.m_btnDecompose.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingDecomposeView).Name, false) ? 1 : 0;
  47. // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.CLOTHING_DECOMPOSE);
  48. // if (GuideDataManager.currentGuideId == cfg.id)
  49. // {
  50. // _ui.m_component.target.scrollPane.SetPosX(400, false);
  51. // }
  52. UpdateRedDot();
  53. Timers.inst.AddUpdate(CheckGuide);
  54. }
  55. protected override void OnHide()
  56. {
  57. base.OnHide();
  58. Timers.inst.Remove(CheckGuide);
  59. }
  60. protected override void RemoveEventListener()
  61. {
  62. base.RemoveEventListener();
  63. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  64. }
  65. private void OnClickBtnBack()
  66. {
  67. this.Hide();
  68. ViewManager.GoBackFrom(typeof(XiuFangView).FullName);
  69. }
  70. private void OnClickBtnClothingShop()
  71. {
  72. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_DIAN, 1);
  73. ViewManager.Show<ClothingShopView>(null, new object[] { typeof(XiuFangView).FullName, this.viewData }, true, true);
  74. }
  75. private void OnClickBtnSuitSynthetic()
  76. {
  77. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_HE_CHENG, 1);
  78. ViewManager.Show<SuitSyntheticView>(null, new object[] { typeof(XiuFangView).FullName, this.viewData });
  79. }
  80. private void OnClickBtnClothingUpgrade()
  81. {
  82. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_YANG_CHENG, 1);
  83. ViewManager.Show<ClothingListView>(null, new object[] { typeof(XiuFangView).FullName, this.viewData }, false, true);
  84. // PromptController.Instance.ShowFloatTextPrompt("暂未开放", MessageType.WARNING);
  85. }
  86. private void OnClickBtnDecompose()
  87. {
  88. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_FEN_JIE, 1);
  89. ViewManager.Show<ClothingDecomposeView>(null, new object[] { typeof(XiuFangView).FullName, this.viewData });
  90. }
  91. private void CheckGuide(object param)
  92. {
  93. if (GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_SYNTHETIC) <= 0
  94. || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_DECOMPOSE) <= 0
  95. || GuideDataManager.IsGuideFinish(ConstGuideId.SUIT_LIST_VIEW) <= 0)
  96. {
  97. UpdateToCheckGuide(null);
  98. }
  99. else
  100. {
  101. Timers.inst.Remove(CheckGuide);
  102. }
  103. }
  104. private void UpdateRedDot()
  105. {
  106. RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnClothingUpgrade.target, RedDotDataManager.Instance.GetClothingFosterRed(), "", 0, 30);
  107. RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnSuitSynthetic.target, RedDotDataManager.Instance.GetClothingSyntheticRed(), "", -20, 25);
  108. }
  109. protected override void UpdateToCheckGuide(object param)
  110. {
  111. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  112. GuideController.TryGuide(_ui.m_component.m_btnSuitSynthetic.target, ConstGuideId.CLOTHING_SYNTHETIC, 2, "这里可以查看已获得的服饰图谱。");
  113. GuideController.TryGuide(_ui.m_component.m_btnDecompose.target, ConstGuideId.CLOTHING_DECOMPOSE, 3, "这里可以消耗重复获得的服饰。");
  114. GuideController.TryGuide(_ui.m_component.m_btnClothingUpgrade.target, ConstGuideId.SUIT_LIST_VIEW, 2, "");
  115. }
  116. }
  117. }