SceneFactory.cs 1.1 KB

123456789101112131415161718192021222324252627282930
  1. using System.Net.Sockets;
  2. namespace ET.Client
  3. {
  4. public static class SceneFactory
  5. {
  6. public static async ETTask<Scene> CreateClientScene(int zone, string name)
  7. {
  8. await ETTask.CompletedTask;
  9. Scene clientScene = EntitySceneFactory.CreateScene(zone, SceneType.Client, name, ClientSceneManagerComponent.Instance);
  10. clientScene.AddComponent<CurrentScenesComponent>();
  11. clientScene.AddComponent<ObjectWait>();
  12. clientScene.AddComponent<PlayerComponent>();
  13. return clientScene;
  14. }
  15. public static Scene CreateCurrentScene(long id, int zone, string name, CurrentScenesComponent currentScenesComponent)
  16. {
  17. Scene currentScene = EntitySceneFactory.CreateScene(id, IdGenerater.Instance.GenerateInstanceId(), zone, SceneType.Current, name, currentScenesComponent);
  18. currentScenesComponent.Scene = currentScene;
  19. EventSystem.Instance.Publish(currentScene, new EventType.AfterCreateCurrentScene());
  20. return currentScene;
  21. }
  22. }
  23. }