本文整理汇总了C#中UltimaXNA.Ultima.World.Maps.Map.GetMapChunk方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetMapChunk方法的具体用法?C# Map.GetMapChunk怎么用?C# Map.GetMapChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UltimaXNA.Ultima.World.Maps.Map
的用法示例。
在下文中一共展示了Map.GetMapChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClick
void OnClick()
{
Directory.CreateDirectory("Chunks");
IsometricLighting lighting = new IsometricLighting();
MouseOverList mouseOverNull = new MouseOverList(new MousePicking());
SpriteBatch3D spritebatch = Service.Get<SpriteBatch3D>();
RenderTarget2D render = new RenderTarget2D(spritebatch.GraphicsDevice, Width + WidthExtra * 2, Height + HeightExtra * 2 + HeightExtra2);
Map map = new Map(0);
for (int chunky = 0; chunky < 10; chunky++)
{
for (int chunkx = 0; chunkx < 10; chunkx++)
{
spritebatch.GraphicsDevice.SetRenderTarget(render);
spritebatch.Reset();
uint cx = (uint)chunkx + 200;
uint cy = (uint)chunky + 200;
map.CenterPosition = new Point((int)(cx << 3), (int)(cy << 3));
MapChunk chunk = map.GetMapChunk(cx, cy);
chunk.LoadStatics(map.MapData, map);
int z = 0;
for (int i = 0; i < 64; i++)
{
int y = (i / 8);
int x = (i % 8);
int sy = y * 22 + x * 22 + HeightExtra + HeightExtra2;
int sx = 22 * 8 - y * 22 + x * 22 + WidthExtra;
MapTile tile = chunk.Tiles[i];
tile.ForceSort();
for (int j = 0; j < tile.Entities.Count; j++)
{
AEntity e = tile.Entities[j];
AEntityView view = e.GetView();
view.Draw(spritebatch, new Vector3(sx, sy, 0), mouseOverNull, map, false);
}
}
spritebatch.SetLightIntensity(lighting.IsometricLightLevel);
spritebatch.SetLightDirection(lighting.IsometricLightDirection);
spritebatch.GraphicsDevice.Clear(Color.Transparent);
spritebatch.FlushSprites(true);
spritebatch.GraphicsDevice.SetRenderTarget(null);
render.SaveAsPng(new FileStream($"Chunks/{cy}-{cx}.png", FileMode.Create), render.Width, render.Height);
}
}
}
示例2: InternalQueueMapBlock
private void InternalQueueMapBlock(Map map, uint cellx, uint celly)
{
uint chunkIndex = (cellx % BlockCacheWidth) + (celly % BlockCacheHeight) * BlockCacheWidth;
MiniMapChunk chunk = m_BlockCache[chunkIndex];
if (chunk == null || chunk.X != cellx || chunk.Y != celly)
{
// the chunk is not in our cache! Try loading it from the map?
MapChunk mapBlock = map.GetMapChunk(cellx, celly);
if (mapBlock == null)
{
// if the chunk is not loaded in memory, load it from the filesystem.
m_BlockCache[chunkIndex] = new MiniMapChunk(cellx, celly, map.MapData);
}
else
{
// get the colors for this chunk from the map chunk, which will have already sorted the objects.
m_BlockCache[chunkIndex] = new MiniMapChunk(mapBlock);
}
}
else
{
m_BlockColors = chunk.Colors;
}
m_QueuedToDrawBlocks.Add(chunkIndex);
}