HotUpdateDriver.cs 1.7 KB

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