当前位置: 首页>>代码示例>>C#>>正文


C# Scene.AddRegionModule方法代码示例

本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.AddRegionModule方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.AddRegionModule方法的具体用法?C# Scene.AddRegionModule怎么用?C# Scene.AddRegionModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.Framework.Scenes.Scene的用法示例。


在下文中一共展示了Scene.AddRegionModule方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddRegionToModules

        // The root of all evil.
        // This is where we handle adding the modules to scenes when they
        // load. This means that here we deal with replaceable interfaces,
        // nonshared modules, etc.
        //
        public void AddRegionToModules (Scene scene)
        {
            Dictionary<Type, ISharedRegionModule> deferredSharedModules =
                    new Dictionary<Type, ISharedRegionModule>();
            Dictionary<Type, INonSharedRegionModule> deferredNonSharedModules =
                    new Dictionary<Type, INonSharedRegionModule>();

            // We need this to see if a module has already been loaded and
            // has defined a replaceable interface. It's a generic call,
            // so this can't be used directly. It will be used later
            Type s = scene.GetType();
            MethodInfo mi = s.GetMethod("RequestModuleInterface");

            // This will hold the shared modules we actually load
            List<ISharedRegionModule> sharedlist =
                    new List<ISharedRegionModule>();

            // Iterate over the shared modules that have been loaded
            // Add them to the new Scene
            foreach (ISharedRegionModule module in m_sharedInstances)
            {
                // Here is where we check if a replaceable interface
                // is defined. If it is, the module is checked against
                // the interfaces already defined. If the interface is
                // defined, we simply skip the module. Else, if the module
                // defines a replaceable interface, we add it to the deferred
                // list.
                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
                        m_log.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}", module.Name, replaceableInterface.ToString());
                        continue;
                    }

                    deferredSharedModules[replaceableInterface] = module;
                    m_log.DebugFormat("[REGIONMODULE]: Deferred load of {0}", module.Name);
                    continue;
                }

                m_log.DebugFormat("[REGIONMODULE]: Adding scene {0} to shared module {1}",
                                  scene.RegionInfo.RegionName, module.Name);

                module.AddRegion(scene);
                scene.AddRegionModule(module.Name, module);

                sharedlist.Add(module);
            }

            IConfig modulesConfig =
                    m_openSim.ConfigSource.Source.Configs["Modules"];

            // Scan for, and load, nonshared modules
            List<INonSharedRegionModule> list = new List<INonSharedRegionModule>();
            foreach (TypeExtensionNode node in m_nonSharedModules)
            {
                Object[] ctorArgs = new Object[] {0};

                // Read the config
                string moduleString =
                        modulesConfig.GetString("Setup_" + node.Id, String.Empty);

                // Get the port number, if there is one
                if (moduleString != String.Empty)
                {
                    // Get the port number from the string
                    string[] moduleParts = moduleString.Split(new char[] {'/'},
                            2);
                    if (moduleParts.Length > 1)
                        ctorArgs[0] = Convert.ToUInt32(moduleParts[0]);
                }

                // Actually load it
                INonSharedRegionModule module = null;

                Type[] ctorParamTypes = new Type[ctorArgs.Length];
                for (int i = 0; i < ctorParamTypes.Length; i++)
                    ctorParamTypes[i] = ctorArgs[i].GetType();

                if (node.Type.GetConstructor(ctorParamTypes) != null)
                    module = (INonSharedRegionModule)Activator.CreateInstance(node.Type, ctorArgs);
                else
                    module = (INonSharedRegionModule)Activator.CreateInstance(node.Type);

                // Check for replaceable interfaces
                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
//.........这里部分代码省略.........
开发者ID:SignpostMarv,项目名称:opensim,代码行数:101,代码来源:RegionModulesControllerPlugin.cs

示例2: StartInventoryService

 private static void StartInventoryService(Scene testScene, bool real)
 {
     ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("InventoryService");
     config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
     if (real)
         config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
     else
         config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestInventoryService");
     config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
     inventoryService.Initialise(config);
     inventoryService.AddRegion(testScene);
     inventoryService.RegionLoaded(testScene);
     testScene.AddRegionModule(inventoryService.Name, inventoryService);
     m_inventoryService = inventoryService;
 }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:18,代码来源:SceneSetupHelpers.cs

示例3: SetupSceneModules

        /// <summary>
        /// Setup modules for a scene.
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="config"></param>
        /// <param name="modules"></param>
        public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules)
        {
            List<IRegionModuleBase> newModules = new List<IRegionModuleBase>();
            foreach (object module in modules)
            {
                if (module is IRegionModule)
                {
                    IRegionModule m = (IRegionModule)module;
                    m.Initialise(scene, config);
                    scene.AddModule(m.Name, m);
                    m.PostInitialise();
                }
                else if (module is IRegionModuleBase)
                {
                    // for the new system, everything has to be initialised first,
                    // shared modules have to be post-initialised, then all get an AddRegion with the scene
                    IRegionModuleBase m = (IRegionModuleBase)module;
                    m.Initialise(config);
                    newModules.Add(m);
                }
            }

            foreach (IRegionModuleBase module in newModules)
            {
                if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
            }

            foreach (IRegionModuleBase module in newModules)
            {
                module.AddRegion(scene);
                module.RegionLoaded(scene);
                scene.AddRegionModule(module.Name, module);
            }

            scene.SetModuleInterfaces();
        }
