Game.cs 853 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. public static void Close()
  41. {
  42. scene?.Dispose();
  43. scene = null;
  44. objectPool?.Dispose();
  45. objectPool = null;
  46. eventSystem = null;
  47. }
  48. }
  49. }