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


C# Scene.Initialize方法代码示例

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


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

示例1: SetupScene

        /// <summary>
        /// Create a scene and its initial base structures.
        /// </summary>
        /// <param name="regionInfo"></param>
        /// <param name="proxyOffset"></param>
        /// <param name="configSource"></param>
        /// <param name="clientServer"> </param>
        /// <returns></returns>
        protected Scene SetupScene (RegionInfo regionInfo, IConfigSource configSource)
        {
            AgentCircuitManager circuitManager = new AgentCircuitManager ();
            List<IClientNetworkServer> clientServers = AuroraModuleLoader.PickupModules<IClientNetworkServer> ();
            List<IClientNetworkServer> allClientServers = new List<IClientNetworkServer> ();
            foreach (IClientNetworkServer clientServer in clientServers)
            {
                foreach (int port in regionInfo.UDPPorts)
                {
                    IClientNetworkServer copy = clientServer.Copy ();
                    copy.Initialise (port, m_configSource, circuitManager);
                    allClientServers.Add (copy);
                }
            }

            Scene scene = new Scene ();
            scene.AddModuleInterfaces (m_openSimBase.ApplicationRegistry.GetInterfaces ());
            scene.Initialize (regionInfo, circuitManager, allClientServers);

            return scene;
        }
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:29,代码来源:SceneLoader.cs

示例2: LoadLibraries

        /// <summary>
        ///   Use the asset set information at path to load assets
        /// </summary>
        /// <param name = "path"></param>
        /// <param name = "assets"></param>
        protected void LoadLibraries(string iarFileName)
        {
            RegionInfo regInfo = new RegionInfo();
            IScene m_MockScene = null;
            //Make the scene for the IAR loader
            if (m_registry is IScene)
                m_MockScene = (IScene) m_registry;
            else
            {
                m_MockScene = new Scene();
                m_MockScene.Initialize(regInfo);
                m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces());
            }

            UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner);
            //Make the user account for the default IAR
            if (uinfo == null)
            {
                MainConsole.Instance.Warn("Creating user " + m_service.LibraryOwnerName);
                m_MockScene.UserAccountService.CreateUser(m_service.LibraryOwner, m_service.LibraryOwnerName, "", "");
                uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner);
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);
            }
            if (m_MockScene.InventoryService.GetRootFolder(m_service.LibraryOwner) == null)
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);

            List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetFolderFolders(uinfo.PrincipalID,
                                                                                                  UUID.Zero);
#if (!ISWIN)
            bool alreadyExists = false;
            foreach (InventoryFolderBase folder in rootFolders)
            {
                if (folder.Name == iarFileName)
                {
                    alreadyExists = true;
                    break;
                }
            }
#else
            bool alreadyExists = rootFolders.Any(folder => folder.Name == iarFileName);
#endif
            if (alreadyExists)
            {
                MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Found previously loaded iar file {0}, ignoring.", iarFileName);
                return;
            }

            MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Loading iar file {0}", iarFileName);
            InventoryFolderBase rootFolder = m_MockScene.InventoryService.GetRootFolder(uinfo.PrincipalID);

            if (null == rootFolder)
            {
                //We need to create the root folder, otherwise the IAR freaks
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);
            }

            InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName,
                                                                                   false);

            try
            {
                List<InventoryNodeBase> nodes = new List<InventoryNodeBase>(archread.Execute(true));
                if (nodes.Count == 0)
                    return;
                InventoryFolderBase f = (InventoryFolderBase) nodes[0];

                TraverseFolders(nodes[0].ID, m_MockScene);
                //This is our loaded folder
                //Fix the name for later
                f.Name = iarFileName;
                f.ParentID = UUID.Zero;
                //f.Type = (int)AssetType.RootFolder;
                m_MockScene.InventoryService.UpdateFolder(f);
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName,
                                  e.StackTrace);
            }
            finally
            {
                archread.Close();
            }
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:89,代码来源:DefaultInventoryIARLoader.cs

