PoemView.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. bool isPhotoOpen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(PoemPhotoView).Name, false);
  39. bool isgalleryOpen = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(PoemGalleryView).Name, false);
  40. _ui.m_comphoto.m_c1.selectedIndex = isPhotoOpen ? 1 : 0;
  41. _ui.m_comGallery.m_c1.selectedIndex = isgalleryOpen ? 1 : 0;
  42. if (isPhotoOpen && isgalleryOpen)
  43. {
  44. Timers.inst.AddUpdate(CheckGuide);
  45. }
  46. }
  47. protected override void OnHide()
  48. {
  49. base.OnHide();
  50. Timers.inst.Remove(CheckGuide);
  51. }
  52. protected override void RemoveEventListener()
  53. {
  54. base.RemoveEventListener();
  55. }
  56. private void OnBtnBackClick()
  57. {
  58. ViewManager.GoBackFrom(typeof(PoemView).FullName);
  59. }
  60. private void OnComPhotoClick()
  61. {
  62. ViewManager.Show<PoemPhotoView>(null, new object[] { typeof(PoemView).FullName, this.viewData });
  63. }
  64. private void OnComGalleryClick()
  65. {
  66. ViewManager.Show<PoemGalleryView>(null, new object[] { typeof(PoemView).FullName, this.viewData });
  67. }
  68. private void CheckGuide(object param)
  69. {
  70. if (GuideDataManager.IsGuideFinish(ConstGuideId.POEM) <= 0)
  71. {
  72. UpdateToCheckGuide(null);
  73. }
  74. else
  75. {
  76. Timers.inst.Remove(CheckGuide);
  77. }
  78. }
  79. protected override void UpdateToCheckGuide(object param)
  80. {
  81. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  82. GuideController.TryGuide(_ui.m_comphoto.target, ConstGuideId.POEM, 1, "在“拍照”中保存的图片都会保存到这里。");
  83. GuideController.TryGuide(_ui.m_comGallery.target, ConstGuideId.POEM, 3, "根据主题,上传你精心搭配的服饰,可获得玩家的欣赏点赞哦~~");
  84. GuideController.TryCompleteGuide(ConstGuideId.POEM, 3);
  85. }
  86. }
  87. }