FullScreenTextView.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. base.Dispose();
  12. }
  13. protected override void OnInit()
  14. {
  15. base.OnInit();
  16. _ui = UI_FullScreenTextUI.Create();
  17. this.viewCom = _ui.target;
  18. this.modal = true;
  19. isfullScreen = true;
  20. }
  21. protected override void OnShown()
  22. {
  23. base.OnShown();
  24. string content = (string)viewData;
  25. _ui.m_txtComp.m_txtContent.text = content;
  26. _ui.m_txtComp.target.scrollPane.ScrollTop();
  27. Timers.inst.AddUpdate(Update);
  28. }
  29. protected override void OnHide()
  30. {
  31. base.OnHide();
  32. Timers.inst.Remove(Update);
  33. }
  34. private void Update(object param)
  35. {
  36. if(Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  37. {
  38. this.Hide();
  39. }
  40. }
  41. }
  42. }