Advertisement
OwlyOwl

bless

Jul 14th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 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.             List<Player> players = new List<Player>();
  12.             AddPlayer(1, "1", 1, false, players);
  13.             Player.BanPlayer(players, 1);
  14.             Player.UnbanPlayer(players, 1);
  15.             RemovePlayer(1, players);
  16.         }
  17.  
  18.         static void AddPlayer(int playerNum, string nickname, int level, bool restriction, List<Player> players)
  19.         {
  20.             Player newPlayer = new Player(playerNum, nickname, level, restriction);
  21.             players.Add(newPlayer);
  22.         }
  23.  
  24.         static void RemovePlayer(int playerNumber, List<Player> players)
  25.         {
  26.             players.RemoveAt(playerNumber - 1);
  27.         }
  28.  
  29.         class Player
  30.         {
  31.             public string Nickname { get; private set; }
  32.             public int PlayerNum { get; private set; }
  33.             public bool Restriction { get; private set; }
  34.             public int Level { get; private set; }
  35.  
  36.             public Player(int playerNum, string nickname, int level, bool restriction)
  37.             {
  38.                 PlayerNum = playerNum;
  39.                 Nickname = nickname;
  40.                 Level = level;
  41.                 Restriction = restriction;
  42.             }
  43.  
  44.             static public void BanPlayer(List<Player> players, int playerNumber)
  45.             {
  46.                 players[playerNumber - 1].Restriction = true;
  47.             }
  48.  
  49.             static public void UnbanPlayer(List<Player> players, int playerNumber)
  50.             {
  51.                 players[playerNumber - 1].Restriction = false;
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement