ChapterItemShowView.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using UI.FieldGuide;
  2. using FairyGUI;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. namespace GFGGame
  6. {
  7. public class ChapterItemShowView : BaseWindow
  8. {
  9. private UI_ChapterItemShowUI _ui;
  10. private CulturalRelicCfg _cfg;
  11. public override void Dispose()
  12. {
  13. if (_ui != null)
  14. {
  15. _ui.Dispose();
  16. _ui = null;
  17. }
  18. base.Dispose();
  19. }
  20. protected override void OnInit()
  21. {
  22. base.OnInit();
  23. _ui = UI_ChapterItemShowUI.Create();
  24. this.viewCom = _ui.target;
  25. isfullScreen = true;
  26. isReturnView = true;
  27. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  28. }
  29. protected override void OnShown()
  30. {
  31. base.OnShown();
  32. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tjtj_bjbj");
  33. _cfg = this.viewData as CulturalRelicCfg;
  34. UpdateView();
  35. _ui.m_Idle.Play(-1, 0, null);
  36. }
  37. protected override void AddEventListener()
  38. {
  39. base.AddEventListener();
  40. }
  41. protected override void OnHide()
  42. {
  43. base.OnHide();
  44. }
  45. protected override void RemoveEventListener()
  46. {
  47. base.RemoveEventListener();
  48. }
  49. private void OnClickBtnBack()
  50. {
  51. ViewManager.GoBackFrom(typeof(ChapterItemShowView).FullName);
  52. }
  53. private void UpdateView()
  54. {
  55. _ui.m_loaItem.url = ResPathUtil.GetChapterGuideIconPath(_cfg.bgRes); //string.Format("ui://FieldGuide/{0}", _cfg.bgRes);
  56. _ui.m_txtTitle.text = _cfg.name;
  57. _ui.m_txtDesc.text = _cfg.desc;
  58. }
  59. }
  60. }