StudioView.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. }
  32. protected override void AddEventListener()
  33. {
  34. base.AddEventListener();
  35. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  36. }
  37. protected override void OnShown()
  38. {
  39. base.OnShown();//1;//
  40. StudioSProxy.ReqStudioInfos().Coroutine();
  41. int isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioMetalView).FullName, false) ? 1 : 0;
  42. _ui.m_comMetal.m_c1.selectedIndex = isopen;
  43. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFabricView).FullName, false) ? 1 : 0; ;
  44. _ui.m_comFabric.m_c1.selectedIndex = isopen;
  45. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPropertyView).FullName, false) ? 1 : 0;
  46. _ui.m_comProperty.m_c1.selectedIndex = isopen;
  47. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFilingView).FullName, false) ? 1 : 0;
  48. _ui.m_comFiling.m_c1.selectedIndex = isopen;
  49. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("ejzjm_bj");
  50. UpdateRedDot();
  51. Timers.inst.AddUpdate(CheckGuide);
  52. }
  53. protected override void OnHide()
  54. {
  55. base.OnHide();
  56. TryCompleteGuide();
  57. Timers.inst.Remove(CheckGuide);
  58. }
  59. protected override void RemoveEventListener()
  60. {
  61. base.RemoveEventListener();
  62. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  63. }
  64. private void OnClickBtnBack()
  65. {
  66. ViewManager.GoBackFrom(typeof(StudioView).FullName);
  67. }
  68. private void OnClickComMetal()
  69. {
  70. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 1);
  71. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioMetalView).FullName, true)) return;
  72. ViewManager.Show<StudioMetalView>(new object[] { 0, 0 }, new object[] { typeof(StudioView).FullName, this.viewData });
  73. this.Hide();
  74. }
  75. private void OnCliclComFabric()
  76. {
  77. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 1);
  78. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFabricView).FullName, true)) return;
  79. ViewManager.Show<StudioFabricView>(new object[] { 0, 0 }, new object[] { typeof(StudioView).FullName, this.viewData });
  80. this.Hide();
  81. }
  82. private void OnComProperty()
  83. {
  84. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 1);
  85. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPropertyView).FullName, true)) return;
  86. ViewManager.Show<StudioPropertyView>(new object[] { 1, 0 }, new object[] { typeof(StudioView).FullName, this.viewData });
  87. this.Hide();
  88. }
  89. private void OnClickComFilling()
  90. {
  91. ViewManager.Show<StudioFilingView>(null, new object[] { typeof(StudioView).FullName, this.viewData });
  92. }
  93. private void UpdateRedDot()
  94. {
  95. RedDotController.Instance.SetComRedDot(_ui.m_comFiling.target, RedDotDataManager.Instance.GetStudioFilingRed(), "", 10, 24);
  96. }
  97. private void CheckGuide(object param)
  98. {
  99. // if (GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_OPEN) <= 0)
  100. // {
  101. // UpdateToCheckGuide(null);
  102. // }
  103. // else
  104. // {
  105. // Timers.inst.Remove(CheckGuide);
  106. // }
  107. }
  108. protected override void UpdateToCheckGuide(object param)
  109. {
  110. // if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  111. // GuideController.TryGuide(_ui.target, ConstGuideId.STUDIO_OPEN, 3, "通关相应副本,可以获得各种升级材料哦,快开始今天的日常工作吧。", -1, true, (int)(this.viewCom.height - 280), 0, 0, false, false);
  112. // GuideController.TryCompleteGuide(ConstGuideId.STUDIO_OPEN, 3);
  113. }
  114. protected override void TryCompleteGuide()
  115. {
  116. // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.STUDIO_OPEN);
  117. // GuideController.TryCompleteGuideIndex(cfg.id, 3);
  118. // GuideController.TryCompleteGuide(ConstGuideId.STUDIO_OPEN, 3);
  119. }
  120. }
  121. }