Game.cs 1.3 KB

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