示例3: SetupScene

        /// <summary>
        /// Create a scene and its initial base structures.
        /// </summary>
        /// <param name="regionInfo"></param>
        /// <param name="proxyOffset"></param>
        /// <param name="configSource"></param>
        /// <param name="clientServer"> </param>
        /// <returns></returns>
        protected Scene SetupScene(RegionInfo regionInfo, IConfigSource configSource)
        {
            AgentCircuitManager circuitManager = new AgentCircuitManager();
            IPAddress listenIP = regionInfo.InternalEndPoint.Address;
            if (!IPAddress.TryParse(regionInfo.InternalEndPoint.Address.ToString(), out listenIP))
                listenIP = IPAddress.Parse("0.0.0.0");

            uint port = (uint)regionInfo.InternalEndPoint.Port;

            string ClientstackDll = m_config.Configs["Startup"].GetString("ClientStackPlugin", "OpenSim.Region.ClientStack.LindenUDP.dll");

            IClientNetworkServer clientServer = AuroraModuleLoader.LoadPlugin<IClientNetworkServer> (Util.BasePathCombine(ClientstackDll));
            clientServer.Initialise(
                    listenIP, ref port, 0, regionInfo.m_allow_alternate_ports,
                    m_config, circuitManager);

            regionInfo.InternalEndPoint.Port = (int)port;

            Scene scene = new Scene ();
            scene.AddModuleInterfaces (m_OpenSimBase.ApplicationRegistry.GetInterfaces ());
            scene.Initialize (regionInfo, circuitManager, clientServer);

            StartModules(scene);

            m_clientServers.Add(clientServer);

            //Do this here so that we don't have issues later when startup complete messages start coming in
            m_localScenes.Add(scene);

            return scene;
        }
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:39,代码来源:SceneManager.cs

示例4: FinishedStartup

        public void FinishedStartup()
        {
            m_log.InfoFormat("[DefaultInventoryToIARConverter]: start");

            string IARName = "DefaultInventory.iar";
            IniConfigSource iniSource = null;
            try
            {
                iniSource = new IniConfigSource("DefaultInventory/Inventory.ini", Nini.Ini.IniFileType.AuroraStyle);
            }
            catch
            {
            }
            IConfig libConfig = m_config.Configs["DefaultAssetsIARCreator"];
            if (libConfig == null)
                libConfig = iniSource.Configs["DefaultAssetsIARCreator"];
            if (libConfig != null)
            {
                if (!libConfig.GetBoolean("Enabled", false))
                    return;
                IARName = libConfig.GetString("NameOfIAR", IARName);
            }
            else
                return;
            m_service = m_registry.RequestModuleInterface<ILibraryService>();

            RegionInfo regInfo = new RegionInfo();
            IScene m_MockScene = null;
            //Make the scene for the IAR loader
            if (m_registry is IScene)
                m_MockScene = (IScene)m_registry;
            else
            {
                m_MockScene = new Scene();
                m_MockScene.Initialize(regInfo);
                m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces());
            }

            m_log.InfoFormat("[DefaultInventoryToIARConverter]: 1");
            UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(null, m_service.LibraryOwner);
            //Make the user account for the default IAR
            if (uinfo == null)
            {
                uinfo = new UserAccount(m_service.LibraryOwner);
                uinfo.Name = m_service.LibraryOwnerName;
                //m_MockScene.InventoryService.CreateUserInventory(m_service.LibraryOwner, false);
                m_log.InfoFormat("[DefaultInventoryToIARConverter]: 1,1");
                m_Database = DataManager.RequestPlugin<IInventoryData>();
                m_log.InfoFormat("[DefaultInventoryToIARConverter]: 1,2");
                if(m_Database == null) m_log.InfoFormat("[DefaultInventoryToIARConverter]: m_Database == null");
                InventoryFolderBase newFolder = new InventoryFolderBase
                                                    {
                                                    Name = "My Inventory",
                                                    Type = 9,
                                                    Version = 1,
                                                    ID = new UUID("00000112-000f-0000-0000-000100bba000"),
                                                    Owner = m_service.LibraryOwner,
                                                    ParentID = UUID.Zero
                                                    };
                m_log.InfoFormat("[DefaultInventoryToIARConverter]: 1,3");
            m_Database.StoreFolder(newFolder);
            m_log.InfoFormat("[DefaultInventoryToIARConverter]: 1,4");
            }
            m_log.InfoFormat("[DefaultInventoryToIARConverter]: 2");

            List<AssetBase> assets = new List<AssetBase> ();
            if (m_MockScene.InventoryService != null)
            {
                //Add the folders to the user's inventory
                InventoryCollection i = m_MockScene.InventoryService.GetFolderContent (m_service.LibraryOwner, UUID.Zero);
                if (i != null)
                {
                    foreach (InventoryItemBase item in i.Items)
                    {

                        AssetBase asset = m_MockScene.RequestModuleInterface<IAssetService> ().Get (item.AssetID.ToString ());
                        if (asset != null)
                        {
                            assets.Add (asset);
                            m_log.InfoFormat("[DefaultInventoryToIARConverter]: added asset");
                            }
                    }
                }
                else m_log.InfoFormat("[DefaultInventoryToIARConverter]: i == null");
            }

            m_log.InfoFormat("[DefaultInventoryToIARConverter]: 3");

            InventoryFolderBase rootFolder = null;
            List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetRootFolders (m_service.LibraryOwner);
            foreach (InventoryFolderBase folder in rootFolders)
            {
            m_log.InfoFormat("folder name {0}", folder.Name);
                //if (folder.Name == "My Inventory")
                //    continue;

                rootFolder = folder;
                break;
            }

