XiuFangView.cs 5.2 KB

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