开发者ID:intari,项目名称:OpenSimMirror,代码行数:42,代码来源:SceneSetupHelpers.cs

示例4: StartUserAccountService

        /// <summary>
        /// Start a user account service
        /// </summary>
        /// <param name="testScene"></param>
        /// <returns></returns>
        private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene)
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("UserAccountService");
            config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
            config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
            config.Configs["UserAccountService"].Set(
                "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");

            LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector();
            userAccountService.Initialise(config);

            userAccountService.AddRegion(testScene);
            userAccountService.RegionLoaded(testScene);
            testScene.AddRegionModule(userAccountService.Name, userAccountService);
            
            return userAccountService;
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:24,代码来源:SceneHelpers.cs

示例5: StartPresenceService

        /// <summary>
        /// Start a presence service
        /// </summary>
        /// <param name="testScene"></param>
        private static LocalPresenceServicesConnector StartPresenceService(Scene testScene)
        {
            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.AddConfig("PresenceService");
            config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
            config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
            config.Configs["PresenceService"].Set(
                "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");

            LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector();
            presenceService.Initialise(config);

            presenceService.AddRegion(testScene);
            presenceService.RegionLoaded(testScene);
            testScene.AddRegionModule(presenceService.Name, presenceService);
            
            return presenceService;
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:23,代码来源:SceneHelpers.cs

示例6: StartAuthenticationService

 private static void StartAuthenticationService(Scene testScene)
 {
     ISharedRegionModule service = new LocalAuthenticationServicesConnector();
     IConfigSource config = new IniConfigSource();
     
     config.AddConfig("Modules");
     config.AddConfig("AuthenticationService");
     config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
     config.Configs["AuthenticationService"].Set(
         "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
     config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
     
     service.Initialise(config);
     service.AddRegion(testScene);
     service.RegionLoaded(testScene);
     testScene.AddRegionModule(service.Name, service);
     //m_authenticationService = service;
 }
开发者ID:4U2NV,项目名称:opensim,代码行数:18,代码来源:SceneHelpers.cs

示例7: StartInventoryService

 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene)
 {
     LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
     
     IConfigSource config = new IniConfigSource();            
     config.AddConfig("Modules");
     config.AddConfig("InventoryService");
     config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
     config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
     config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
     
     inventoryService.Initialise(config);
     inventoryService.AddRegion(testScene);
     inventoryService.RegionLoaded(testScene);
     testScene.AddRegionModule(inventoryService.Name, inventoryService);
     
     return inventoryService;           
 }
开发者ID:4U2NV,项目名称:opensim,代码行数:18,代码来源:SceneHelpers.cs

示例8: StartAssetService

        private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache)
        {
            LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
            IConfigSource config = new IniConfigSource();
            
            config.AddConfig("Modules");            
            config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");            
            config.AddConfig("AssetService");
            config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");            
            config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
            
            assetService.Initialise(config);
            assetService.AddRegion(testScene);

            if (cache != null)
            {
                IConfigSource cacheConfig = new IniConfigSource();
                cacheConfig.AddConfig("Modules");
                cacheConfig.Configs["Modules"].Set("AssetCaching", "CoreAssetCache");
                cacheConfig.AddConfig("AssetCache");

                cache.Initialise(cacheConfig);
                cache.AddRegion(testScene);
                cache.RegionLoaded(testScene);
                testScene.AddRegionModule(cache.Name, cache);
            }

            assetService.RegionLoaded(testScene);
            testScene.AddRegionModule(assetService.Name, assetService);
            
            return assetService;
        }
