HotUpdateDriver.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 &&
  24. LauncherConfig.ChannelId != (int)ChannelID.DouYouTest) && reporter != null)
  25. {
  26. reporter.numOfCircleToShow = 5;
  27. }
  28. }
  29. private void Update()
  30. {
  31. OperationSystem.Update();
  32. CheckExitAlert();
  33. }
  34. private void OnDestroy()
  35. {
  36. OperationSystem.DestroyAll();
  37. }
  38. private void OnApplicationQuit()
  39. {
  40. SQLiteHelper.Instance.CloseConnection(true);
  41. }
  42. private void CheckExitAlert()
  43. {
  44. if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
  45. {
  46. QDManager.Exit();
  47. }
  48. }
  49. private void OnApplicationPause(bool pause)
  50. {
  51. if(pause)
  52. {
  53. GameGlobal.pauseTime = ET.TimeHelper.ClientNowSeconds();
  54. }
  55. }
  56. }
  57. }