private void SaveObject(DataFileWriter writer, GameObject o) { writer.WriteWord(o.Graphics.Index); writer.WriteByte(o.Graphics.Color1); writer.WriteByte(o.Graphics.Color2); writer.WriteByte(o.Graphics.Color3); writer.WriteBytes(o.Bytes); }
private void SaveLayer(DataFileWriter writer, MapLayer layer) { for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { SaveObject(writer, layer.GetObject(x, y)); } } }
public void Save(string filename) { using (DataFileWriter writer = new DataFileWriter(filename)) { writer.WriteString(Name); writer.WriteByte(BackColor); writer.WriteBytes(Bytes); writer.WriteByte(Width); writer.WriteByte(Height); writer.WriteByte(Layers.Count); foreach (MapLayer layer in Layers) { SaveLayer(writer, layer); } } }