示例#1
0
        private void LoadObject(DataFileReader reader, MapLayer layer, int x, int y)
        {
            GameObject o = new GameObject();

            o.Graphics.Index  = reader.ReadWord();
            o.Graphics.Color1 = reader.ReadByte();
            o.Graphics.Color2 = reader.ReadByte();
            o.Graphics.Color3 = reader.ReadByte();
            o.Bytes           = reader.ReadBytes();

            layer.SetObject(x, y, o);
        }
示例#2
0
        private void LoadLayer(DataFileReader reader)
        {
            MapLayer layer = new MapLayer(CommonWidth, CommonHeight);

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++)
                {
                    LoadObject(reader, layer, x, y);
                }
            }

            Layers.Add(layer);
        }
示例#3
0
        public void Load(string filename)
        {
            Clear();

            using (DataFileReader reader = new DataFileReader(filename))
            {
                Name      = reader.ReadString();
                BackColor = reader.ReadByte();
                Bytes     = reader.ReadBytes();

                CommonWidth  = reader.ReadByte();
                CommonHeight = reader.ReadByte();

                int layerCount = reader.ReadByte();
                for (int i = 0; i < layerCount; i++)
                {
                    LoadLayer(reader);
                }
            }
        }