PoemView.cs 2.9 KB

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