• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Framework.RegionInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Aurora.Framework.RegionInfo的典型用法代码示例。如果您正苦于以下问题:C# RegionInfo类的具体用法?C# RegionInfo怎么用?C# RegionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RegionInfo类属于Aurora.Framework命名空间,在下文中一共展示了RegionInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UpdateRegionInfo

 public void UpdateRegionInfo(RegionInfo region)
 {
     RegionInfo oldRegion = GetRegionInfo(region.RegionID);
     if (oldRegion != null)
     {
         m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("RegionInfoChanged", new[] 
         {
             oldRegion,
             region
         });
     }
     Dictionary<string, object> row = new Dictionary<string, object>(4);
     row["RegionID"] = region.RegionID;
     row["RegionName"] = region.RegionName.MySqlEscape(50);
     row["RegionInfo"] = OSDParser.SerializeJsonString(region.PackRegionInfoData(true));
     row["DisableD"] = region.Disabled ? 1 : 0;
     GD.Replace("simulator", row);
 }
开发者ID:TechplexEngineer,项目名称:Aurora-Sim,代码行数:18,代码来源:LocalRegionInfoConnector.cs


示例2: RegionManager

 public RegionManager(bool killWindowOnRegionCreation, RegionManagerPage page, IConfigSource config, IRegionManagement regionManagement, RegionInfo startingRegionInfo)
 {
     _regionManager = regionManagement;
     _config = config;
     _startingRegionInfo = startingRegionInfo;
     RegionInfo = _startingRegionInfo;
     KillAfterRegionCreation = killWindowOnRegionCreation;
     _pageToStart = page;
     InitializeComponent();
     ChangeRegionInfo(_startingRegionInfo);
     if (_startingRegionInfo == null)
         groupBox5.Visible = false;
     tabControl1.SelectedIndex = (int)_pageToStart;
     changeEstateBox.Visible = false;
     _timer.Interval = 100;
     _timer.Tick += m_timer_Tick;
     _timer.Start ();
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:18,代码来源:RegionManager.cs


示例3: SceneGraph

        protected internal SceneGraph(IScene parent, RegionInfo regInfo)
        {
            Random random = new Random();
            m_lastAllocatedLocalId = (uint)(random.NextDouble() * (uint.MaxValue / 2)) + uint.MaxValue / 4;
            m_parentScene = parent;
            m_regInfo = regInfo;

            //Subscript to the scene events
            m_parentScene.EventManager.OnNewClient += SubscribeToClientEvents;
            m_parentScene.EventManager.OnClosingClient += UnSubscribeToClientEvents;

            IConfig aurorastartupConfig = parent.Config.Configs["AuroraStartup"];
            if (aurorastartupConfig != null)
            {
                m_DefaultObjectName = aurorastartupConfig.GetString("DefaultObjectName", m_DefaultObjectName);
                EnableFakeRaycasting = aurorastartupConfig.GetBoolean("EnableFakeRaycasting", false);
            }
        }
开发者ID:EnricoNirvana,项目名称:Aurora-Sim,代码行数:18,代码来源:SceneGraph.cs


示例4: 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 IScene 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:nathanmarck,项目名称:Aurora-Sim,代码行数:29,代码来源:SceneLoader.cs


示例5: UpdateRegionInfo

 public void UpdateRegionInfo(RegionInfo region)
 {
     RegionInfo oldRegion = GetRegionInfo(region.RegionID);
     if (oldRegion != null)
     {
         m_registry.RequestModuleInterface<ISimulationBase>().EventManager.FireGenericEventHandler("RegionInfoChanged", new[] 
         {
             oldRegion,
             region
         });
     }
     List<object> Values = new List<object>
                               {
                                   region.RegionID,
                                   region.RegionName.MySqlEscape(50),
                                   OSDParser.SerializeJsonString(region.PackRegionInfoData(true)),
                                   region.Disabled ? 1 : 0
                               };
     GD.Replace("simulator", new[]{"RegionID","RegionName",
         "RegionInfo","Disabled"}, Values.ToArray());
 }
开发者ID:djphil,项目名称:Aurora-Sim,代码行数:21,代码来源:LocalRegionInfoConnector.cs


示例6: GetPhysicsScene

        /// <summary>
        ///   Get a physics scene for the given physics engine and mesher.
        /// </summary>
        /// <param name = "physEngineName"></param>
        /// <param name = "meshEngineName"></param>
        /// <param name = "config"></param>
        /// <returns></returns>
        public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config,
                                            RegionInfo region, IRegistryCore registry)
        {
            if (String.IsNullOrEmpty(physEngineName))
            {
                return new NullPhysicsScene();
            }

            if (String.IsNullOrEmpty(meshEngineName))
            {
                return new NullPhysicsScene();
            }

            IMesher meshEngine = null;
            if (_MeshPlugins.ContainsKey(meshEngineName))
            {
                MainConsole.Instance.Debug("[Physics]: Loading meshing engine: " + meshEngineName);
                meshEngine = _MeshPlugins[meshEngineName].GetMesher(config);
            }
            else
            {
                MainConsole.Instance.WarnFormat("[Physics]: Couldn't find meshing engine: {0}", meshEngineName);
                throw new ArgumentException(String.Format("couldn't find meshing engine: {0}", meshEngineName));
            }

            if (_PhysPlugins.ContainsKey(physEngineName))
            {
                MainConsole.Instance.Debug("[Physics]: Loading physics engine: " + physEngineName);
                PhysicsScene result = _PhysPlugins[physEngineName].GetScene(region.RegionName);
                result.Initialise(meshEngine, region, registry);
                result.PostInitialise(config);
                return result;
            }
            else
            {
                MainConsole.Instance.WarnFormat("[Physics]: Couldn't find physics engine: {0}", physEngineName);
                throw new ArgumentException(String.Format("couldn't find physics engine: {0}", physEngineName));
            }
        }