开发者ID:4U2NV,项目名称:opensim,代码行数:32,代码来源:SceneHelpers.cs

示例9: StartAssetService

 private static void StartAssetService(Scene testScene, bool real)
 {
     ISharedRegionModule assetService = new LocalAssetServicesConnector();
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("AssetService");
     config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
     if (real)
         config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
     else
         config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
     config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
     assetService.Initialise(config);
     assetService.AddRegion(testScene);
     assetService.RegionLoaded(testScene);
     testScene.AddRegionModule(assetService.Name, assetService);
     m_assetService = assetService;
 }
开发者ID:N3X15,项目名称:VoxelSim,代码行数:18,代码来源:SceneSetupHelpers.cs

示例10: StartUserAccountService

 /// <summary>
 /// Start a user account service, whether real or mock
 /// </summary>
 /// <param name="testScene"></param>
 /// <param name="real">Starts a real service if true, a mock service if not</param>
 private static void StartUserAccountService(Scene testScene, bool real)
 {
     IConfigSource config = new IniConfigSource();
     config.AddConfig("Modules");
     config.AddConfig("UserAccountService");
     config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
     config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
     
     if (real)
         config.Configs["UserAccountService"].Set(
             "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
     else
         config.Configs["UserAccountService"].Set(
             "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService");
     
     if (m_userAccountService == null)
     {
         ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
         userAccountService.Initialise(config);
         m_userAccountService = userAccountService;
     }
     //else
     //    config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
     m_userAccountService.AddRegion(testScene);
     m_userAccountService.RegionLoaded(testScene);
     testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
 }
开发者ID:dreamerc,项目名称:diva-distribution,代码行数:32,代码来源:SceneSetupHelpers.cs

示例11: AddRegionToModules

        public void AddRegionToModules (Scene scene)
        {
            Dictionary<Type, ISharedRegionModule> deferredSharedModules =
                    new Dictionary<Type, ISharedRegionModule>();
            Dictionary<Type, INonSharedRegionModule> deferredNonSharedModules =
                    new Dictionary<Type, INonSharedRegionModule>();

            Type s = scene.GetType();
            MethodInfo mi = s.GetMethod("RequestModuleInterface");

            List<ISharedRegionModule> sharedlist = new List<ISharedRegionModule>();
            foreach (ISharedRegionModule module in m_sharedInstances)
            {
                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
                        m_log.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}", module.Name, replaceableInterface.ToString());
                        continue;
                    }

                    deferredSharedModules[replaceableInterface] = module;
                    m_log.DebugFormat("[REGIONMODULE]: Deferred load of {0}", module.Name);
                    continue;
                }

                m_log.DebugFormat("[REGIONMODULE]: Adding scene {0} to shared module {1}",
                                  scene.RegionInfo.RegionName, module.Name);

                module.AddRegion(scene);
                scene.AddRegionModule(module.Name, module);

                sharedlist.Add(module);
            }

            List<INonSharedRegionModule> list = new List<INonSharedRegionModule>();
            foreach (Type type in m_nonSharedModules)
            {
                INonSharedRegionModule module = (INonSharedRegionModule)Activator.CreateInstance(type);

                Type replaceableInterface = module.ReplaceableInterface;
                if (replaceableInterface != null)
                {
                    MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                    if (mii.Invoke(scene, new object[0]) != null)
                    {
                        m_log.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}", module.Name, replaceableInterface.ToString());
                        continue;
                    }

                    deferredNonSharedModules[replaceableInterface] = module;
                    m_log.DebugFormat("[REGIONMODULE]: Deferred load of {0}", module.Name);
                    continue;
                }

                m_log.DebugFormat("[REGIONMODULE]: Adding scene {0} to non-shared module {1}",
                                  scene.RegionInfo.RegionName, module.Name);

                module.Initialise(m_openSim.ConfigSource.Source);

                list.Add(module);
            }

            foreach (INonSharedRegionModule module in list)
            {
                module.AddRegion(scene);
                scene.AddRegionModule(module.Name, module);
            }

            // Now all modules without a replaceable base interface are loaded
            // Replaceable modules have either been skipped, or omitted.
            // Now scan the deferred modules here

            foreach (ISharedRegionModule module in deferredSharedModules.Values)
            {
                Type replaceableInterface = module.ReplaceableInterface;
                MethodInfo mii = mi.MakeGenericMethod(replaceableInterface);

                if (mii.Invoke(scene, new object[0]) != null)
                {
                    m_log.DebugFormat("[REGIONMODULE]: Not loading {0} because another module has registered {1}", module.Name, replaceableInterface.ToString());
                    continue;
                }

                m_log.DebugFormat("[REGIONMODULE]: Adding scene {0} to shared module {1} (deferred)",
                                  scene.RegionInfo.RegionName, module.Name);

                module.AddRegion(scene);
                scene.AddRegionModule(module.Name, module);

                sharedlist.Add(module);
            }

            List<INonSharedRegionModule> deferredlist = new List<INonSharedRegionModule>();
            foreach (INonSharedRegionModule module in deferredNonSharedModules.Values)
            {
//.........这里部分代码省略.........
开发者ID:Ideia-Boa,项目名称:Diva-s-OpenSim-Tests,代码行数:101,代码来源:RegionModulesControllerPlugin.cs

示例12: AddRegionToModules

        // The root of all evil.
        // This is where we handle adding the modules to scenes when they
        // load
        public void AddRegionToModules (Scene scene)
        {
            // This will hold the shared modules we actually load
            List<ISharedRegionModule> sharedlist = new List<ISharedRegionModule>();

            // Iterate over the shared modules that have been loaded
            // Add them to the new Scene
            foreach (ISharedRegionModule module in m_sharedModules)
            {
                m_log.DebugFormat("[REGIONMODULE]: Adding scene {0} to shared module {1}",
                                  scene.RegionInfo.RegionName, module.Name);

                module.AddRegion(scene);
                scene.AddRegionModule(module.Name, module);

                sharedlist.Add(module);
            }

            IConfig modulesConfig =
                    m_openSim.ConfigSource.Source.Configs["Modules"];

            // Scan for, and load, nonshared modules
            List<INonSharedRegionModule> list = new List<INonSharedRegionModule>();
            foreach (INonSharedRegionModule module in m_nonSharedModules)
            {
                m_log.DebugFormat("[REGIONMODULE]: Adding scene {0} to non-shared module {1}",
                                  scene.RegionInfo.RegionName, module.Name);

                // Initialise the module
                module.Initialise(m_openSim.ConfigSource.Source);

                list.Add(module);
            }

            // Now add the modules that we found to the scene
            foreach (INonSharedRegionModule module in list)
            {
                module.AddRegion(scene);
                scene.AddRegionModule(module.Name, module);
            }

            // This is needed for all module types. Modules will register
            // Interfaces with scene in AddScene, and will also need a means
            // to access interfaces registered by other modules. Without
            // this extra method, a module attempting to use another modules's
            // interface would be successful only depending on load order,
            // which can't be depended upon, or modules would need to resort
            // to ugly kludges to attempt to request interfaces when needed
            // and unneccessary caching logic repeated in all modules.
            // The extra function stub is just that much cleaner
            foreach (ISharedRegionModule module in sharedlist)
                module.RegionLoaded(scene);

            foreach (INonSharedRegionModule module in list)
                module.RegionLoaded(scene);
        }
开发者ID:openmetaversefoundation,项目名称:fortis-opensim,代码行数:59,代码来源:RegionModulesControllerPlugin.cs


注:本文中的OpenSim.Region.Framework.Scenes.Scene.AddRegionModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。