HotUpdateDriver.cs 1.5 KB

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