Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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));
         }
     }
 }
Exemplo n.º 3
0
        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);
                }
            }
        }