SceneFactory.cs 1.4 KB

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