// Token: 0x060000A1 RID: 161 RVA: 0x00003918 File Offset: 0x00001B18
        public void ReadFrom(VarLenBinaryReader reader)
        {
            uint num  = reader.ReadVarLen32();
            int  num2 = 0;

            while ((long)num2 < (long)((ulong)num))
            {
                this.TileIdMap.Add(reader.ReadVarLen32(), reader.ReadVarLen32());
                num2++;
            }
            num = reader.ReadVarLen32();
            int num3 = 0;

            while ((long)num3 < (long)((ulong)num))
            {
                this.ObjectIdMap.Add(reader.ReadVarLen32(), reader.ReadVarLen32());
                num3++;
            }
            num = reader.ReadVarLen32();
            int num4 = 0;

            while ((long)num4 < (long)((ulong)num))
            {
                this.RegionMap.Add(reader.ReadVarLen32(), reader.ReadString());
                num4++;
            }
        }
Ejemplo n.º 2
0
        // Token: 0x06000153 RID: 339 RVA: 0x0000570C File Offset: 0x0000390C
        public static TileMap Load(Stream stream)
        {
            TileMap result;

            using (DeflateStream deflateStream = new DeflateStream(stream, CompressionMode.Decompress, true))
            {
                VarLenBinaryReader varLenBinaryReader = new VarLenBinaryReader(deflateStream);
                if (varLenBinaryReader.ReadByte() != 1)
                {
                    throw new InvalidDataException("Invalid BMap version.");
                }
                TileMap tileMap = new TileMap(varLenBinaryReader.ReadVarLen32(), varLenBinaryReader.ReadVarLen32());
                DeserializationContext deserializationContext = new DeserializationContext();
                deserializationContext.ReadFrom(varLenBinaryReader);
                uint width  = tileMap.Width;
                uint height = tileMap.Height;
                MapTile[,] tiles = tileMap.Tiles;
                int num = 0;
                while ((long)num < (long)((ulong)height))
                {
                    int num2 = 0;
                    while ((long)num2 < (long)((ulong)width))
                    {
                        MapTile.ReadFrom(ref tiles[num2, num], varLenBinaryReader, deserializationContext);
                        num2++;
                    }
                    num++;
                }
                result = tileMap;
            }
            return(result);
        }
Ejemplo n.º 3
0
        // Token: 0x06000149 RID: 329 RVA: 0x00005568 File Offset: 0x00003768
        internal MapObject ReadFrom(VarLenBinaryReader reader, DeserializationContext ctx)
        {
            this.ObjectType = ctx.GetObjectId(reader.ReadVarLen32());
            uint num = reader.ReadVarLen32();

            this.Attributes = ((num == 0u) ? Empty <KeyValuePair <string, string> > .Array : new KeyValuePair <string, string> [num]);
            for (int i = 0; i < this.Attributes.Length; i++)
            {
                this.Attributes[i] = new KeyValuePair <string, string>(reader.ReadString(), reader.ReadString());
            }
            return(this);
        }
Ejemplo n.º 4
0
        // Token: 0x060001A8 RID: 424 RVA: 0x0000629C File Offset: 0x0000449C
        internal static void ReadFrom(ref MapTile tile, VarLenBinaryReader reader, DeserializationContext ctx)
        {
            tile.TileType  = ctx.GetTileId(reader.ReadVarLen32());
            tile.Biome     = (MapBiome)reader.ReadVarLen32();
            tile.Elevation = reader.ReadSingle();
            tile.Moisture  = reader.ReadSingle();
            uint num = reader.ReadVarLen32();

            tile.Objects = ((num == 0u) ? Empty <MapObject> .Array : new MapObject[num]);
            for (int i = 0; i < tile.Objects.Length; i++)
            {
                tile.Objects[i] = new MapObject().ReadFrom(reader, ctx);
            }
            tile.Region = ctx.GetRegionId(reader.ReadVarLen32());
        }