SceneFactory.cs 1.2 KB

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using UnityEngine;
  3. namespace ET
  4. {
  5. public class SceneFactory
  6. {
  7. public static Scene CreateZoneScene(int zone, string name, Entity parent)
  8. {
  9. Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateInstanceId(), zone, SceneType.Zone, name, parent);
  10. zoneScene.AddComponent<ZoneSceneFlagComponent>();
  11. zoneScene.AddComponent<NetKcpComponent, int>(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter);
  12. zoneScene.AddComponent<CurrentScenesComponent>();
  13. zoneScene.AddComponent<ObjectWait>();
  14. zoneScene.AddComponent<PlayerComponent>();
  15. zoneScene.AddComponent<AccountInfoComponent>();
  16. zoneScene.AddComponent<ServerInfosComponent>();
  17. zoneScene.AddComponent<RoleInfosComponent>();
  18. return zoneScene;
  19. }
  20. public static Scene CreateCurrentScene(long id, int zone, string name, CurrentScenesComponent currentScenesComponent)
  21. {
  22. Scene currentScene = EntitySceneFactory.CreateScene(id, zone, SceneType.Current, name, currentScenesComponent);
  23. currentScenesComponent.Scene = currentScene;
  24. return currentScene;
  25. }
  26. }
  27. }