StudioView.cs 4.4 KB

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