public SaveData toSaveData() { ChunkManagerData data = new ChunkManagerData(); foreach (KeyValuePair <Vector2Int, ID> vecID in this.allChunkIDs) { Vector2IntData vecData = new Vector2IntData(); vecData.SaveData(vecID.Key); data.allChunkIDs.Add(vecData, vecID.Value); } return(data); }
public void fromSaveData(SaveData chunkManagerData) { Debug.Log("读取ChunkManager"); allChunkIDs = new Dictionary <Vector2Int, ID>(); allChunks = new Dictionary <Vector2Int, Chunk>(); currentChunks = new List <Chunk>(); ChunkManagerData data = (ChunkManagerData)chunkManagerData; foreach (KeyValuePair <Vector2IntData, ID> vecID in data.allChunkIDs) { this.allChunkIDs.Add(vecID.Key.GetData(), vecID.Value); } }