當前位置: 首頁>>代碼示例>>C#>>正文


C# Chunk.Save方法代碼示例

本文整理匯總了C#中Chunk.Save方法的典型用法代碼示例。如果您正苦於以下問題:C# Chunk.Save方法的具體用法?C# Chunk.Save怎麽用?C# Chunk.Save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Chunk的用法示例。


在下文中一共展示了Chunk.Save方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetChunk

        /// <summary>
        /// Saves an existing <see cref="Chunk"/> 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="Chunk"/> to save to the given location.</param>
        /// <returns>A <see cref="ChunkRef"/> represneting the <see cref="Chunk"/> 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="Chunk"/>'s internal global coordinates will be updated to reflect the new location.</remarks>
        public ChunkRef SetChunk(int lcx, int lcz, Chunk chunk)
        {
            if (!LocalBoundsCheck(lcx, lcz)) {
                Region 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;
        }
開發者ID:ThreeSevenths,項目名稱:Substrate,代碼行數:29,代碼來源:Region.cs

示例2: FlushChunk

 private void FlushChunk(Chunk chunk)
 {
     lock (_directory)
     {
         _cache.Seek(0, SeekOrigin.End);
         _directory.Add(_cache.Position);
         chunk.Save(_cache);
         _serializedRows += chunk.Count;
     }
 }
開發者ID:dbshell,項目名稱:dbshell,代碼行數:10,代碼來源:CdlFileStorage.cs

示例3: SaveChunk

 // XXX: Allows a chunk not part of this region to be saved to it
 /// <exclude/>
 public bool SaveChunk(Chunk 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)));
 }
開發者ID:ThreeSevenths,項目名稱:Substrate,代碼行數:7,代碼來源:Region.cs

示例4: DoSkylighting

        private void DoSkylighting(Chunk c)
        {
            int csx = (int)c.Size.X;
            int csz = (int)c.Size.Y;
            for (int _x = 0; _x < csx; _x++)
            {
                for (int _z = 0; _z < csz; _z++)
                {
                    int x = (int)(c.Position.X * csx) + _x;
                    int z = (int)(c.Position.Y * csz) + _z;
                    for (int y = 0; y < c.HeightMap[x, z]; y++)
                    {
                        byte currentSkyLight = c.SkyLight[x,y,z];

                        byte currentBlock = c.Blocks[x, y, z];

                        Block currentBlockInfo = OpenMinecraft.Blocks.Get(currentBlock);

                        // SUNLIGHT
                        currentSkyLight = (byte)(currentSkyLight - currentBlockInfo.Stop - 1);

                        if (currentSkyLight < 0) currentSkyLight = 0;
                        if (currentSkyLight > 15) currentSkyLight = 15;

                        c.SkyLight[x, y, z]=currentSkyLight;
                    }
                }
            }
            c.Save();
        }
開發者ID:N3X15,項目名稱:MineEdit,代碼行數:30,代碼來源:ShittyLighter.cs


注:本文中的Chunk.Save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。