ChapterItemShowView.cs 1.7 KB

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