开发者ID:Gnu32,项目名称:Silverfin,代码行数:46,代码来源:PhysicsPluginManager.cs


示例7: UpdateRegionInfo

        public void UpdateRegionInfo(string oldName, RegionInfo regionInfo)
        {
            IRegionInfoConnector connector = DataManager.RequestPlugin<IRegionInfoConnector>();
            if (connector != null)
            {
                //Make sure we have this region in the database
                if (connector.GetRegionInfo(oldName) == null)
                    return;
                RegionInfo copy = new RegionInfo();
                //Make an exact copy
                copy.UnpackRegionInfoData(regionInfo.PackRegionInfoData(true));

                //Fix the name of the region so we can delete the old one
                copy.RegionName = oldName;
                DeleteRegion(copy);
                //Now add the new one
                connector.UpdateRegionInfo(regionInfo);
            }
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:19,代码来源:RegionLoaderDataBaseSystem.cs


示例8: Initialise

 // Initialize the mesh plugin
 public override void Initialise(IMesher meshmerizer, RegionInfo region, IRegistryCore registry)
 {
     mesher = meshmerizer;
     m_region = region;
     m_registry = registry;
     WorldExtents = new Vector2(region.RegionSizeX, region.RegionSizeY);
 }
开发者ID:EnricoNirvana,项目名称:Aurora-Sim,代码行数:8,代码来源:AODEPhysicsScene.cs


示例9: DeleteRegion

 public void DeleteRegion(RegionInfo regionInfo)
 {
     IRegionInfoConnector connector = DataManager.RequestPlugin<IRegionInfoConnector>();
     if (connector != null)
     {
         connector.Delete(regionInfo);
     }
 }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:8,代码来源:RegionLoaderDataBaseSystem.cs


示例10: LoadModuleFromArchive

 public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type, IScene scene)
 {
     if (filePath.StartsWith("estate/"))
     {
         string estateData = Encoding.UTF8.GetString(data);
         EstateSettings settings = new EstateSettings(WebUtils.ParseXmlResponse(estateData));
         scene.RegionInfo.EstateSettings = settings;
     }
     else if (filePath.StartsWith("regioninfo/"))
     {
         string m_merge = MainConsole.Instance.Prompt("Should we load the region information from the archive (region name, region position, etc)?", "false");
         RegionInfo settings = new RegionInfo();
         settings.UnpackRegionInfoData((OSDMap)OSDParser.DeserializeLLSDBinary(data));
         if (m_merge == "false")
         {
             //Still load the region settings though
             scene.RegionInfo.RegionSettings = settings.RegionSettings;
             return;
         }
         settings.RegionSettings = scene.RegionInfo.RegionSettings;
         settings.EstateSettings = scene.RegionInfo.EstateSettings;
         scene.RegionInfo = settings;
     }
 }
