HotUpdateDriver.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using GFGGame.Launcher;
  2. using System.Collections;
  3. using UniFramework.Pooling;
  4. using UnityEngine;
  5. using YooAsset;
  6. namespace GFGGame
  7. {
  8. public class HotUpdateDriver: MonoBehaviour
  9. {
  10. private void Awake()
  11. {
  12. //UniFramework
  13. // 初始化对象池系统
  14. UniPooling.Initalize();
  15. //Litjson
  16. LitJson.UnityTypeBindings.Register();
  17. //ET
  18. ETManager.Instance.Init();
  19. //Game
  20. OperationSystem.Initialize();
  21. GameController.Start();
  22. Reporter reporter = GameObject.Find("Reporter").GetComponent<Reporter>();
  23. if(LauncherConfig.ChannelId != (int)ChannelID.Test && reporter != null)
  24. {
  25. reporter.numOfCircleToShow = 50;
  26. }
  27. }
  28. private void Update()
  29. {
  30. OperationSystem.Update();
  31. CheckExitAlert();
  32. }
  33. private void OnDestroy()
  34. {
  35. OperationSystem.DestroyAll();
  36. }
  37. private void OnApplicationQuit()
  38. {
  39. SQLiteHelper.Instance.CloseConnection(true);
  40. }
  41. private void CheckExitAlert()
  42. {
  43. if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  44. {
  45. QDManager.Exit();
  46. }
  47. }
  48. private void OnApplicationPause(bool pause)
  49. {
  50. if(pause)
  51. {
  52. GameGlobal.pauseTime = ET.TimeHelper.ClientNowSeconds();
  53. }
  54. }
  55. }
  56. }