protected SceneImplementation( SceneImplementationFactory sceneParams, RegionInfo ri) : base(ri.Size.X, ri.Size.Y) { SceneCapabilities.Add("ProductInfoRequest", new ProductInfoRequestCapability(this)); m_Scenes = sceneParams.Scenes; m_HttpServer = sceneParams.HttpServer; if (sceneParams.AssetService == null) { throw new ArgumentNullException("persistentAssetService"); } if (sceneParams.GridService == null) { throw new ArgumentNullException("gridService"); } if (ri == null) { throw new ArgumentNullException(nameof(ri)); } if (sceneParams.AvatarNameServices == null) { throw new ArgumentNullException("avatarNameServices"); } if (sceneParams.SimulationDataStorage == null) { throw new ArgumentNullException("simulationDataStorage"); } if (sceneParams.EstateService == null) { throw new ArgumentNullException("estateService"); } if (sceneParams.m_CapabilitiesConfig == null) { throw new ArgumentNullException("capabilitiesConfig"); } if (sceneParams.RegionStorage == null) { throw new ArgumentNullException("regionStorage"); } #region Setup services m_ChatService = sceneParams.ChatFactory.Instantiate(ri.ID); RegionStorage = sceneParams.RegionStorage; GroupsNameService = sceneParams.GroupsNameService; GroupsService = sceneParams.GroupsService; m_NeighborService = sceneParams.NeighborService; m_SimulationDataStorage = sceneParams.SimulationDataStorage; PersistentAssetService = sceneParams.AssetService; TemporaryAssetService = sceneParams.AssetCacheService; GridService = sceneParams.GridService; ExperienceService = sceneParams.ExperienceService; ExperienceNameService = sceneParams.ExperienceNameService; EstateService = sceneParams.EstateService; /* next line is there to break the circular dependencies */ TryGetScene = m_Scenes.TryGetValue; UserAgentServicePlugins.AddRange(sceneParams.UserAgentServicePlugins); AssetServicePlugins.AddRange(sceneParams.AssetServicePlugins); InventoryServicePlugins.AddRange(sceneParams.InventoryServicePlugins); #endregion #region Setup Region Data ID = ri.ID; GatekeeperURI = ri.GridURI; Access = ri.Access; ID = ri.ID; Name = ri.Name; Owner = ri.Owner; GridPosition = ri.Location; ProductName = ri.ProductName; RegionPort = ri.ServerPort; m_ExternalHostNameService = sceneParams.ExternalHostNameService; #endregion /* load estate flags cache */ uint estateID; EstateInfo estate; if (EstateService.RegionMap.TryGetValue(ID, out estateID) && EstateService.TryGetValue(estateID, out estate)) { m_EstateData = estate; } else { throw new ArgumentException("Could not load estate data"); } m_RestartObject = new RestartObject(m_Scenes, this, sceneParams, sceneParams.RegionStorage); m_IMService = sceneParams.IMService; m_UDPServer = new UDPCircuitsManager(new IPAddress(0), (int)ri.ServerPort, sceneParams.IMService, m_ChatService, this, sceneParams.PortControlServices); CapabilitiesConfig = sceneParams.m_CapabilitiesConfig; foreach (AvatarNameServiceInterface avNameService in sceneParams.AvatarNameServices) { AvatarNameServices.Add(avNameService); } Terrain = new TerrainController(this); Environment = new EnvironmentController(this, sceneParams.WindModelFactory); if (sceneParams.PathfindingServiceFactory != null) { PathfindingService = sceneParams.PathfindingServiceFactory.Instantiate(this); } m_IMRouter = sceneParams.IMRouter; m_IMRouter.SceneIM.Add(IMSend); OnRemove += RemoveScene; m_UDPServer.Start(); ScriptThreadPool = sceneParams.ScriptWorkerThreadPoolFactory.InstantiateThreadPool(ID); }
public void Startup(ConfigurationLoader loader) { if (!string.IsNullOrEmpty(m_WindModelFactoryName)) { WindModelFactory = loader.GetService <IWindModelFactory>(m_WindModelFactoryName); } if (!string.IsNullOrEmpty(m_PathfindingServiceFactoryName)) { PathfindingServiceFactory = loader.GetService <IPathfindingServiceFactory>(m_PathfindingServiceFactoryName); } HttpServer = loader.HttpServer; PortControlServices = loader.GetServicesByValue <IPortControlServiceInterface>(); ExternalHostNameService = loader.ExternalHostNameService; Scenes = loader.Scenes; IMRouter = loader.IMRouter; RegionStorage = loader.GetService <GridServiceInterface>(m_RegionStorageName); ChatFactory = loader.GetService <ChatServiceFactoryInterface>(m_ChatFactoryName); if (m_GroupsNameServiceName.Length != 0) { GroupsNameService = loader.GetService <GroupsNameServiceInterface>(m_GroupsNameServiceName); } if (m_GroupsServiceName.Length != 0) { GroupsService = loader.GetService <GroupsServiceInterface>(m_GroupsServiceName); } if (m_PhysicsName.Length != 0) { PhysicsFactory = loader.GetService <IPhysicsSceneFactory>(m_PhysicsName); } if (m_NeighborServiceName.Length != 0) { NeighborService = loader.GetService <NeighborServiceInterface>(m_NeighborServiceName); } if (m_ExperienceServiceName.Length != 0) { ExperienceService = loader.GetService <ExperienceServiceInterface>(m_ExperienceServiceName); } if (m_ExperienceNameServiceName.Length != 0) { ExperienceNameService = loader.GetService <ExperienceNameServiceInterface>(m_ExperienceNameServiceName); } AssetService = loader.GetService <AssetServiceInterface>(m_AssetServiceName); AssetCacheService = loader.GetService <AssetServiceInterface>(m_AssetCacheServiceName); GridService = loader.GetService <GridServiceInterface>(m_GridServiceName); IMService = loader.GetService <IMServiceInterface>(m_IMServiceName); SimulationDataStorage = loader.GetService <SimulationDataStorageInterface>(m_SimulationDataStorageName); EstateService = loader.GetService <EstateServiceInterface>(m_EstateServiceName); foreach (string servicename in m_AvatarNameServiceNames) { AvatarNameServices.Add(loader.GetService <AvatarNameServiceInterface>(servicename)); } UserAgentServicePlugins = loader.GetServicesByValue <IUserAgentServicePlugin>(); AssetServicePlugins = loader.GetServicesByValue <IAssetServicePlugin>(); InventoryServicePlugins = loader.GetServicesByValue <IInventoryServicePlugin>(); IScriptWorkerThreadPoolFactory scriptWorkerFactory; ScriptWorkerThreadPoolFactory = ScriptWorkerThreadPool.Factory; if (m_ScriptWorkerThreadPoolName?.Length != 0) { if (!loader.TryGetService(m_ScriptWorkerThreadPoolName, out scriptWorkerFactory)) { m_Log.WarnFormat("Script worker thread pool \"{0\" not found. Using default implementation.", m_ScriptWorkerThreadPoolName); ScriptWorkerThreadPoolFactory = ScriptWorkerThreadPool.Factory; } else { ScriptWorkerThreadPoolFactory = scriptWorkerFactory; } } }