Game.cs 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using UnityEngine;
  2. namespace ETModel
  3. {
  4. public static class Game
  5. {
  6. private static EventSystem eventSystem;
  7. public static EventSystem EventSystem
  8. {
  9. get
  10. {
  11. return eventSystem ?? (eventSystem = new EventSystem());
  12. }
  13. }
  14. private static Scene scene;
  15. public static Scene Scene
  16. {
  17. get
  18. {
  19. if (scene != null)
  20. {
  21. return scene;
  22. }
  23. scene = new Scene() { Name = "ClientM" };
  24. return scene;
  25. }
  26. }
  27. private static ObjectPool objectPool;
  28. public static ObjectPool ObjectPool
  29. {
  30. get
  31. {
  32. if (objectPool != null)
  33. {
  34. return objectPool;
  35. }
  36. objectPool = new ObjectPool() { Name = "ClientM" };
  37. return objectPool;
  38. }
  39. }
  40. private static Hotfix hotfix;
  41. public static Hotfix Hotfix
  42. {
  43. get
  44. {
  45. return hotfix ?? (hotfix = new Hotfix());
  46. }
  47. }
  48. public static void Close()
  49. {
  50. eventSystem = null;
  51. scene?.Dispose();
  52. scene = null;
  53. objectPool?.Dispose();
  54. objectPool = null;
  55. hotfix = null;
  56. }
  57. }
  58. }