public async Task StartNewGameAsync(ushort?playersAmount = null, float?choiceChance = null) { Message statusMessage = await _bot.Client.SendTextMessageAsync(_chatId, "_Читаю колоды…_", ParseMode.MarkdownV2, disableNotification : true); List <Deck <CardAction> > actionDecks = await Manager.GetActionDecksAsync(_bot); Deck <Card> questionsDeck = await Manager.GetQuestionsDeckAsync(_bot); await _bot.Client.FinalizeStatusMessageAsync(statusMessage); if (!_bot.Config.InitialPlayersAmount.HasValue) { throw new NullReferenceException(nameof(_bot.Config.InitialPlayersAmount)); } if (!_bot.Config.InitialChoiceChance.HasValue) { throw new NullReferenceException(nameof(_bot.Config.InitialChoiceChance)); } _game = new Data.Game(playersAmount ?? _bot.Config.InitialPlayersAmount.Value, choiceChance ?? _bot.Config.InitialChoiceChance.Value, actionDecks, questionsDeck); StringBuilder stringBuilder = new(); stringBuilder.AppendLine("🔥 Начинаем новую игру!"); stringBuilder.AppendLine(_game.Players); stringBuilder.AppendLine(_game.Chance); await _bot.Client.SendTextMessageAsync(_chatId, stringBuilder.ToString(), Captions); }
public static Game Build() { var hidingSpots = new List<HidingSpot>(); var rnd = new Random(); var indexOfHidingSpot = rnd.Next(9); for (var idx = 0; idx < 9; idx++) { hidingSpots.Add(new HidingSpot { Id = idx, HasBeenChecked = false, HasTreasure = idx == indexOfHidingSpot }); } _game = new Game { Id = 1, TurnsRemaining = 3, HidingSpots = hidingSpots }; return _game; }
public GameLink(Game game) { _game = game; ActionToPerform = OnGameLinkClicked; Name = _game.Name; }