开发者ID:Gnu32,项目名称:Silverfin,代码行数:24,代码来源:EstateInitializer.cs


示例11: 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, UUID.Zero, 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, m_service.LibraryOwner);

            try
            {
                archread.ReplaceAssets = true;//Replace any old assets
                List<InventoryNodeBase> nodes = new List<InventoryNodeBase>(archread.Execute(true));
                if (nodes.Count == 0)
                    return;
                InventoryFolderBase f = (InventoryFolderBase)nodes[0];
                UUID IARRootID = f.ID;

                TraverseFolders(IARRootID, m_MockScene);
                FixParent(IARRootID, m_MockScene, m_service.LibraryRootFolderID);
                f.Name = iarFileName;
                f.ParentID = UUID.Zero;
                f.ID = m_service.LibraryRootFolderID;
                f.Type = (int)AssetType.RootFolder;
                f.Version = 1;
                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:JAllard,项目名称:Aurora-Sim,代码行数:92,代码来源:DefaultInventoryIARLoader.cs


示例12: RegionInfoStartupSorter

 private int RegionInfoStartupSorter(RegionInfo A, RegionInfo B)
 {
     return A.NumberStartup.CompareTo(B.NumberStartup);
 }
开发者ID:jbomhold3,项目名称:Aurora-Sim,代码行数:4,代码来源:LocalRegionInfoConnector.cs


示例13: GetRegionInfo

        public RegionInfo GetRegionInfo(string regionName)
        {
            QueryFilter filter = new QueryFilter();
            filter.andFilters["RegionName"] = regionName.MySqlEscape(50);
            List<string> RetVal = GD.Query(new[] { "RegionInfo" }, "simulator", filter, null, null, null);

            if (RetVal.Count == 0)
            {
                return null;
            }

            RegionInfo replyData = new RegionInfo();
            replyData.UnpackRegionInfoData((OSDMap)OSDParser.DeserializeJson(RetVal[0]));
            return replyData;
        }
开发者ID:jbomhold3,项目名称:Aurora-Sim,代码行数:15,代码来源:LocalRegionInfoConnector.cs


示例14: FixVariableSizedRegionTerrainSize

 private Bitmap FixVariableSizedRegionTerrainSize(RegionInfo region, Bitmap image)
 {
     if(region.RegionSizeX == Constants.RegionSize && region.RegionSizeY == Constants.RegionSize)
         return image;
     Bitmap destImage = new Bitmap(region.RegionSizeX, region.RegionSizeY);
     using (TextureBrush brush = new TextureBrush(image, WrapMode.Tile))
     using (Graphics g = Graphics.FromImage(destImage))
     {
         // do your painting in here
         g.FillRectangle(brush, 0, 0, destImage.Width, destImage.Height);
     }
     image.Dispose();
     return destImage;
 }
开发者ID:rjspence,项目名称:YourSim,代码行数:14,代码来源:WarpTileRenderer.cs


示例15: ChangeRegionInfo

        private void ChangeRegionInfo (RegionInfo region)
        {
            m_changingRegion = true;
            if (region == null)
            {
                button20.Enabled = false;
                CurrentRegionID = UUID.Zero;
                m_changingRegion = false;
                textBox11.Text = "";
                textBox6.Text = ""; 
                textBox4.Text = "";
                DisabledEdit.Checked = false;
                textBox7.Text = "";
                textBox3.Text = "";
                textBox5.Text = "";
                textBox1.Text = "";
                RegionSizeX.Text = "";
                RegionSizeY.Text = "";
                startupType.SelectedIndex = 0;
                einfiniteRegion.Checked = false;
                return;
            }
            button20.Enabled = true;
            CurrentRegionID = region.RegionID;
            textBox11.Text = region.RegionType;
            textBox6.Text = region.ObjectCapacity.ToString ();
            uint maturityLevel = Util.ConvertAccessLevelToMaturity (region.AccessLevel);
            if (maturityLevel == 0)
                textBox4.Text = "PG";
            else if (maturityLevel == 1)
                textBox4.Text = "Mature";
            else
                textBox4.Text = "Adult";
            DisabledEdit.Checked = region.Disabled;
#if (!ISWIN)
            textBox7.Text = string.Join(", ", region.UDPPorts.ConvertAll<string>(delegate(int i) { return i.ToString(); }).ToArray());
#else
            textBox7.Text = string.Join (", ", region.UDPPorts.ConvertAll (i => i.ToString()).ToArray ());
#endif
            textBox3.Text = (region.RegionLocX / Constants.RegionSize).ToString ();
            textBox5.Text = (region.RegionLocY / Constants.RegionSize).ToString ();
            textBox1.Text = region.RegionName;
            RegionSizeX.Text = region.RegionSizeX.ToString ();
            RegionSizeY.Text = region.RegionSizeY.ToString ();
            startupType.SelectedIndex = ConvertStartupType (region.Startup);
            einfiniteRegion.Checked = region.InfiniteRegion;
            IScene scene;
            if (m_sceneManager.TryGetScene (region.RegionID, out scene))
                SetOnlineStatus ();
            else
                SetOfflineStatus ();

            m_changingRegion = false;
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:54,代码来源:RegionManager.cs


示例16: DeleteRegion

        /// <summary>
        /// This deletes the region from the region.ini file or region.xml file and removes the file if there are no other regions in the file
        /// </summary>
        /// <param name="regionInfo"></param>
        public void DeleteRegion(RegionInfo regionInfo)
        {
            if (!String.IsNullOrEmpty(regionInfo.RegionFile))
            {
                if (regionInfo.RegionFile.ToLower().EndsWith(".xml"))
                {
                    File.Delete(regionInfo.RegionFile);
                    MainConsole.Instance.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", regionInfo.RegionFile);
                }
                if (regionInfo.RegionFile.ToLower().EndsWith(".ini"))
                {
                    try
                    {
                        IniConfigSource source = new IniConfigSource(regionInfo.RegionFile, Nini.Ini.IniFileType.AuroraStyle);
                        if (source.Configs[regionInfo.RegionName] != null)
                        {
                            source.Configs.Remove(regionInfo.RegionName);

                            if (source.Configs.Count == 0)
                            {
                                File.Delete(regionInfo.RegionFile);
                            }
                            else
                            {
                                source.Save(regionInfo.RegionFile);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:38,代码来源:RegionLoaderFileBasePlugin.cs


示例17: CreateNewRegion

        private void CreateNewRegion(object sender, EventArgs e)
        {
            if (RName.Text == "")
            {
                MessageBox.Show("You must enter a region name!");
                return;
            }
            RegionInfo region = new RegionInfo
                                    {
                                        RegionName = RName.Text,
                                        RegionID = UUID.Random(),
                                        RegionLocX = int.Parse(LocX.Text)*Constants.RegionSize,
                                        RegionLocY = int.Parse(LocY.Text)*Constants.RegionSize
                                    };

            IPAddress address = IPAddress.Parse("0.0.0.0");
            string[] ports = Port.Text.Split (',');
            
            foreach (string port in ports)
            {
                string tPort = port.Trim ();
                int iPort = 0;
                if (int.TryParse (tPort, out iPort))
                    region.UDPPorts.Add (iPort);
            }
            region.InternalEndPoint = new IPEndPoint (address, region.UDPPorts[0]);

            region.RegionType = Type.Text;
            region.ObjectCapacity = int.Parse(ObjectCount.Text);
            int maturityLevel = 0;
            if (!int.TryParse(Maturity.Text, out maturityLevel))
            {
                if (Maturity.Text == "Adult")
                    maturityLevel = 2;
                else if (Maturity.Text == "Mature")
                    maturityLevel = 1;
                else //Leave it as PG by default if they do not select a valid option
                    maturityLevel = 0;
            }
            region.RegionSettings.Maturity = maturityLevel;
            region.Disabled = DisabledEdit.Checked;
            region.RegionSizeX = int.Parse(CRegionSizeX.Text);
            region.RegionSizeY = int.Parse(CRegionSizeY.Text);
            if ((region.RegionSizeX % Constants.MinRegionSize) != 0 ||
                (region.RegionSizeY % Constants.MinRegionSize) != 0)
            {
                MessageBox.Show ("You must enter a valid region size (multiple of " + Constants.MinRegionSize + "!");
                return;
            }
            region.Startup = ConvertIntToStartupType(CStartupType.SelectedIndex);
            region.InfiniteRegion = cInfiniteRegion.Checked;

            _regionManager.UpdateRegionInfo(region);
            CopyOverDefaultRegion (region.RegionName);
            MessageBox.Show("You must now set up an estate for the new region");
            RefreshCurrentRegions();
            tabControl1.SelectedIndex = 2;
            estateRegionSelection.SelectedItem = region.RegionName;
            RegionHasBeenCreated = true;
            RegionCreatedID = region.RegionID;
        }
开发者ID:rjspence,项目名称:YourSim,代码行数:61,代码来源:RegionManager.cs


示例18: UpdateRegionInfo

        /// <summary>
        /// Save the changes to the RegionInfo to the file that it came from in the Regions/ directory
        /// </summary>
        /// <param name="oldName"></param>
        /// <param name="regionInfo"></param>
        public void UpdateRegionInfo(string oldName, RegionInfo regionInfo)
        {
            string regionConfigPath = Path.Combine(Util.configDir(), "Regions");

            if (oldName == "")
                oldName = regionInfo.RegionName;
            try
            {
                IConfig config = m_configSource.Configs["RegionStartup"];
                if (config != null)
                {
                    regionConfigPath = config.GetString("RegionsDirectory", regionConfigPath).Trim();
                }
            }
            catch (Exception)
            {
                // No INI setting recorded.
            }
            if (!Directory.Exists(regionConfigPath))
                return;

            string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
            foreach (string file in iniFiles)
            {
                IConfigSource source = new IniConfigSource(file, Nini.Ini.IniFileType.AuroraStyle);
                IConfig cnf = source.Configs[oldName];
                if (cnf != null)
                {
                    try
                    {
                        source.Configs.Remove(cnf);
                        cnf.Set("Location", regionInfo.RegionLocX / Constants.RegionSize + "," + regionInfo.RegionLocY / Constants.RegionSize);
                        cnf.Set("RegionType", regionInfo.RegionType);
                        cnf.Name = regionInfo.RegionName;
                        source.Configs.Add(cnf);
                    }
                    catch
                    {
                    }
                    source.Save();
                    break;
                }
            }
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:49,代码来源:RegionLoaderFileBasePlugin.cs


示例19: ReadNiniConfig

        //Returns true if the source should be updated. Returns false if it does not.
        public bool ReadNiniConfig(RegionInfo region, IConfigSource source, string name)
        {
            //            bool creatingNew = false;

            if (name == String.Empty || source.Configs.Count == 0)
            {
                MainConsole.Instance.Info ("=====================================\n");
                MainConsole.Instance.Info ("We are now going to ask a couple of questions about your region.\n");
                MainConsole.Instance.Info ("You can press 'enter' without typing anything to use the default\n");
                MainConsole.Instance.Info ("the default is displayed between [ ] brackets.\n");
                MainConsole.Instance.Info ("=====================================\n");
            }

            bool NeedsUpdate = false;
            if (name == String.Empty)
                name = MainConsole.Instance.Prompt("New region name", name);
            if (name == String.Empty)
                throw new Exception("Cannot interactively create region with no name");

            if (source.Configs.Count == 0)
            {
                source.AddConfig(name);

                //                creatingNew = true;
                NeedsUpdate = true;
            }

            if (source.Configs[name] == null)
            {
                source.AddConfig(name);
                NeedsUpdate = true;
                //                creatingNew = true;
            }

            IConfig config = source.Configs[name];

            // UUID
            //
            string regionUUID = config.GetString("RegionUUID", string.Empty);

            if (regionUUID == String.Empty)
            {
                NeedsUpdate = true;
                UUID newID = UUID.Random();

                regionUUID = MainConsole.Instance.Prompt("Region UUID for region " + name, newID.ToString());
                config.Set("RegionUUID", regionUUID);
            }

            region.RegionID = new UUID(regionUUID);

            region.RegionName = name;
            string location = config.GetString("Location", String.Empty);

            if (location == String.Empty)
            {
                NeedsUpdate = true;
                location = MainConsole.Instance.Prompt("Region Location for region " + name, "1000,1000");
                config.Set("Location", location);
            }

            string[] locationElements = location.Split(new[] { ',' });

            region.RegionLocX = Convert.ToInt32(locationElements[0]) * Constants.RegionSize;
            region.RegionLocY = Convert.ToInt32(locationElements[1]) * Constants.RegionSize;

            int regionSizeX = config.GetInt("RegionSizeX", 0);
            if (regionSizeX == 0 || ((region.RegionSizeX % Constants.MinRegionSize) != 0))
            {
                NeedsUpdate = true;
                while (true)
                {
                    if (int.TryParse(MainConsole.Instance.Prompt("Region X Size for region " + name, "256"), out regionSizeX))
                        break;
                }
                config.Set("RegionSizeX", regionSizeX);
            }
            region.RegionSizeX = Convert.ToInt32(regionSizeX);

            int regionSizeY = config.GetInt("RegionSizeY", 0);
            if (regionSizeY == 0 || ((region.RegionSizeY % Constants.MinRegionSize) != 0))
            {
                NeedsUpdate = true;
                while(true)
                {
                    if(int.TryParse(MainConsole.Instance.Prompt("Region Y Size for region " + name, "256"), out regionSizeY))
                        break;
                }
                config.Set("RegionSizeY", regionSizeY);
            }
            region.RegionSizeY = regionSizeY;

            int regionSizeZ = config.GetInt("RegionSizeZ", 1024);
            //if (regionSizeZ == String.Empty)
            //{
            //    NeedsUpdate = true;
            //    regionSizeZ = MainConsole.Instance.CmdPrompt("Region Z Size for region " + name, "1024");
            //    config.Set("RegionSizeZ", regionSizeZ);
            //}
//.........这里部分代码省略.........
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:101,代码来源:RegionLoaderFileBasePlugin.cs


示例20: LoadRegionFromFile

        // File based loading
        //
        public RegionInfo LoadRegionFromFile(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
        {
            // m_configSource = configSource;
            RegionInfo region = new RegionInfo();
            if (filename.ToLower().EndsWith(".ini"))
            {
                if (!File.Exists(filename)) // New region config request
                {
                    IniConfigSource newFile = new IniConfigSource();

                    region.RegionFile = filename;

                    ReadNiniConfig(region, newFile, configName);
                    newFile.Save(filename);

                    return region;
                }

                IniConfigSource m_source = new IniConfigSource(filename, Nini.Ini.IniFileType.AuroraStyle);

                bool saveFile = false;
                if (m_source.Configs[configName] == null)
                    saveFile = true;

                region.RegionFile = filename;

                bool update = ReadNiniConfig(region, m_source, configName);

                if (configName != String.Empty && (saveFile || update))
                    m_source.Save(filename);

                return region;
            }

            try
            {
                // This will throw if it's not legal Nini XML format
                // and thereby toss it to the legacy loader
                //
                IConfigSource xmlsource = new XmlConfigSource(filename);

                ReadNiniConfig(region, xmlsource, configName);

                region.RegionFile = filename;

                return region;
            }
            catch (Exception)
            {
            }
            return null;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:54,代码来源:RegionLoaderFileBasePlugin.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HttpServer.OSHttpRequest类代码示例发布时间:2022-05-24
下一篇:
C# Framework.QueryFilter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap