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


C# RegionSettings.AddSpawnPoint方法代码示例

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


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

示例1: TestLoadOarRegionSettings

        public void TestLoadOarRegionSettings()
        {
            TestHelpers.InMethod();
            //log4net.Config.XmlConfigurator.Configure();

            MemoryStream archiveWriteStream = new MemoryStream();
            TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
            
            tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
            tar.WriteFile(
                ArchiveConstants.CONTROL_FILE_PATH,
                new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));

            RegionSettings rs = new RegionSettings();
            rs.AgentLimit = 17;
            rs.AllowDamage = true;
            rs.AllowLandJoinDivide = true;
            rs.AllowLandResell = true;
            rs.BlockFly = true;
            rs.BlockShowInSearch = true;
            rs.BlockTerraform = true;
            rs.DisableCollisions = true;
            rs.DisablePhysics = true;
            rs.DisableScripts = true;
            rs.Elevation1NW = 15.9;
            rs.Elevation1NE = 45.3;
            rs.Elevation1SE = 49;
            rs.Elevation1SW = 1.9;
            rs.Elevation2NW = 4.5;
            rs.Elevation2NE = 19.2;
            rs.Elevation2SE = 9.2;
            rs.Elevation2SW = 2.1;
            rs.FixedSun = true;
            rs.SunPosition = 12.0;
            rs.ObjectBonus = 1.4;
            rs.RestrictPushing = true;
            rs.TerrainLowerLimit = 0.4;
            rs.TerrainRaiseLimit = 17.9;
            rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020");
            rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040");
            rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060");
            rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
            rs.UseEstateSun = true;
            rs.WaterHeight = 23;
            rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
            rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));

            tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
            
            tar.Close();

            MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());

            lock (this)
            {
                m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
                m_archiverModule.DearchiveRegion(archiveReadStream);
            }
            
            Assert.That(m_lastErrorMessage, Is.Null);
            RegionSettings loadedRs = m_scene.RegionInfo.RegionSettings;

            Assert.That(loadedRs.AgentLimit, Is.EqualTo(17));
            Assert.That(loadedRs.AllowDamage, Is.True);
            Assert.That(loadedRs.AllowLandJoinDivide, Is.True);
            Assert.That(loadedRs.AllowLandResell, Is.True);
            Assert.That(loadedRs.BlockFly, Is.True);
            Assert.That(loadedRs.BlockShowInSearch, Is.True);
            Assert.That(loadedRs.BlockTerraform, Is.True);
            Assert.That(loadedRs.DisableCollisions, Is.True);
            Assert.That(loadedRs.DisablePhysics, Is.True);
            Assert.That(loadedRs.DisableScripts, Is.True);
            Assert.That(loadedRs.Elevation1NW, Is.EqualTo(15.9));
            Assert.That(loadedRs.Elevation1NE, Is.EqualTo(45.3));
            Assert.That(loadedRs.Elevation1SE, Is.EqualTo(49));
            Assert.That(loadedRs.Elevation1SW, Is.EqualTo(1.9));
            Assert.That(loadedRs.Elevation2NW, Is.EqualTo(4.5));
            Assert.That(loadedRs.Elevation2NE, Is.EqualTo(19.2));
            Assert.That(loadedRs.Elevation2SE, Is.EqualTo(9.2));
            Assert.That(loadedRs.Elevation2SW, Is.EqualTo(2.1));
            Assert.That(loadedRs.FixedSun, Is.True);
            Assert.AreEqual(12.0, loadedRs.SunPosition);
            Assert.That(loadedRs.ObjectBonus, Is.EqualTo(1.4));
            Assert.That(loadedRs.RestrictPushing, Is.True);
            Assert.That(loadedRs.TerrainLowerLimit, Is.EqualTo(0.4));
            Assert.That(loadedRs.TerrainRaiseLimit, Is.EqualTo(17.9));
            Assert.That(loadedRs.TerrainTexture1, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000020")));
            Assert.That(loadedRs.TerrainTexture2, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000040")));
            Assert.That(loadedRs.TerrainTexture3, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000060")));
            Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080")));
            Assert.That(loadedRs.UseEstateSun, Is.True);
            Assert.That(loadedRs.WaterHeight, Is.EqualTo(23));
            Assert.AreEqual(UUID.Zero, loadedRs.TelehubObject); // because no object was found with the original UUID
            Assert.AreEqual(0, loadedRs.SpawnPoints().Count);
        }
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:95,代码来源:ArchiverTests.cs

示例2: LoadSpawnPoints

        private void LoadSpawnPoints(RegionSettings rs)
        {
            rs.ClearSpawnPoints();

            string sql = @"SELECT ""Yaw"", ""Pitch"", ""Distance"" FROM spawn_points WHERE ""RegionUUID"" = :RegionUUID";

            using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
            using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
            {
                cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", rs.RegionUUID));
                conn.Open();
                using (NpgsqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        SpawnPoint sp = new SpawnPoint();

                        sp.Yaw = (float)reader["Yaw"];
                        sp.Pitch = (float)reader["Pitch"];
                        sp.Distance = (float)reader["Distance"];

                        rs.AddSpawnPoint(sp);
                    }
                }
            }
        }
开发者ID:TomDataworks,项目名称:opensim,代码行数:26,代码来源:PGSQLSimulationData.cs

示例3: LoadSpawnPoints

        private void LoadSpawnPoints(RegionSettings rs)
        {
            rs.ClearSpawnPoints();

            DataTable spawnpoints = ds.Tables["spawn_points"];
            string byRegion = "RegionID = '" + rs.RegionUUID + "'";
            DataRow[] spForRegion = spawnpoints.Select(byRegion);

            foreach (DataRow spRow in spForRegion)
            {
                SpawnPoint sp = new SpawnPoint();
                sp.Pitch = (float)spRow["Pitch"];
                sp.Yaw = (float)spRow["Yaw"];
                sp.Distance = (float)spRow["Distance"];

                rs.AddSpawnPoint(sp);
            }
        }
开发者ID:p07r0457,项目名称:opensim,代码行数:18,代码来源:SQLiteSimulationData.cs

示例4: Setup

 public void Setup()
 {
     m_rs = new RegionSettings();
     m_rs.AgentLimit = 17;
     m_rs.AllowDamage = true;
     m_rs.AllowLandJoinDivide = true;
     m_rs.AllowLandResell = true;
     m_rs.BlockFly = true;
     m_rs.BlockShowInSearch = true;
     m_rs.BlockTerraform = true;
     m_rs.DisableCollisions = true;
     m_rs.DisablePhysics = true;
     m_rs.DisableScripts = true;
     m_rs.Elevation1NW = 15.9;
     m_rs.Elevation1NE = 45.3;
     m_rs.Elevation1SE = 49;
     m_rs.Elevation1SW = 1.9;
     m_rs.Elevation2NW = 4.5;
     m_rs.Elevation2NE = 19.2;
     m_rs.Elevation2SE = 9.2;
     m_rs.Elevation2SW = 2.1;
     m_rs.FixedSun = true;
     m_rs.SunPosition = 12.0;
     m_rs.ObjectBonus = 1.4;
     m_rs.RestrictPushing = true;
     m_rs.TerrainLowerLimit = 0.4;
     m_rs.TerrainRaiseLimit = 17.9;
     m_rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020");
     m_rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040");
     m_rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060");
     m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
     m_rs.UseEstateSun = true;
     m_rs.WaterHeight = 23;
     m_rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
     m_rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));
 }
