本文整理汇总了C#中IChunk.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IChunk.Save方法的具体用法?C# IChunk.Save怎么用?C# IChunk.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IChunk
的用法示例。
在下文中一共展示了IChunk.Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetChunk
/// <summary>
/// Saves an existing <see cref="IChunk"/> to the region at the given local coordinates.
/// </summary>
/// <param name="lcx">The local X-coordinate of a chunk relative to this region.</param>
/// <param name="lcz">The local Z-coordinate of a chunk relative to this region.</param>
/// <param name="chunk">A <see cref="IChunk"/> to save to the given location.</param>
/// <returns>A <see cref="ChunkRef"/> represneting the <see cref="IChunk"/> at its new location.</returns>
/// <remarks>If the local coordinates are out of bounds for this region, the action will be forwarded to the correct region
/// transparently. The <see cref="IChunk"/>'s internal global coordinates will be updated to reflect the new location.</remarks>
public ChunkRef SetChunk(int lcx, int lcz, IChunk chunk)
{
if (!LocalBoundsCheck(lcx, lcz)) {
IRegion alt = GetForeignRegion(lcx, lcz);
return (alt == null) ? null : alt.CreateChunk(ForeignX(lcx), ForeignZ(lcz));
}
DeleteChunk(lcx, lcz);
int cx = lcx + _rx * XDIM;
int cz = lcz + _rz * ZDIM;
chunk.SetLocation(cx, cz);
chunk.Save(GetChunkOutStream(lcx, lcz));
ChunkRef cr = ChunkRef.Create(this, lcx, lcz);
_cache.Insert(cr);
return cr;
}
示例2: SaveChunk
// XXX: Allows a chunk not part of this region to be saved to it
/// <exclude/>
public bool SaveChunk(IChunk chunk)
{
//Console.WriteLine("Region[{0}, {1}].Save({2}, {3})", _rx, _rz, ForeignX(chunk.X),ForeignZ(chunk.Z));
return chunk.Save(GetChunkOutStream(ForeignX(chunk.X), ForeignZ(chunk.Z)));
}