本文整理汇总了C#中ITerrainChannel.GetSerialised方法的典型用法代码示例。如果您正苦于以下问题:C# ITerrainChannel.GetSerialised方法的具体用法?C# ITerrainChannel.GetSerialised怎么用?C# ITerrainChannel.GetSerialised使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITerrainChannel
的用法示例。
在下文中一共展示了ITerrainChannel.GetSerialised方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadWorldWaterMap
/// <summary>
/// Loads the World heightmap
/// </summary>
public void LoadWorldWaterMap()
{
if (!m_use3DWater)
return;
try
{
short[] map = m_scene.SimulationDataService.LoadWater(m_scene.RegionInfo.RegionID, false, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
if (map == null)
{
m_log.Info("[TERRAIN]: No default water. Generating a new water.");
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
}
else
{
m_channel = new TerrainChannel(map, m_scene);
}
}
catch (IOException e)
{
m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
if (m_scene.RegionInfo.RegionSizeX != Constants.RegionSize || m_scene.RegionInfo.RegionSizeY != Constants.RegionSize)
{
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
}
}
catch (IndexOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
}
catch (ArgumentOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
}
catch (Exception e)
{
m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString());
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
}
LoadRevertWaterMap();
}
示例2: WriteTerrainToStream
private static byte[] WriteTerrainToStream(ITerrainChannel tModule)
{
int tMapSize = tModule.Height*tModule.Height;
byte[] sdata = new byte[tMapSize*2];
Buffer.BlockCopy(tModule.GetSerialised(), 0, sdata, 0, sdata.Length);
return sdata;
}
示例3: LoadRevertWaterMap
/// <summary>
/// Loads the World Revert heightmap
/// </summary>
public void LoadRevertWaterMap()
{
try
{
short[] map = m_scene.SimulationDataService.LoadWater(m_scene.RegionInfo.RegionID, true, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
if (map == null)
{
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
}
else
{
m_waterRevert = new TerrainChannel(map, m_scene);
}
}
catch (IOException e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
if (m_scene.RegionInfo.RegionSizeX != Constants.RegionSize || m_scene.RegionInfo.RegionSizeY != Constants.RegionSize)
{
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
}
}
catch (IndexOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
}
catch (ArgumentOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
}
catch (Exception e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString());
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
}
}