ClientSceneManagerComponentSystem.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. namespace ET
  2. {
  3. [FriendOf(typeof(ClientSceneManagerComponent))]
  4. public static class ClientSceneManagerComponentSystem
  5. {
  6. [ObjectSystem]
  7. public class ClientSceneManagerComponentAwakeSystem: AwakeSystem<ClientSceneManagerComponent>
  8. {
  9. protected override void Awake(ClientSceneManagerComponent self)
  10. {
  11. ClientSceneManagerComponent.Instance = self;
  12. }
  13. }
  14. [ObjectSystem]
  15. public class ClientSceneManagerComponentDestroySystem: DestroySystem<ClientSceneManagerComponent>
  16. {
  17. protected override void Destroy(ClientSceneManagerComponent self)
  18. {
  19. ClientSceneManagerComponent.Instance = null;
  20. }
  21. }
  22. public static Scene ClientScene(this Entity entity)
  23. {
  24. return ClientSceneManagerComponent.Instance.Get(entity.DomainZone());
  25. }
  26. public static Scene Get(this ClientSceneManagerComponent self, int id)
  27. {
  28. Scene scene = self.GetChild<Scene>(id);
  29. return scene;
  30. }
  31. public static void Remove(this ClientSceneManagerComponent self, int id)
  32. {
  33. self.RemoveChild(id);
  34. }
  35. }
  36. }