Advertisement
OwlyOwl

out_of_ideas

Jul 14th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Dynamic;
  4.  
  5. namespace PlayerDataBase
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.         }
  12.  
  13.         class Player
  14.         {
  15.             public string Nickname { get; private set; }
  16.  
  17.             private int _playerNum;
  18.             protected bool _restriction;
  19.             private int _level;
  20.  
  21.             public Player(int playerNum, string nickname, int level, bool restriction)
  22.             {
  23.                 _playerNum = playerNum;
  24.                 Nickname = nickname;
  25.                 _level = level;
  26.                 _restriction = restriction;
  27.             }
  28.  
  29.             protected void BanPlayer(List<Player> players, int playerNumber)
  30.             {
  31.                 players[playerNumber]._restriction = true;
  32.             }
  33.  
  34.             protected void UnbanPlayer(List<Player> players, int playerNumber)
  35.             {
  36.                 players[playerNumber]._restriction = false;
  37.             }
  38.         }
  39.  
  40.         class PlayerList
  41.         {
  42.             protected List<Player> _players = new List<Player>();
  43.  
  44.             public PlayerList(List<Player> players)
  45.             {
  46.                 _players = players;
  47.             }
  48.  
  49.             private void AddPlayer(List<Player> playerList, int playerNum, string nickname, int level, bool restriction)
  50.             {
  51.                 Player newPlayer = new Player(playerNum, nickname, level, restriction);
  52.                 playerList.Add(newPlayer);
  53.             }
  54.  
  55.             private void RemovePlayer(int playerNumber, List<Player> playerList)
  56.             {
  57.                 playerList.RemoveAt(playerNumber + 1);
  58.             }
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement