Пример #1
0
 /// <summary>
 /// Serialize a chunk.
 /// </summary>
 /// <param name="chunk">The chunk to serialize.</param>
 /// <param name="chunkIndex">The chunk index.</param>
 public void SerialiseChunk(Chunk chunk, Position chunkIndex)
 {
     // NOTE: This should occur in a seperate thread, since terrain serialization isn't high priority.
     // However, care should be taken to consider the situation when a terrain is being serialized in another thread
     // and then a new deserialization request comes in for that chunk. In this case the deserialization thread
     // should block
 }
Пример #2
0
        /// <summary>
        /// Attempt to deserialise a chunk.
        /// </summary>
        /// <param name="chunkIndex">The chunk index.</param>
        /// <param name="chunk">The deserialised chunk.</param>
        /// <returns>True if chunk was deserialised; False if a serialization file does not exist for chunk.</returns>
        public bool TryDeserialiseChunk(Position chunkIndex, out Chunk chunk)
        {
            string chunkFile;
            if (!this.chunkFiles.TryGetValue(chunkIndex, out chunkFile))
            {
                // A chunk file doesn't exist for the given chunk
                chunk = null;
                return false;
            }

            // TODO: Deserialize the file
            throw new NotImplementedException("Chunk deserialization is not yet implemented.");
        }