PoemView.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using ET;
  2. using FairyGUI;
  3. using UI.Poem;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class PoemView : BaseWindow
  8. {
  9. private UI_PoemUI _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_PoemUI.PACKAGE_NAME;
  23. _ui = UI_PoemUI.Create();
  24. this.viewCom = _ui.target;
  25. isfullScreen = true;
  26. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tjtj_bjbj");
  27. _ui.m_btnback.onClick.Add(OnBtnBackClick);
  28. _ui.m_comphoto.target.onClick.Add(OnComPhotoClick);
  29. _ui.m_comGallery.target.onClick.Add(OnComGalleryClick);
  30. }
  31. protected override void AddEventListener()
  32. {
  33. base.AddEventListener();
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _ui.m_comphoto.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(PoemPhotoView).Name, false) ? 1 : 0;
  39. _ui.m_comGallery.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(PoemGalleryView).Name, false) ? 1 : 0;
  40. Timers.inst.AddUpdate(CheckGuide);
  41. }
  42. protected override void OnHide()
  43. {
  44. base.OnHide();
  45. Timers.inst.Remove(CheckGuide);
  46. }
  47. protected override void RemoveEventListener()
  48. {
  49. base.RemoveEventListener();
  50. }
  51. private void OnBtnBackClick()
  52. {
  53. ViewManager.GoBackFrom(typeof(PoemView).FullName);
  54. }
  55. private void OnComPhotoClick()
  56. {
  57. ViewManager.Show<PoemPhotoView>(null, new object[] { typeof(PoemView).FullName, this.viewData });
  58. }
  59. private void OnComGalleryClick()
  60. {
  61. ViewManager.Show<PoemGalleryView>(null, new object[] { typeof(PoemView).FullName, this.viewData });
  62. }
  63. private void CheckGuide(object param)
  64. {
  65. if (GuideDataManager.IsGuideFinish(ConstGuideId.POEM) <= 0)
  66. {
  67. UpdateToCheckGuide(null);
  68. }
  69. else
  70. {
  71. Timers.inst.Remove(CheckGuide);
  72. }
  73. }
  74. protected override void UpdateToCheckGuide(object param)
  75. {
  76. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  77. GuideController.TryGuide(_ui.m_comphoto.target, ConstGuideId.POEM, 1, "在“拍照”中保存的图片都会保存到这里。");
  78. GuideController.TryGuide(_ui.m_comGallery.target, ConstGuideId.POEM, 3, "根据主题,上传你精心搭配的服饰,可获得玩家的欣赏点赞哦~~");
  79. GuideController.TryCompleteGuide(ConstGuideId.POEM, 3);
  80. }
  81. }
  82. }