Пример #1
0
        /// <summary>
        /// Creates a new player object from information in a received server data packet
        /// </summary>
        /// <param name="packet">Packet containing player information at the current pointer position</param>
        /// <param name="address">Player address, from the server info header</param>
        public Player(Server server, InboundPacket packet, string address)
        {
            Address      = address;
            PlayerNumber = packet.PopInt();         OnPropertyChanged("PlayerNumber");

            if (server.Version > 2225)
            {
                PlayerID = packet.PopInt();         OnPropertyChanged("PlayerID");
            }

            Name    = packet.PopString();     OnPropertyChanged("Name");
            Ping    = packet.PopInt();        OnPropertyChanged("Ping");
            Score   = packet.PopInt();        OnPropertyChanged("Score");
            StatsID = packet.PopInt();        OnPropertyChanged("StatsID");

            if (server.Version > 2225)
            {
                Info = packet.PopKeyValueArray();   OnPropertyChanged("Info");
            }
            else
            {
                Info = new Dictionary <string, string>();
            }
        }