StudioView.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using ET;
  2. using FairyGUI;
  3. using UI.Studio;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class StudioView : BaseWindow
  8. {
  9. private UI_StudioUI _ui;
  10. public override void Dispose()
  11. {
  12. if (_ui != null)
  13. {
  14. _ui.Dispose();
  15. _ui = null;
  16. }
  17. base.Dispose();
  18. }
  19. protected override void OnInit()
  20. {
  21. base.OnInit();
  22. packageName = UI_StudioUI.PACKAGE_NAME;
  23. _ui = UI_StudioUI.Create();
  24. this.viewCom = _ui.target;
  25. isfullScreen = true;
  26. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  27. _ui.m_comMetal.target.onClick.Add(OnClickComMetal);
  28. _ui.m_comFabric.target.onClick.Add(OnCliclComFabric);
  29. _ui.m_comProperty.target.onClick.Add(OnComProperty);
  30. _ui.m_comFiling.target.onClick.Add(OnClickComFilling);
  31. _ui.m_comPorcelain.target.onClick.Add(OnComPorceLain);
  32. }
  33. protected override void AddEventListener()
  34. {
  35. base.AddEventListener();
  36. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  37. }
  38. protected override void OnShown()
  39. {
  40. base.OnShown();//1;//
  41. StudioSProxy.ReqStudioInfos().Coroutine();
  42. int isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioMetalView).FullName, false) ? 1 : 0;
  43. _ui.m_comMetal.m_c1.selectedIndex = isopen;
  44. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFabricView).FullName, false) ? 1 : 0; ;
  45. _ui.m_comFabric.m_c1.selectedIndex = isopen;
  46. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPropertyView).FullName, false) ? 1 : 0;
  47. _ui.m_comProperty.m_c1.selectedIndex = isopen;
  48. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFilingView).FullName, false) ? 1 : 0;
  49. _ui.m_comFiling.m_c1.selectedIndex = isopen;
  50. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPorcelainView).FullName, false) ? 1 : 0;
  51. _ui.m_comPorcelain.m_c1.selectedIndex = isopen;
  52. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("ejzjm_bj");
  53. UpdateRedDot();
  54. Timers.inst.AddUpdate(CheckGuide);
  55. }
  56. protected override void OnHide()
  57. {
  58. base.OnHide();
  59. TryCompleteGuide();
  60. Timers.inst.Remove(CheckGuide);
  61. }
  62. protected override void RemoveEventListener()
  63. {
  64. base.RemoveEventListener();
  65. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  66. }
  67. private void OnClickBtnBack()
  68. {
  69. ViewManager.GoBackFrom(typeof(StudioView).FullName);
  70. }
  71. private void OnClickComMetal()
  72. {
  73. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 1);
  74. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioMetalView).FullName, true)) return;
  75. ViewManager.Show<StudioMetalView>(null, new object[] { typeof(StudioView).FullName, this.viewData });
  76. this.Hide();
  77. }
  78. private void OnCliclComFabric()
  79. {
  80. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 1);
  81. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFabricView).FullName, true)) return;
  82. ViewManager.Show<StudioFabricView>(null, new object[] { typeof(StudioView).FullName, this.viewData });
  83. this.Hide();
  84. }
  85. private void OnComProperty()
  86. {
  87. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 1);
  88. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPropertyView).FullName, true)) return;
  89. ViewManager.Show<StudioPropertyView>(null, new object[] { typeof(StudioView).FullName, this.viewData });
  90. this.Hide();
  91. }
  92. private void OnComPorceLain()
  93. {
  94. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 1);
  95. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPorcelainView).FullName, true)) return;
  96. ViewManager.Show<StudioPorcelainView>(null, new object[] { typeof(StudioView).FullName, this.viewData });
  97. this.Hide();
  98. }
  99. private void OnClickComFilling()
  100. {
  101. ViewManager.Show<StudioFilingView>(null, new object[] { typeof(StudioView).FullName, this.viewData });
  102. }
  103. private void UpdateRedDot()
  104. {
  105. RedDotController.Instance.SetComRedDot(_ui.m_comFiling.target, RedDotDataManager.Instance.GetStudioFilingRed(), "", 10, 24);
  106. }
  107. private void CheckGuide(object param)
  108. {
  109. if (GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_METAL) <= 0
  110. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_FILING) <= 0)
  111. {
  112. UpdateToCheckGuide(null);
  113. }
  114. else
  115. {
  116. Timers.inst.Remove(CheckGuide);
  117. }
  118. }
  119. protected override void UpdateToCheckGuide(object param)
  120. {
  121. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  122. GuideController.TryGuide(_ui.m_comMetal.target, ConstGuideId.STUDIO_METAL, 4, "通关相应副本,可以获得各种升级材料哦,快开始今天的日常工作吧~");
  123. GuideController.TryCompleteGuide(ConstGuideId.STUDIO_METAL, 4);
  124. GuideController.TryGuide(_ui.m_comFiling.target, ConstGuideId.STUDIO_FILING, 4, "完成小伙伴的心愿,获得服饰碎片哦。");
  125. }
  126. protected override void TryCompleteGuide()
  127. {
  128. // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.STUDIO_OPEN);
  129. // GuideController.TryCompleteGuideIndex(cfg.id, 3);
  130. // GuideController.TryCompleteGuide(ConstGuideId.STUDIO_OPEN, 3);
  131. }
  132. }
  133. }