/// <summary>
        /// Initializes a new instance of the <see cref="ClientConnectedEventArgs"/> class.
        /// </summary>
        /// <param name="client">The client that connected to the server.</param>
        /// <exception cref="ArgumentNullException"><paramref name="client"/> is <c>null</c>.</exception>
        public ClientConnectedEventArgs(NetworkServerHandler client)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            this.Client = client;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the PlayerHandler class.
        /// </summary>
        /// <param name="server">A reference to the server object.</param>
        /// <param name="connection">The TCP client object describing the client's binding to the server.</param>
        public PlayerHandler(GameServer server, NetworkServerHandler connection)
            : base()
        {
            lock (this)
            {
                this.server = server;
                this.Connection = connection;
                this.PlayerHostName = connection.Connection.Client.RemoteEndPoint.ToString();
                this.connectionTimeUTC = DateTime.UtcNow.Ticks;

                this.Id = -1;
                this.PasswordHash = string.Empty;
                this.UserLevel = UserPermissionLevel.Regular;
                this.Inventory = new PlayerInventory();
                this.ObjectsSeen = new Collection<GameObjectBase>();

                new Thread(this.Run).Start();
            }
        }