Ver Fonte

Fix bugs

Tigran há 4 anos atrás
pai
commit
f71c25dbda

+ 2 - 1
MafiaTelegramBot/Game/GameRooms/GameRoom.GameProcess.cs

@@ -68,7 +68,8 @@ namespace MafiaTelegramBot.Game.GameRooms
             {
                 var alivePlayers = Players.Values.Where(p => p.IsAlive).ToList();
                 var aliveMafia = alivePlayers.Where(p => p.CurrentRole.RoleKey is Roles.Don or Roles.Mafia).ToList();
-                while (alivePlayers.Count > 2 * aliveMafia.Count && aliveMafia.Count > 0)
+                var gameNotEnded = true;//alivePlayers.Count > 2 * aliveMafia.Count && aliveMafia.Count > 0;
+                while (gameNotEnded)
                 {
                     IsDay = true;
                     await DayPhase();

+ 2 - 2
MafiaTelegramBot/Game/GameRooms/GameRoom.Role.cs

@@ -52,12 +52,12 @@ namespace MafiaTelegramBot.Game.GameRooms
                         if(player.IsFirst) await Bot.SendWithMarkdown2(player.Id, strings.user_not_choose);
                         voteTimer.Start();
                     }
-                    DayActionComplete.Set();
+                    if(!voteTimer.Enabled) DayActionComplete.Set();
                 };
                 timer.AutoReset = false;
                 timer.Start();
                 DayActionComplete.WaitOne();
-                DayActionComplete.Close();
+                DayActionComplete.Reset();
                 timer.Stop();
                 voteTimer.Stop();
                 if(message!=null) await Bot.Get().DeleteMessageAsync(player.ChatId, message.MessageId);

+ 1 - 1
MafiaTelegramBot/Resources/Keyboards.cs

@@ -135,7 +135,7 @@ namespace MafiaTelegramBot.Resources
 
         public static InlineKeyboardMarkup VoteKeyboard(List<Player> players, long userId, bool withSkipButton)
         {
-            var inlineButtons = new InlineKeyboardButton[withSkipButton ?players.Count :players.Count+1][];
+            var inlineButtons = new InlineKeyboardButton[withSkipButton ?players.Count+1 :players.Count][];
             for (var i = 0; i<players.Count; ++i)
             {
                 inlineButtons[i] = new[]