namespace ET { public static class SceneFactory { public static async ETTask Create(Entity parent, string name, SceneType sceneType) { long id = IdGenerater.GenerateId(); return await Create(parent, id, parent.DomainZone(), name, sceneType); } public static async ETTask Create(Entity parent, long id, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null) { Scene scene = EntitySceneFactory.CreateScene(id, zone, sceneType, name); scene.Parent = parent; scene.AddComponent(MailboxType.UnOrderMessageDispatcher); switch (scene.SceneType) { case SceneType.Realm: scene.AddComponent(startSceneConfig.OuterAddress); break; case SceneType.Gate: scene.AddComponent(startSceneConfig.OuterAddress); scene.AddComponent(); scene.AddComponent(); break; case SceneType.Map: scene.AddComponent(); scene.AddComponent(); break; case SceneType.Location: scene.AddComponent(); break; } return scene; } } }