當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。