StudioView.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. using ET;
  2. using FairyGUI;
  3. using UI.Studio;
  4. using UnityEngine;
  5. using System.Collections.Generic;
  6. namespace GFGGame
  7. {
  8. public class StudioView : BaseWindow
  9. {
  10. private UI_StudioUI _ui;
  11. private EffectUI _effectUI1;
  12. private EffectUI _effectUI2;
  13. private EffectUI _effectUI3;
  14. private EffectUI _effectUI4;
  15. private EffectUI _effectUI5;
  16. private EffectUI _effectUI6;
  17. private Dictionary<string, UI_ComEctype> comEctypeDic = new Dictionary<string, UI_ComEctype>();
  18. public override void Dispose()
  19. {
  20. EffectUIPool.Recycle(_effectUI1);
  21. _effectUI1 = null;
  22. EffectUIPool.Recycle(_effectUI2);
  23. _effectUI2 = null;
  24. EffectUIPool.Recycle(_effectUI3);
  25. _effectUI3 = null;
  26. EffectUIPool.Recycle(_effectUI4);
  27. _effectUI4 = null;
  28. EffectUIPool.Recycle(_effectUI5);
  29. _effectUI5 = null;
  30. EffectUIPool.Recycle(_effectUI6);
  31. _effectUI6 = null;
  32. if (_ui != null)
  33. {
  34. _ui.Dispose();
  35. _ui = null;
  36. }
  37. base.Dispose();
  38. }
  39. protected override void OnInit()
  40. {
  41. base.OnInit();
  42. packageName = UI_StudioUI.PACKAGE_NAME;
  43. _ui = UI_StudioUI.Create();
  44. this.viewCom = _ui.target;
  45. isfullScreen = true;
  46. isReturnView = true;
  47. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  48. _ui.m_btnHome.onClick.Add(OnClickBtnHome);
  49. _ui.m_comMetal.target.onClick.Add(OnClickComMetal);
  50. _ui.m_comFabric.target.onClick.Add(OnCliclComFabric);
  51. _ui.m_comProperty.target.onClick.Add(OnComProperty);
  52. _ui.m_comFiling.target.onClick.Add(OnClickComFilling);
  53. _ui.m_comPorcelain.target.onClick.Add(OnComPorceLain);
  54. comEctypeDic.Add(typeof(StudioMetalView).FullName, _ui.m_comMetal);
  55. comEctypeDic.Add(typeof(StudioFabricView).FullName, _ui.m_comFabric);
  56. comEctypeDic.Add(typeof(StudioPropertyView).FullName, _ui.m_comProperty);
  57. comEctypeDic.Add(typeof(StudioFilingView).FullName, _ui.m_comFiling);
  58. comEctypeDic.Add(typeof(StudioPorcelainView).FullName, _ui.m_comPorcelain);
  59. EffectUIPool.CreateEffectUI(_ui.m_comFiling.m_effect, "ui_Small_parts", "YaJi_TuBiao",
  60. onComplete: (effect) =>
  61. {
  62. if (effect != null)
  63. {
  64. _effectUI1 = effect;
  65. }
  66. });
  67. EffectUIPool.CreateEffectUI(_ui.m_comMetal.m_effect, "ui_Small_parts", "YaJi_TuBiao",
  68. onComplete: (effect) =>
  69. {
  70. if (effect != null)
  71. {
  72. _effectUI2 = effect;
  73. }
  74. });
  75. EffectUIPool.CreateEffectUI(_ui.m_comFabric.m_effect, "ui_Small_parts", "YaJi_TuBiao",
  76. onComplete: (effect) =>
  77. {
  78. if (effect != null)
  79. {
  80. _effectUI3 = effect;
  81. }
  82. });
  83. EffectUIPool.CreateEffectUI(_ui.m_comProperty.m_effect, "ui_Small_parts", "YaJi_TuBiao",
  84. onComplete: (effect) =>
  85. {
  86. if (effect != null)
  87. {
  88. _effectUI4 = effect;
  89. }
  90. });
  91. EffectUIPool.CreateEffectUI(_ui.m_comPorcelain.m_effect, "ui_Small_parts", "YaJi_TuBiao",
  92. onComplete: (effect) =>
  93. {
  94. if (effect != null)
  95. {
  96. _effectUI5 = effect;
  97. }
  98. });
  99. EffectUIPool.CreateEffectUI(_ui.m_bgEffect, "ui_Small_parts", "WorkRoom_bg",
  100. onComplete: (effect) =>
  101. {
  102. if (effect != null)
  103. {
  104. _effectUI6 = effect;
  105. }
  106. });
  107. }
  108. protected override void AddEventListener()
  109. {
  110. base.AddEventListener();
  111. EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  112. }
  113. protected override void OnShown()
  114. {
  115. base.OnShown(); //1;//
  116. StudioSProxy.ReqStudioInfos().Coroutine();
  117. //int isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioMetalView).FullName, false) ? 1 : 0;
  118. //_ui.m_comMetal.m_c1.selectedIndex = isopen;
  119. //isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFabricView).FullName, false) ? 1 : 0; ;
  120. //_ui.m_comFabric.m_c1.selectedIndex = isopen;
  121. //isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPropertyView).FullName, false) ? 1 : 0;
  122. //_ui.m_comProperty.m_c1.selectedIndex = isopen;
  123. //isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFilingView).FullName, false) ? 1 : 0;
  124. //_ui.m_comFiling.m_c1.selectedIndex = isopen;
  125. //isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPorcelainView).FullName, false) ? 1 : 0;
  126. //_ui.m_comPorcelain.m_c1.selectedIndex = isopen;
  127. int isopen = 1;
  128. foreach (var com in comEctypeDic)
  129. {
  130. isopen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(com.Key, false) ? 1 : 0;
  131. com.Value.m_c1.selectedIndex = isopen;
  132. if (isopen == 0)
  133. {
  134. com.Value.m_effect.visible = false;
  135. com.Value.m_bg.visible = true;
  136. }
  137. else
  138. {
  139. com.Value.m_bg.visible = false;
  140. com.Value.m_t0.Play();
  141. com.Value.m_effect.visible = true;
  142. }
  143. }
  144. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("ejzjm_bj");
  145. UpdateRedDot();
  146. Timers.inst.AddUpdate(CheckGuide);
  147. }
  148. protected override void OnHide()
  149. {
  150. base.OnHide();
  151. TryCompleteGuide();
  152. Timers.inst.Remove(CheckGuide);
  153. }
  154. private void OnClickBtnHome()
  155. {
  156. GameController.GoBackToMainView();
  157. }
  158. protected override void RemoveEventListener()
  159. {
  160. base.RemoveEventListener();
  161. EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
  162. }
  163. private void OnClickBtnBack()
  164. {
  165. ViewManager.GoBackFrom(typeof(StudioView).FullName);
  166. }
  167. private void OnClickComMetal()
  168. {
  169. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 1);
  170. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioMetalView).FullName, true)) return;
  171. ViewManager.Show<StudioMetalView>();
  172. this.Hide();
  173. }
  174. private void OnCliclComFabric()
  175. {
  176. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 1);
  177. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioFabricView).FullName, true)) return;
  178. ViewManager.Show<StudioFabricView>();
  179. this.Hide();
  180. }
  181. private void OnComProperty()
  182. {
  183. //LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 1);
  184. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPropertyView).FullName, true)) return;
  185. ViewManager.Show<StudioPropertyView>();
  186. this.Hide();
  187. }
  188. private void OnComPorceLain()
  189. {
  190. // LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 1);
  191. if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(StudioPorcelainView).FullName, true))
  192. return;
  193. ViewManager.Show<StudioPorcelainView>();
  194. this.Hide();
  195. }
  196. private void OnClickComFilling()
  197. {
  198. ViewManager.Show<StudioFilingView>(StudioDataManager.Instance.npcFilingChapterId);
  199. }
  200. private void UpdateRedDot()
  201. {
  202. RedDotController.Instance.SetComRedDot(_ui.m_comFiling.target,
  203. RedDotDataManager.Instance.GetStudioFilingRed(), "", 10, 24);
  204. }
  205. private void CheckGuide(object param)
  206. {
  207. if (GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_PORCELAIN) <= 0
  208. //|| GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_4) <= 0
  209. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_PROPERTY) <= 0
  210. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_2) <= 0
  211. || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_FILING) <= 0)
  212. {
  213. UpdateToCheckGuide(null);
  214. }
  215. else
  216. {
  217. Timers.inst.Remove(CheckGuide);
  218. }
  219. }
  220. protected override void UpdateToCheckGuide(object param)
  221. {
  222. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  223. GuideController.TryGuide(_ui.m_comPorcelain.target, ConstGuideId.STUDIO_PORCELAIN, 4,
  224. "通关这个副本可以获得词牌升级材料,快去挑战吧。");
  225. GuideController.TryGuide(_ui.m_comFiling.target, ConstGuideId.STUDIO_FILING, 4, "完成小伙伴的心愿,获得合成服饰的必备材料哦。");
  226. GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.ENTER_CHAPTER_2, 1, "");
  227. GuideController.TryGuide(_ui.m_comPorcelain.target, ConstGuideId.STUDIO_PORCELAIN, 4,
  228. "通关这个副本可以获得词牌升级材料,快去挑战吧。");
  229. GuideController.TryGuide(_ui.m_comProperty.target, ConstGuideId.STUDIO_PROPERTY, 3, "");
  230. GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.STUDIO_PROPERTY, 7);
  231. GuideController.TryCompleteGuide(ConstGuideId.STUDIO_PROPERTY, 7);
  232. //GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.ENTER_CHAPTER_4, 1, "");
  233. }
  234. protected override void TryCompleteGuide()
  235. {
  236. base.TryCompleteGuide();
  237. GuideController.TryCompleteGuideIndex(ConstGuideId.STUDIO_PROPERTY, 7);
  238. GuideController.TryCompleteGuide(ConstGuideId.STUDIO_PROPERTY, 7);
  239. }
  240. }
  241. }