PoemView.cs 3.0 KB

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