예제 #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);
 }
예제 #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));
         }
     }
 }
예제 #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);
                }
            }
        }