示例#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 static JoinGameResponse Deserialize(HazelBinaryReader reader)
        {
            var msg = new JoinGameResponse();

            msg.gameCode = reader.ReadInt32();
            msg.playerId = reader.ReadInt32();
            msg.hostId   = reader.ReadInt32();
            return(msg);
        }
示例#3
0
        public int suspectIdx; //not certain about these name

        public static RpcAddVote Deserialize(HazelBinaryReader reader)
        {
            var msg = new RpcAddVote();

            msg.playerId   = reader.ReadInt32();
            msg.suspectIdx = reader.ReadInt32();

            return(msg);
        }
示例#4
0
        public static JoinedGame Deserialize(HazelBinaryReader reader)
        {
            var msg = new JoinedGame();

            msg.gameCode       = reader.ReadInt32();
            msg.playerId       = reader.ReadInt32();
            msg.hostId         = reader.ReadInt32();
            msg.otherPlayerIds = reader.ReadList(read => read.ReadPackedInt32());
            return(msg);
        }
示例#5
0
        public static RemovePlayerResponse Deserialize(HazelBinaryReader reader)
        {
            var msg = new RemovePlayerResponse();

            msg.gameCode = reader.ReadInt32();
            msg.playerId = reader.ReadPackedInt32();
            msg.hostId   = reader.ReadInt32();
            msg.reason   = (DisconnectReason)reader.ReadByte();
            msg.unknown  = reader.ReadByte();
            //msg.unknown2 = reader.ReadByte();
            return(msg);
        }
            public static GameListItem Deserialize(HazelBinaryReader reader)
            {
                var msg = new GameListItem();

                msg.adress     = reader.ReadInt32();
                msg.port       = reader.ReadUInt16();
                msg.code       = reader.ReadInt32();
                msg.name       = reader.ReadString();
                msg.players    = reader.ReadByte();
                msg.age        = reader.ReadPackedInt32();
                msg.mapid      = reader.ReadByte();
                msg.imposters  = reader.ReadByte();
                msg.maxplayers = reader.ReadByte();
                return(msg);
            }
示例#7
0
        public static HostGameResponse Deserialize(HazelBinaryReader reader)
        {
            var msg = new HostGameResponse();

            msg.gameCode = reader.ReadInt32();
            return(msg);
        }
示例#8
0
        public static StartGame Deserialize(HazelBinaryReader reader)
        {
            var msg = new StartGame();

            msg.unknownid = reader.ReadInt32();
            return(msg);
        }
示例#9
0
        public static JoinGameRequest Deserialize(HazelBinaryReader reader)
        {
            var msg = new JoinGameRequest();

            msg.gameCode = reader.ReadInt32();
            msg.unknown  = reader.ReadByte();
            return(msg);
        }
示例#10
0
        public static WaitForHost Deserialize(HazelBinaryReader reader)
        {
            var msg = new WaitForHost();

            msg.gameCode = reader.ReadInt32();
            msg.playerId = reader.ReadPackedInt32();
            return(msg);
        }
示例#11
0
        public static KickPlayerResponse Deserialize(HazelBinaryReader reader)
        {
            var msg = new KickPlayerResponse();

            msg.gameCode = reader.ReadInt32();
            msg.playerId = reader.ReadPackedInt32();
            msg.isBan    = reader.ReadBoolean();
            return(msg);
        }
示例#12
0
        public static AlterGameResponse Deserialize(HazelBinaryReader reader)
        {
            var msg = new AlterGameResponse();

            msg.gameCode = reader.ReadInt32();
            msg.gameTag  = (AlterGameTags)reader.ReadByte();
            msg.value    = reader.ReadBoolean();
            return(msg);
        }
示例#13
0
        public static EndGame Deserialize(HazelBinaryReader reader)
        {
            var msg = new EndGame();

            var b1 = reader.ReadByte();
            var b2 = reader.ReadByte();

            msg.gameId = reader.ReadInt32();

            return(msg);
        }
示例#14
0
        public static HelloHandshake Deserialize(HazelBinaryReader reader)
        {
            var msg = new HelloHandshake();

            msg.Nonce         = reader.ReadUInt16();
            msg.Version       = reader.ReadByte();
            msg.ClientVersion = reader.ReadInt32();
            msg.Name          = reader.ReadString();

            return(msg);
        }
示例#15
0
        public static List <GameData> Deserialize(HazelBinaryReader reader)
        {
            var gameId    = reader.ReadInt32();
            var gamedatas = new List <GameData>();

            while (reader.HasBytesLeft())
            {
                var msg = new GameData();
                msg.gameId = gameId;
                var size = reader.ReadInt16();
                msg.type = reader.ReadByte();
                msg.body = reader.ReadBytes(size);
                gamedatas.Add(msg);
            }

            return(gamedatas);
        }