12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using MafiaTelegramBot.Resources;
- namespace MafiaTelegramBot.Game.GameRooms
- {
- public abstract partial class GameRoom
- {
- public bool IsRunning;
- public bool IsDay = false;
- public bool IsFirstCycle = false;
- public int MaxPlayers = 10;
- private int _minPlayers = Constants.PLAYER_LIMITS_MIN;
- public bool IsPrivate { get; init; }
- public abstract bool IsExtended { get; protected set; }
- public bool TimerEnabled { get; set; } = true;
- public string RoomName { get; init; } = "NoNameRoom";
- public Player Owner { get; init; } = new();
- protected readonly List<Player> VoteUpList = new();
- public readonly MessageHandler MHandler;
- public readonly QueryHandler QHandler;
- public readonly MafiaChannel MafiaCh;
- public readonly PlayersChannel PlayersCh;
- private readonly Queue<Player> _turnOrder = new();
- public readonly Dictionary<long, Player> Players = new();
- public readonly Dictionary<Roles, int> Settings = new()
- {
- {Roles.Mafia, 0},
- {Roles.Cop, 0},
- {Roles.Villager, 0},
- {Roles.Doctor, 0},
- {Roles.Don, 0},
- {Roles.Hooker, 0},
- };
- public GameRoom()
- {
- MHandler = new MessageHandler(this);
- QHandler = new QueryHandler(this);
- MafiaCh = new MafiaChannel(this);
- PlayersCh = new PlayersChannel(this);
- }
- public async Task<List<Player>> GetPlayers()
- {
- return await Task.Run(() =>
- {
- var players = Players.Values.ToList();
- players.Remove(Owner);
- return players;
- });
- }
- public bool IsFilled()
- {
- return Players.Count == MaxPlayers;
- }
- }
- }
|