本文整理汇总了C#中OpenSim.Framework.RegionSettings类的典型用法代码示例。如果您正苦于以下问题:C# RegionSettings类的具体用法?C# RegionSettings怎么用?C# RegionSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionSettings类属于OpenSim.Framework命名空间,在下文中一共展示了RegionSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreRegionSettings
public void StoreRegionSettings(RegionSettings rs)
{
RegionSettings oldRegionSettings = (RegionSettings)manager.Get(typeof(RegionSettings), rs.RegionUUID);
if (oldRegionSettings != null)
{
manager.Update(rs);
}
else
{
manager.Insert(rs);
}
}
示例2: UnpackRegionInfoData
public void UnpackRegionInfoData(OSDMap args)
{
if (args.ContainsKey("region_id"))
RegionID = args["region_id"].AsUUID();
if (args.ContainsKey("region_name"))
RegionName = args["region_name"].AsString();
if (args.ContainsKey("external_host_name"))
ExternalHostName = args["external_host_name"].AsString();
if (args.ContainsKey("http_port"))
UInt32.TryParse(args["http_port"].AsString(), out m_httpPort);
if (args.ContainsKey("region_xloc"))
{
int locx;
Int32.TryParse(args["region_xloc"].AsString(), out locx);
RegionLocX = locx;
}
if (args.ContainsKey("region_yloc"))
{
int locy;
Int32.TryParse(args["region_yloc"].AsString(), out locy);
RegionLocY = locy;
}
IPAddress ip_addr = null;
if (args.ContainsKey("internal_ep_address"))
{
IPAddress.TryParse(args["internal_ep_address"].AsString(), out ip_addr);
}
int port = 0;
if (args.ContainsKey("internal_ep_port"))
{
Int32.TryParse(args["internal_ep_port"].AsString(), out port);
}
InternalEndPoint = new IPEndPoint(ip_addr, port);
if (args.ContainsKey("allow_alt_ports"))
m_allow_alternate_ports = args["allow_alt_ports"].AsBoolean();
if (args.ContainsKey("region_type"))
m_regionType = args["region_type"].AsString();
if (args.ContainsKey("password"))
Password = args["password"].AsUUID();
if (args.ContainsKey("disabled"))
Disabled = args["disabled"].AsBoolean();
if (args.ContainsKey("scope_id"))
ScopeID = args["scope_id"].AsUUID();
if (args.ContainsKey("region_size_x"))
RegionSizeX = args["region_size_x"].AsInteger();
if (args.ContainsKey("region_size_y"))
RegionSizeY = args["region_size_y"].AsInteger();
if (args.ContainsKey("region_size_z"))
RegionSizeZ = args["region_size_z"].AsInteger();
if (args.ContainsKey("object_capacity"))
m_objectCapacity = args["object_capacity"].AsInteger();
if (args.ContainsKey("region_type"))
RegionType = args["region_type"].AsString();
if (args.ContainsKey("see_into_this_sim_from_neighbor"))
SeeIntoThisSimFromNeighbor = args["see_into_this_sim_from_neighbor"].AsBoolean();
if (args.ContainsKey("trust_binaries_from_foreign_sims"))
TrustBinariesFromForeignSims = args["trust_binaries_from_foreign_sims"].AsBoolean();
if (args.ContainsKey("allow_script_crossing"))
AllowScriptCrossing = args["allow_script_crossing"].AsBoolean();
if (args.ContainsKey("allow_physical_prims"))
AllowPhysicalPrims = args["allow_physical_prims"].AsBoolean();
if(args.ContainsKey("number_startup"))
NumberStartup = args["number_startup"].AsInteger();
if (args.ContainsKey ("startupType"))
Startup = (StartupType)args["startupType"].AsInteger();
FindExternalAutomatically = args["FindExternalIP"].AsBoolean();
if (args.ContainsKey("RegionSettings"))
{
RegionSettings = new RegionSettings();
RegionSettings.FromOSD((OSDMap)args["RegionSettings"]);
}
}
示例3: 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());
// XXX: Need to expose interface to get sun phase information from sun module
// xtw.WriteStartElement("SunPhase",
xtw.WriteEndElement();
xtw.WriteEndElement();
xtw.Close();
sw.Close();
return sw.ToString();
}
示例4: 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);
}
示例5: StoreNewRegionSettings
/// <summary>
/// Stores new regionsettings.
/// </summary>
/// <param name="regionSettings">The region settings.</param>
private void StoreNewRegionSettings(RegionSettings regionSettings)
{
string sql = @"INSERT INTO regionsettings
(""regionUUID"",block_terraform,block_fly,allow_damage,restrict_pushing,allow_land_resell,allow_land_join_divide,
block_show_in_search,agent_limit,object_bonus,maturity,disable_scripts,disable_collisions,disable_physics,
terrain_texture_1,terrain_texture_2,terrain_texture_3,terrain_texture_4,elevation_1_nw,elevation_2_nw,elevation_1_ne,
elevation_2_ne,elevation_1_se,elevation_2_se,elevation_1_sw,elevation_2_sw,water_height,terrain_raise_limit,
terrain_lower_limit,use_estate_sun,fixed_sun,sun_position,covenant,covenant_datetime,sunvectorx, sunvectory, sunvectorz,
""Sandbox"", loaded_creation_datetime, loaded_creation_id,block_search,casino
)
VALUES
(:regionUUID,:block_terraform,:block_fly,:allow_damage,:restrict_pushing,:allow_land_resell,:allow_land_join_divide,
:block_show_in_search,:agent_limit,:object_bonus,:maturity,:disable_scripts,:disable_collisions,:disable_physics,
:terrain_texture_1,:terrain_texture_2,:terrain_texture_3,:terrain_texture_4,:elevation_1_nw,:elevation_2_nw,:elevation_1_ne,
:elevation_2_ne,:elevation_1_se,:elevation_2_se,:elevation_1_sw,:elevation_2_sw,:water_height,:terrain_raise_limit,
:terrain_lower_limit,:use_estate_sun,:fixed_sun,:sun_position,:covenant, :covenant_datetime, :sunvectorx,:sunvectory,
:sunvectorz, :Sandbox, :loaded_creation_datetime, :loaded_creation_id, :block_search, :casino )";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
conn.Open();
cmd.ExecuteNonQuery();
}
}
示例6: 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);
}
}
}
}
示例7: StoreRegionSettings
public void StoreRegionSettings(RegionSettings rs)
{
}
示例8: StoreRegionSettings
/// <summary>
/// Store region settings, need to check if the check is really necesary. If we can make something for creating new region.
/// </summary>
/// <param name="regionSettings">region settings.</param>
public void StoreRegionSettings(RegionSettings regionSettings)
{
//Little check if regionUUID already exist in DB
string regionUUID;
string sql = @"SELECT ""regionUUID"" FROM regionsettings WHERE ""regionUUID"" = :regionUUID";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.Add(_Database.CreateParameter("regionUUID", regionSettings.RegionUUID));
conn.Open();
regionUUID = cmd.ExecuteScalar().ToString();
}
if (string.IsNullOrEmpty(regionUUID))
{
StoreNewRegionSettings(regionSettings);
}
else
{
//This method only updates region settings!!! First call LoadRegionSettings to create new region settings in DB
sql =
@"UPDATE regionsettings SET block_terraform = :block_terraform ,block_fly = :block_fly ,allow_damage = :allow_damage
,restrict_pushing = :restrict_pushing ,allow_land_resell = :allow_land_resell ,allow_land_join_divide = :allow_land_join_divide
,block_show_in_search = :block_show_in_search ,agent_limit = :agent_limit ,object_bonus = :object_bonus ,maturity = :maturity
,disable_scripts = :disable_scripts ,disable_collisions = :disable_collisions ,disable_physics = :disable_physics
,terrain_texture_1 = :terrain_texture_1 ,terrain_texture_2 = :terrain_texture_2 ,terrain_texture_3 = :terrain_texture_3
,terrain_texture_4 = :terrain_texture_4 ,elevation_1_nw = :elevation_1_nw ,elevation_2_nw = :elevation_2_nw
,elevation_1_ne = :elevation_1_ne ,elevation_2_ne = :elevation_2_ne ,elevation_1_se = :elevation_1_se ,elevation_2_se = :elevation_2_se
,elevation_1_sw = :elevation_1_sw ,elevation_2_sw = :elevation_2_sw ,water_height = :water_height ,terrain_raise_limit = :terrain_raise_limit
,terrain_lower_limit = :terrain_lower_limit ,use_estate_sun = :use_estate_sun ,fixed_sun = :fixed_sun ,sun_position = :sun_position
,covenant = :covenant ,covenant_datetime = :covenant_datetime, sunvectorx = :sunvectorx, sunvectory = :sunvectory, sunvectorz = :sunvectorz,
""Sandbox"" = :Sandbox, loaded_creation_datetime = :loaded_creation_datetime, loaded_creation_id = :loaded_creation_id, ""map_tile_ID"" = :TerrainImageID, ""block_search"" = :block_search, ""casino"" = :casino,
""TelehubObject"" = :telehubobject, ""parcel_tile_ID"" = :ParcelImageID
WHERE ""regionUUID"" = :regionUUID";
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
{
cmd.Parameters.AddRange(CreateRegionSettingParameters(regionSettings));
conn.Open();
cmd.ExecuteNonQuery();
}
}
SaveSpawnPoints(regionSettings);
}
示例9: LoadRegionSettings
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = new RegionSettings();
rs.RegionUUID = regionUUID;
return rs;
}
示例10: StoreRegionSettings
public void StoreRegionSettings(RegionSettings rs)
{
throw new NotImplementedException();
}
示例11: LoadRegionSettings
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings regionSettings = (RegionSettings) manager.Get(typeof(RegionSettings), regionUUID);
if (regionSettings == null)
{
regionSettings = new RegionSettings();
regionSettings.RegionUUID = regionUUID;
manager.Insert(regionSettings);
}
regionSettings.OnSave += StoreRegionSettings;
return regionSettings;
}
示例12: StoreRegionSettings
public void StoreRegionSettings(RegionSettings rs)
{
lock (ds)
{
DataTable regionsettings = ds.Tables["regionsettings"];
DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
if (settingsRow == null)
{
settingsRow = regionsettings.NewRow();
fillRegionSettingsRow(settingsRow, rs);
regionsettings.Rows.Add(settingsRow);
}
else
{
fillRegionSettingsRow(settingsRow, rs);
}
Commit();
}
}
示例13: 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();
}
}
}
示例14: LoadRegionSettings
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
lock (ds)
{
DataTable regionsettings = ds.Tables["regionsettings"];
string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
DataRow[] rawsettings = regionsettings.Select(searchExp);
if (rawsettings.Length == 0)
{
RegionSettings rs = new RegionSettings();
rs.RegionUUID = regionUUID;
rs.OnSave += StoreRegionSettings;
StoreRegionSettings(rs);
return rs;
}
DataRow row = rawsettings[0];
RegionSettings newSettings = buildRegionSettings(row);
newSettings.OnSave += StoreRegionSettings;
return newSettings;
}
}
示例15: LoadRegionSettings
/// <summary>
/// Loads the settings of a region.
/// </summary>
/// <param name="regionUUID">The region UUID.</param>
/// <returns></returns>
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
string sql = "select * from regionsettings where regionUUID = @regionUUID";
RegionSettings regionSettings;
using (AutoClosingSqlCommand cmd = _Database.Query(sql))
{
cmd.Parameters.Add(_Database.CreateParameter("@regionUUID", regionUUID));
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
regionSettings = BuildRegionSettings(reader);
regionSettings.OnSave += StoreRegionSettings;
return regionSettings;
}
}
}
//If comes here then there is now region setting for that region
regionSettings = new RegionSettings();
regionSettings.RegionUUID = regionUUID;
regionSettings.OnSave += StoreRegionSettings;
//Store new values
StoreNewRegionSettings(regionSettings);
return regionSettings;
}