开发者ID:JAllard,项目名称:opensim,代码行数:36,代码来源:RegionSettingsSerializerTests.cs

示例5: Deserialize


//.........这里部分代码省略.........
            xtr.ReadStartElement("GroundTextures");
            
            while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
            {
                switch (xtr.Name)
                {
                    case "Texture1":
                        settings.TerrainTexture1 = UUID.Parse(xtr.ReadElementContentAsString());
                        break;
                    case "Texture2":
                        settings.TerrainTexture2 = UUID.Parse(xtr.ReadElementContentAsString());
                        break;
                    case "Texture3":
                        settings.TerrainTexture3 = UUID.Parse(xtr.ReadElementContentAsString());
                        break;
                    case "Texture4":
                        settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString());
                        break;
                    case "ElevationLowSW":
                        settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationLowNW":
                        settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationLowSE":
                        settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationLowNE":
                        settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationHighSW":
                        settings.Elevation2SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationHighNW":
                        settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationHighSE":
                        settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "ElevationHighNE":
                        settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                }
            }
           
            xtr.ReadEndElement();
            xtr.ReadStartElement("Terrain");
            
            while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
            {
                switch (xtr.Name)
                {
                    case "WaterHeight":
                        settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "TerrainRaiseLimit":
                        settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "TerrainLowerLimit":
                        settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo);
                        break;
                    case "UseEstateSun":
                        settings.UseEstateSun = bool.Parse(xtr.ReadElementContentAsString());
                        break;
                    case "FixedSun":
                        settings.FixedSun = bool.Parse(xtr.ReadElementContentAsString());
                        break;
                    case "SunPosition":
                        settings.SunPosition = double.Parse(xtr.ReadElementContentAsString());
                        break;
                }
            }

            xtr.ReadEndElement();

            if (xtr.IsStartElement("Telehub"))
            {
                xtr.ReadStartElement("Telehub");

                while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
                {
                    switch (xtr.Name)
                    {
                        case "TelehubObject":
                            settings.TelehubObject = UUID.Parse(xtr.ReadElementContentAsString());
                            break;
                        case "SpawnPoint":
                            string str = xtr.ReadElementContentAsString();
                            SpawnPoint sp = SpawnPoint.Parse(str);
                            settings.AddSpawnPoint(sp);
                            break;
                    }
                }
            }

            xtr.Close();
            sr.Close();
            
            return settings;
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:101,代码来源:RegionSettingsSerializer.cs


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