public int RegisterPlayer(IPlayerRegistrationInfo p) { if (_playersByName.ContainsKey(p.Username)) throw new DuplicateUsernameException(); PlayerInfo np = new PlayerInfo(p); _players.Add(np.PlayerId, np); _playersByName.Add(np.Username, np); return np.PlayerId; }
public PlayerInfo(IPlayerRegistrationInfo reg) { this._address = reg.Address; this._balance = 0; this._city = reg.City; this._country = reg.Country; this._name = reg.Name; this._postcode = reg.PostCode; this._playerId = nextId++; this._username = reg.Username; this._password = reg.Password; }
public PlayerInfo(IPlayerRegistrationInfo reg) { this._address = reg.Address; this._balance = 0; this._city = reg.City; this._country = reg.Country; this._name = reg.Name; this._postcode = reg.PostCode; this._playerId = nextId++; this._username = reg.Username; this._password = reg.Password; }
public int RegisterPlayer(IPlayerRegistrationInfo p) { if (_playersByName.ContainsKey(p.Username)) { throw new DuplicateUsernameException(); } PlayerInfo np = new PlayerInfo(p); _players.Add(np.PlayerId, np); _playersByName.Add(np.Username, np); return(np.PlayerId); }