StudioView.cs 4.6 KB

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