using System.Net; using System.Net.Sockets; namespace ET.Server { public static class SceneFactory { public static async ETTask CreateServerScene(Entity parent, long id, long instanceId, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null) { await ETTask.CompletedTask; Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent); scene.AddComponent(MailboxType.UnOrderMessageDispatcher); switch (scene.SceneType) { case SceneType.Router: scene.AddComponent(startSceneConfig.OuterIPPort, startSceneConfig.StartProcessConfig.InnerIP ); break; case SceneType.RouterManager: // 正式发布请用CDN代替RouterManager // 云服务器在防火墙那里做端口映射 scene.AddComponent($"http://+:{startSceneConfig.OuterPort}/"); break; case SceneType.Realm: scene.AddComponent(startSceneConfig.InnerIPOutPort); scene.AddComponent(); break; case SceneType.Gate: scene.AddComponent(startSceneConfig.InnerIPOutPort); scene.AddComponent(); scene.AddComponent(); scene.AddComponent(); break; case SceneType.Map: scene.AddComponent(); scene.AddComponent(); break; case SceneType.Location: scene.AddComponent(); break; case SceneType.Robot: scene.AddComponent(); break; case SceneType.BenchmarkServer: scene.AddComponent(); scene.AddComponent(startSceneConfig.OuterIPPort); break; case SceneType.BenchmarkClient: scene.AddComponent(); break; } return scene; } } }