Пример #1
0
        public void Add(PlayerInfo player)
        {
            if (_players.ContainsKey(player.Id))
                throw new ArgumentException("A player with the specified ID is already known");

            _players.Add(player.Id, player);
        }
Пример #2
0
        public void UpdatePosition(string playerId, Point position)
        {
            PlayerInfo player;

            if (_players.TryGetValue(playerId, out player))
            {
                _players[playerId] = new PlayerInfo(player.Id, player.DisplayName, position);
            }
            else
            {
                throw new ArgumentException($"The player with ID '{playerId}' is not known");
            }
        }