Пример #1
0
        /// <summary>
        /// Set up a scene.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="sizeX">X size of scene</param>
        /// <param name="sizeY">Y size of scene</param>
        /// <param name="configSource"></param>
        /// <returns></returns>
        public TestScene SetupScene(
            string name, UUID id, uint x, uint y, uint sizeX, uint sizeY, IConfigSource configSource)
        {
            Console.WriteLine("Setting up test scene {0}", name);

            // We must set up a console otherwise setup of some modules may fail
            MainConsole.Instance = new MockConsole();
            
            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
            regInfo.RegionName = name;
            regInfo.RegionID = id;
            regInfo.RegionSizeX = sizeX;
            regInfo.RegionSizeY = sizeY;

            TestScene testScene = new TestScene(
                regInfo, m_acm, SimDataService, m_estateDataService, configSource, null);

            INonSharedRegionModule godsModule = new GodsModule();
            godsModule.Initialise(new IniConfigSource());
            godsModule.AddRegion(testScene);

            // Add scene to physics
            ((INonSharedRegionModule)m_physicsScene).AddRegion(testScene);
            ((INonSharedRegionModule)m_physicsScene).RegionLoaded(testScene);

            // Add scene to services
            m_assetService.AddRegion(testScene);

            if (m_cache != null)
            {
                m_cache.AddRegion(testScene);
                m_cache.RegionLoaded(testScene);
                testScene.AddRegionModule(m_cache.Name, m_cache);
            }

            m_assetService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_assetService.Name, m_assetService);

            m_authenticationService.AddRegion(testScene);
            m_authenticationService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_authenticationService.Name, m_authenticationService);

            m_inventoryService.AddRegion(testScene);
            m_inventoryService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_inventoryService.Name, m_inventoryService);

            m_gridService.AddRegion(testScene);
            m_gridService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_gridService.Name, m_gridService);

            m_userAccountService.AddRegion(testScene);
            m_userAccountService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);

            m_presenceService.AddRegion(testScene);
            m_presenceService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
            
            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsEnabled = true;
            testScene.RegisterRegionWithGrid();

            SceneManager.Add(testScene);

            return testScene;
        }
Пример #2
0
        /// <summary>
        /// Set up a scene.
        /// </summary>
        /// <param name="name">Name of the region</param>
        /// <param name="id">ID of the region</param>
        /// <param name="x">X co-ordinate of the region</param>
        /// <param name="y">Y co-ordinate of the region</param>
        /// <param name="sizeX">X size of scene</param>
        /// <param name="sizeY">Y size of scene</param>
        /// <param name="configSource"></param>
        /// <returns></returns>
        public TestScene SetupScene(
            string name, UUID id, uint x, uint y, uint sizeX, uint sizeY, IConfigSource configSource)
        {
            Console.WriteLine("Setting up test scene {0}", name);

            // We must set up a console otherwise setup of some modules may fail
            MainConsole.Instance = new MockConsole();
            
            RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
            regInfo.RegionName = name;
            regInfo.RegionID = id;
            regInfo.RegionSizeX = sizeX;
            regInfo.RegionSizeY = sizeY;

            SceneCommunicationService scs = new SceneCommunicationService();

            TestScene testScene = new TestScene(
                regInfo, m_acm, scs, SimDataService, m_estateDataService, configSource, null);

            INonSharedRegionModule godsModule = new GodsModule();
            godsModule.Initialise(new IniConfigSource());
            godsModule.AddRegion(testScene);

            // Add scene to services
            m_assetService.AddRegion(testScene);

            if (m_cache != null)
            {
                m_cache.AddRegion(testScene);
                m_cache.RegionLoaded(testScene);
                testScene.AddRegionModule(m_cache.Name, m_cache);
            }

            m_assetService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_assetService.Name, m_assetService);

            m_authenticationService.AddRegion(testScene);
            m_authenticationService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_authenticationService.Name, m_authenticationService);

            m_inventoryService.AddRegion(testScene);
            m_inventoryService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_inventoryService.Name, m_inventoryService);

            m_gridService.AddRegion(testScene);
            m_gridService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_gridService.Name, m_gridService);

            m_userAccountService.AddRegion(testScene);
            m_userAccountService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);

            m_presenceService.AddRegion(testScene);
            m_presenceService.RegionLoaded(testScene);
            testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
            
            testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
            testScene.SetModuleInterfaces();

            testScene.LandChannel = new TestLandChannel(testScene);
            testScene.LoadWorldMap();

            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
            Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ);
            testScene.PhysicsScene
                = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent);

            testScene.RegionInfo.EstateSettings = new EstateSettings();
            testScene.LoginsEnabled = true;
            testScene.RegisterRegionWithGrid();

            SceneManager.Add(testScene);

            return testScene;
        }