ChapterItemShowView.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. _ui.m_Idle.Play(-1, 0, null);
  35. }
  36. protected override void AddEventListener()
  37. {
  38. base.AddEventListener();
  39. }
  40. protected override void OnHide()
  41. {
  42. base.OnHide();
  43. }
  44. protected override void RemoveEventListener()
  45. {
  46. base.RemoveEventListener();
  47. }
  48. private void OnClickBtnBack()
  49. {
  50. ViewManager.GoBackFrom(typeof(ChapterItemShowView).FullName);
  51. }
  52. private void UpdateView()
  53. {
  54. _ui.m_loaItem.url = ResPathUtil.GetChapterGuideIconPath(_cfg.bgRes); //string.Format("ui://FieldGuide/{0}", _cfg.bgRes);
  55. _ui.m_txtTitle.text = _cfg.name;
  56. _ui.m_txtDesc.text = _cfg.desc;
  57. }
  58. }
  59. }