ChapterItemShowView.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  27. }
  28. protected override void OnShown()
  29. {
  30. base.OnShown();
  31. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tjtj_bjbj");
  32. _cfg = this.viewData as CulturalRelicCfg;
  33. UpdateView();
  34. }
  35. protected override void AddEventListener()
  36. {
  37. base.AddEventListener();
  38. }
  39. protected override void OnHide()
  40. {
  41. base.OnHide();
  42. }
  43. protected override void RemoveEventListener()
  44. {
  45. base.RemoveEventListener();
  46. }
  47. private void OnClickBtnBack()
  48. {
  49. ViewManager.GoBackFrom(typeof(ChapterItemShowView).FullName);
  50. }
  51. private void UpdateView()
  52. {
  53. _ui.m_loaItem.url = string.Format("ui://FieldGuide/{0}", _cfg.bgRes);
  54. _ui.m_txtTitle.text = _cfg.name;
  55. _ui.m_txtDesc.text = _cfg.desc;
  56. }
  57. }
  58. }