You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.5 KiB

namespace ET
{
public static class SceneFactory
{
public static Scene CreateZoneScene(int zone, string name, Entity parent)
{
Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateInstanceId(), zone, SceneType.Zone, name, parent);
zoneScene.AddComponent<ZoneSceneFlagComponent>();
zoneScene.AddComponent<NetKcpComponent, int>(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter);
zoneScene.AddComponent<CurrentScenesComponent>();
zoneScene.AddComponent<ObjectWait>();
zoneScene.AddComponent<PlayerComponent>();
zoneScene.AddComponent<AccountInfoComponent>();
zoneScene.AddComponent<ServerInfosComponent>();
zoneScene.AddComponent<RoleInfosComponent>();
Game.EventSystem.Publish(new EventType.AfterCreateZoneScene() {ZoneScene = zoneScene});
return zoneScene;
}
public static Scene CreateCurrentScene(long id, int zone, string name, CurrentScenesComponent currentScenesComponent)
{
Scene currentScene = EntitySceneFactory.CreateScene(id, IdGenerater.Instance.GenerateInstanceId(), zone, SceneType.Current, name, currentScenesComponent);
currentScenesComponent.Scene = currentScene;
Game.EventSystem.Publish(new EventType.AfterCreateCurrentScene() {CurrentScene = currentScene});
return currentScene;
}
}
}