HotUpdateDriver.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. //Game
  17. OperationSystem.Initialize();
  18. GameController.Start();
  19. Reporter reporter = GameObject.Find("Reporter").GetComponent<Reporter>();
  20. if ((LauncherConfig.ChannelId != (int)ChannelID.Test) && reporter != null)
  21. {
  22. reporter.numOfCircleToShow = 5;
  23. }
  24. }
  25. private void Update()
  26. {
  27. OperationSystem.Update();
  28. CheckExitAlert();
  29. }
  30. private void OnDestroy()
  31. {
  32. OperationSystem.DestroyAll();
  33. }
  34. private void OnApplicationQuit()
  35. {
  36. SQLiteHelper.Instance.CloseConnection(true);
  37. }
  38. private void CheckExitAlert()
  39. {
  40. if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  41. {
  42. QDManager.Exit();
  43. }
  44. }
  45. private void OnApplicationPause(bool pause)
  46. {
  47. if(pause)
  48. {
  49. GameGlobal.pauseTime = ET.TimeHelper.ClientNowSeconds();
  50. }
  51. }
  52. }
  53. }