FullScreenTextView.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine;
  2. using FairyGUI;
  3. using UI.Login;
  4. namespace GFGGame
  5. {
  6. public class FullScreenTextView : BaseWindow
  7. {
  8. private UI_FullScreenTextUI _ui;
  9. public override void Dispose()
  10. {
  11. if (_ui != null)
  12. {
  13. _ui.Dispose();
  14. _ui = null;
  15. }
  16. base.Dispose();
  17. }
  18. protected override void OnInit()
  19. {
  20. base.OnInit();
  21. packageName = UI_FullScreenTextUI.PACKAGE_NAME;
  22. _ui = UI_FullScreenTextUI.Create();
  23. this.viewCom = _ui.target;
  24. this.modal = true;
  25. isfullScreen = true;
  26. _ui.m_btnBack.onClick.Add(this.Hide);
  27. }
  28. protected override void OnShown()
  29. {
  30. base.OnShown();
  31. string content = (string)viewData;
  32. _ui.m_txtComp.m_txtContent.text = content;
  33. _ui.m_txtComp.target.scrollPane.ScrollTop();
  34. Timers.inst.AddUpdate(Update);
  35. }
  36. protected override void OnHide()
  37. {
  38. base.OnHide();
  39. Timers.inst.Remove(Update);
  40. }
  41. private void Update(object param)
  42. {
  43. if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  44. {
  45. this.Hide();
  46. }
  47. }
  48. }
  49. }