public override void Serialize(IDataWriter writer)
 {
     writer.WriteVarShort((int)subAreaId);
     writer.WriteDouble(mapId);
     writer.WriteShort((short)houses.Length);
     foreach (var entry in houses)
     {
         writer.WriteShort(entry.TypeId);
         entry.Serialize(writer);
     }
     writer.WriteShort((short)actors.Length);
     foreach (var entry in actors)
     {
         writer.WriteShort(entry.TypeId);
         entry.Serialize(writer);
     }
     writer.WriteShort((short)interactiveElements.Length);
     foreach (var entry in interactiveElements)
     {
         writer.WriteShort(entry.TypeId);
         entry.Serialize(writer);
     }
     writer.WriteShort((short)statedElements.Length);
     foreach (var entry in statedElements)
     {
         entry.Serialize(writer);
     }
     writer.WriteShort((short)obstacles.Length);
     foreach (var entry in obstacles)
     {
         entry.Serialize(writer);
     }
     writer.WriteShort((short)fights.Length);
     foreach (var entry in fights)
     {
         entry.Serialize(writer);
     }
     writer.WriteBoolean(hasAggressiveMonsters);
     fightStartPositions.Serialize(writer);
 }
コード例 #2
0
 public override void Serialize(IWriter writer)
 {
     writer.WriteInt(mapId);
     fightStartPositions.Serialize(writer);
 }
コード例 #3
0
        public override void Serialize(IDataWriter writer)
        {
            writer.WriteVarShort(subAreaId);
            writer.WriteInt(mapId);
            var houses_before = writer.Position;
            var houses_count  = 0;

            writer.WriteShort(0);
            foreach (var entry in houses)
            {
                writer.WriteShort(entry.TypeId);
                entry.Serialize(writer);
                houses_count++;
            }
            var houses_after = writer.Position;

            writer.Seek((int)houses_before);
            writer.WriteShort((short)houses_count);
            writer.Seek((int)houses_after);

            var actors_before = writer.Position;
            var actors_count  = 0;

            writer.WriteShort(0);
            foreach (var entry in actors)
            {
                writer.WriteShort(entry.TypeId);
                entry.Serialize(writer);
                actors_count++;
            }
            var actors_after = writer.Position;

            writer.Seek((int)actors_before);
            writer.WriteShort((short)actors_count);
            writer.Seek((int)actors_after);

            var interactiveElements_before = writer.Position;
            var interactiveElements_count  = 0;

            writer.WriteShort(0);
            foreach (var entry in interactiveElements)
            {
                writer.WriteShort(entry.TypeId);
                entry.Serialize(writer);
                interactiveElements_count++;
            }
            var interactiveElements_after = writer.Position;

            writer.Seek((int)interactiveElements_before);
            writer.WriteShort((short)interactiveElements_count);
            writer.Seek((int)interactiveElements_after);

            var statedElements_before = writer.Position;
            var statedElements_count  = 0;

            writer.WriteShort(0);
            foreach (var entry in statedElements)
            {
                entry.Serialize(writer);
                statedElements_count++;
            }
            var statedElements_after = writer.Position;

            writer.Seek((int)statedElements_before);
            writer.WriteShort((short)statedElements_count);
            writer.Seek((int)statedElements_after);

            var obstacles_before = writer.Position;
            var obstacles_count  = 0;

            writer.WriteShort(0);
            foreach (var entry in obstacles)
            {
                entry.Serialize(writer);
                obstacles_count++;
            }
            var obstacles_after = writer.Position;

            writer.Seek((int)obstacles_before);
            writer.WriteShort((short)obstacles_count);
            writer.Seek((int)obstacles_after);

            var fights_before = writer.Position;
            var fights_count  = 0;

            writer.WriteShort(0);
            foreach (var entry in fights)
            {
                entry.Serialize(writer);
                fights_count++;
            }
            var fights_after = writer.Position;

            writer.Seek((int)fights_before);
            writer.WriteShort((short)fights_count);
            writer.Seek((int)fights_after);

            writer.WriteBoolean(hasAggressiveMonsters);
            fightStartPositions.Serialize(writer);
        }
 public override void Serialize(IDataWriter writer)
 {
     writer.WriteDouble(mapId);
     fightStartPositions.Serialize(writer);
 }