Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Dynamic;
- namespace PlayerDataBase
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<Player> players = new List<Player>();
- AddPlayer(1, "1", 1, false, players);
- Player.BanPlayer(players, 1);
- Player.UnbanPlayer(players, 1);
- RemovePlayer(1, players);
- }
- static void AddPlayer(int playerNum, string nickname, int level, bool restriction, List<Player> players)
- {
- Player newPlayer = new Player(playerNum, nickname, level, restriction);
- players.Add(newPlayer);
- }
- static void RemovePlayer(int playerNumber, List<Player> players)
- {
- players.RemoveAt(playerNumber - 1);
- }
- class Player
- {
- public string Nickname { get; private set; }
- public int PlayerNum { get; private set; }
- public bool Restriction { get; private set; }
- public int Level { get; private set; }
- public Player(int playerNum, string nickname, int level, bool restriction)
- {
- PlayerNum = playerNum;
- Nickname = nickname;
- Level = level;
- Restriction = restriction;
- }
- static public void BanPlayer(List<Player> players, int playerNumber)
- {
- players[playerNumber - 1].Restriction = true;
- }
- static public void UnbanPlayer(List<Player> players, int playerNumber)
- {
- players[playerNumber - 1].Restriction = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement