本文整理汇总了C#中OpenSim.Framework.RegionSettings.SpawnPoints方法的典型用法代码示例。如果您正苦于以下问题:C# RegionSettings.SpawnPoints方法的具体用法?C# RegionSettings.SpawnPoints怎么用?C# RegionSettings.SpawnPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.RegionSettings
的用法示例。
在下文中一共展示了RegionSettings.SpawnPoints方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveSpawnPoints
private void SaveSpawnPoints(RegionSettings rs)
{
string sql = @"DELETE 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();
cmd.ExecuteNonQuery();
}
foreach (SpawnPoint p in rs.SpawnPoints())
{
sql = @"INSERT INTO spawn_points (""RegionUUID"", ""Yaw"", ""Pitch"", ""Distance"") VALUES (:RegionUUID, :Yaw, :Pitch, :Distance)";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", rs.RegionUUID));
cmd.Parameters.Add(_Database.CreateParameter("Yaw", p.Yaw));
cmd.Parameters.Add(_Database.CreateParameter("Pitch", p.Pitch));
cmd.Parameters.Add(_Database.CreateParameter("Distance", p.Distance));
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
示例2: StoreSpawnPoints
public void StoreSpawnPoints(RegionSettings rs)
{
lock (ds)
{
// DataTable spawnpoints = ds.Tables["spawn_points"];
// remove region's spawnpoints
using (
SqliteCommand cmd =
new SqliteCommand("delete from spawn_points where RegionID=:RegionID",
m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString()));
cmd.ExecuteNonQuery();
}
}
foreach (SpawnPoint sp in rs.SpawnPoints())
{
using (SqliteCommand cmd = new SqliteCommand("insert into spawn_points(RegionID, Yaw, Pitch, Distance)" +
"values ( :RegionID, :Yaw, :Pitch, :Distance)", m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Yaw", sp.Yaw));
cmd.Parameters.Add(new SqliteParameter(":Pitch", sp.Pitch));
cmd.Parameters.Add(new SqliteParameter(":Distance", sp.Distance));
cmd.ExecuteNonQuery();
}
}
}
示例3: SaveSpawnPoints
private void SaveSpawnPoints(RegionSettings rs)
{
string sql = "DELETE FROM spawn_points WHERE RegionUUID = @RegionUUID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
conn.Open();
cmd.ExecuteNonQuery();
}
foreach (SpawnPoint p in rs.SpawnPoints())
{
sql = "INSERT INTO spawn_points (RegionUUID, Yaw, Pitch, Distance) VALUES (@RegionUUID, @Yaw, @Pitch, @Distance)";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("@RegionUUID", rs.RegionUUID));
cmd.Parameters.Add(_Database.CreateParameter("@Yaw", p.Yaw));
cmd.Parameters.Add(_Database.CreateParameter("@Pitch", p.Pitch));
cmd.Parameters.Add(_Database.CreateParameter("@Distance", p.Distance));
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
示例4: Serialize
public static string Serialize(RegionSettings settings)
{
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();
xtw.WriteStartElement("RegionSettings");
xtw.WriteStartElement("General");
xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString());
xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString());
xtw.WriteElementString("BlockFly", settings.BlockFly.ToString());
xtw.WriteElementString("BlockLandShowInSearch", settings.BlockShowInSearch.ToString());
xtw.WriteElementString("BlockTerraform", settings.BlockTerraform.ToString());
xtw.WriteElementString("DisableCollisions", settings.DisableCollisions.ToString());
xtw.WriteElementString("DisablePhysics", settings.DisablePhysics.ToString());
xtw.WriteElementString("DisableScripts", settings.DisableScripts.ToString());
xtw.WriteElementString("MaturityRating", settings.Maturity.ToString());
xtw.WriteElementString("RestrictPushing", settings.RestrictPushing.ToString());
xtw.WriteElementString("AgentLimit", settings.AgentLimit.ToString());
xtw.WriteElementString("ObjectBonus", settings.ObjectBonus.ToString());
xtw.WriteEndElement();
xtw.WriteStartElement("GroundTextures");
xtw.WriteElementString("Texture1", settings.TerrainTexture1.ToString());
xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString());
xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString());
xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString());
xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString());
xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString());
xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString());
xtw.WriteElementString("ElevationLowNE", settings.Elevation1NE.ToString());
xtw.WriteElementString("ElevationHighSW", settings.Elevation2SW.ToString());
xtw.WriteElementString("ElevationHighNW", settings.Elevation2NW.ToString());
xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString());
xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString());
xtw.WriteEndElement();
xtw.WriteStartElement("Terrain");
xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString());
xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString());
xtw.WriteElementString("TerrainLowerLimit", settings.TerrainLowerLimit.ToString());
xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString());
xtw.WriteElementString("FixedSun", settings.FixedSun.ToString());
xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
// Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
// calculates it automatically according to the date and other factors.
xtw.WriteEndElement();
xtw.WriteStartElement("Telehub");
if (settings.TelehubObject != UUID.Zero)
{
xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString());
foreach (SpawnPoint sp in settings.SpawnPoints())
xtw.WriteElementString("SpawnPoint", sp.ToString());
}
xtw.WriteEndElement();
xtw.WriteEndElement();
xtw.Close();
sw.Close();
return sw.ToString();
}