//.........这里部分代码省略.........
开发者ID:nhede,项目名称:Aurora-Sim-Optional-Modules,代码行数:101,代码来源:DefaultInventoryToIARConverter.cs

示例5: Start

        public void Start(IConfigSource config, IRegistryCore registry)
        {
            string IARName = "DefaultInventory.iar";
            IniConfigSource iniSource = null;
            try
            {
                iniSource = new IniConfigSource("DefaultInventory/Inventory.ini", Nini.Ini.IniFileType.AuroraStyle);
            }
            catch
            {
            }
            IConfig libConfig = config.Configs["DefaultAssetsIARCreator"];
            if (libConfig == null)
                libConfig = iniSource.Configs["DefaultAssetsIARCreator"];
            if (libConfig != null)
            {
                if (!libConfig.GetBoolean("Enabled", false))
                    return;
                IARName = libConfig.GetString("NameOfIAR", IARName);
            }
            else
                return;
            m_service = registry.RequestModuleInterface<ILibraryService>();

            RegionInfo regInfo = new RegionInfo();
            IScene m_MockScene = null;
            //Make the scene for the IAR loader
            if (registry is IScene)
                m_MockScene = (IScene)registry;
            else
            {
                m_MockScene = new Scene();
                m_MockScene.Initialize(regInfo);
                m_MockScene.AddModuleInterfaces(registry.GetInterfaces());
            }

            UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner);
            //Make the user account for the default IAR
            if (uinfo == null)
            {
                uinfo = new UserAccount(m_service.LibraryOwner);
                uinfo.Name = m_service.LibraryOwnerName;
                m_MockScene.InventoryService.CreateUserInventory(m_service.LibraryOwner, false);
            }

            List<AssetBase> assets = new List<AssetBase> ();
            if (m_MockScene.InventoryService != null)
            {
                //Add the folders to the user's inventory
                InventoryCollection i = m_MockScene.InventoryService.GetFolderContent (m_service.LibraryOwner, UUID.Zero);
                if (i != null)
                {
                    foreach (InventoryItemBase item in i.Items)
                    {
                        AssetBase asset = m_MockScene.RequestModuleInterface<IAssetService> ().Get (item.AssetID.ToString ());
                        if (asset != null)
                            assets.Add (asset);
                    }
                }
            }
            InventoryFolderBase rootFolder = null;
            List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetRootFolders (m_service.LibraryOwner);
            foreach (InventoryFolderBase folder in rootFolders)
            {
                if (folder.Name == "My Inventory")
                    continue;

                rootFolder = folder;
                break;
            }
            if (rootFolder != null)
            {
                //Save the IAR of the default assets
                InventoryArchiveWriteRequest write = new InventoryArchiveWriteRequest (Guid.NewGuid (), null, m_MockScene,
                    uinfo, "/", new GZipStream (new FileStream (IARName, FileMode.Create), CompressionMode.Compress), true, rootFolder, assets);
                write.Execute ();
            }
        }
开发者ID:andsim,项目名称:Aurora-Sim-Optional-Modules,代码行数:78,代码来源:DefaultInventoryToIARConverter.cs


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