Пример #1
0
        public static GameOptionsData Deserialize(HazelBinaryReader reader)
        {
            var result = new GameOptionsData();

            result.Version              = reader.ReadByte();
            result.MaxPlayers           = reader.ReadByte();
            result.Keywords             = (GameKeywords)reader.ReadUInt32();
            result.MapId                = (Map)reader.ReadByte();
            result.PlayerSpeedMod       = reader.ReadSingle();
            result.CrewLightMod         = reader.ReadSingle();
            result.ImpostorLightMod     = reader.ReadSingle();
            result.KillCooldown         = reader.ReadSingle();
            result.NumCommonTasks       = reader.ReadByte();
            result.NumLongTasks         = reader.ReadByte();
            result.NumShortTasks        = reader.ReadByte();
            result.NumEmergencyMeetings = reader.ReadInt32();
            result.NumImpostors         = reader.ReadByte();
            result.KillDistance         = reader.ReadByte();
            result.DiscussionTime       = reader.ReadInt32();
            result.VotingTime           = reader.ReadInt32();
            result.IsDefaults           = reader.ReadBoolean();

            if (result.Version > 1)
            {
                result.EmergencyCooldown = reader.ReadByte();
            }

            if (result.Version > 2)
            {
                result.ConfirmImpostor = reader.ReadBoolean();
                result.VisualTasks     = reader.ReadBoolean();
            }

            return(result);
        }
Пример #2
0
        public void Deserialize(HazelBinaryReader reader, bool onSpawn)
        {
            if (onSpawn)
            {
                //This number of doors depends on the map
                //Skeld: 13
                //HQ: 2?
                //Polus: 12
                for (int i = 0; i < 12; i++)
                {
                    doors.Add(new Doorway()
                    {
                        isOpen = reader.ReadBoolean(),
                    });
                }
                return;
            }
            uint doorFlags = reader.ReadPackedUInt32();

            for (int j = 0; j < doors.Count; j++)
            {
                if ((doorFlags & (1U << j)) != 0U)
                {
                    doors[j].isOpen = reader.ReadBoolean();
                }
            }
        }
Пример #3
0
        public static AlterGameRequest Deserialize(HazelBinaryReader reader)
        {
            var msg = new AlterGameRequest();

            msg.gameTag = (AlterGameTags)reader.ReadByte();
            msg.value   = reader.ReadBoolean();
            return(msg);
        }
Пример #4
0
        public static KickPlayerRequest Deserialize(HazelBinaryReader reader)
        {
            var msg = new KickPlayerRequest();

            msg.playerId = reader.ReadPackedInt32();
            msg.isBan    = reader.ReadBoolean();
            return(msg);
        }
Пример #5
0
        public static RpcSetScanner Deserialize(HazelBinaryReader reader)
        {
            var msg = new RpcSetScanner();

            msg.value = reader.ReadBoolean();
            msg.b2    = reader.ReadByte();

            return(msg);
        }
Пример #6
0
        public static RpcEndGame Deserialize(HazelBinaryReader reader)
        {
            var msg = new RpcEndGame();

            msg.endReason = (GameOverReason)reader.ReadByte();
            msg.showAd    = reader.ReadBoolean();

            return(msg);
        }
Пример #7
0
        public static RpcVotingComplete Deserialize(HazelBinaryReader reader)
        {
            var msg = new RpcVotingComplete();

            msg.states         = reader.ReadBytesAndSize();
            msg.exiledPlayerId = reader.ReadByte();
            msg.tie            = reader.ReadBoolean();

            return(msg);
        }
Пример #8
0
 public override void Deserialize(HazelBinaryReader reader, bool onSpawn)
 {
     if (onSpawn)
     {
         Console.WriteLine("PlayerControl ######");
         bool isNew = reader.ReadBoolean();
         playerId = reader.ReadByte();
         Console.WriteLine("isNew: " + isNew);
         Console.WriteLine("playerid: " + playerId);
         return;
     }
     playerId = reader.ReadByte();
     Console.WriteLine("playerid: " + playerId);
 }
Пример #9
0
 public void Deserialize(HazelBinaryReader reader, bool onSpawn)
 {
     IsActive = reader.ReadBoolean();
 }
Пример #10
0
 public void Deserialize(HazelBinaryReader reader)
 {
     Id       = reader.ReadPackedUInt32();
     Complete = reader.ReadBoolean();
 }