示例#1
0
文件: Game.cs 项目: TomasMike/TG
        public void DuringDay()
        {
            // if all passed go to end of day
            if (playersWhoPassedThisDay.Count == Players.Count)
            {
                TGLogger.LogToConsole("All players passed. Jumping to end of day phase.");
                EndOfDay();
            }
            else
            {
                Round++;

                if (Players.Count > 1)
                {
                    // ries kto bol toto kolo, ked vsetci zacni dalsie kolo a kto passol uz
                    var possiblePlayersToBeActivePlayer = Players.Select(_ => _.PlayerNumber).ToList();
                    possiblePlayersToBeActivePlayer.RemoveAll(_ => playersWhoActedThisRound.Contains(_));
                    possiblePlayersToBeActivePlayer.RemoveAll(_ => playersWhoPassedThisDay.Contains(_));

                    if (possiblePlayersToBeActivePlayer.Count == 0)
                    {
                        //next round
                        playersWhoActedThisRound.Clear();
                        TGLogger.LogToConsole("All players who didnt pass, acted this round. Next round starts.");
                        DuringDay();
                        return;
                    }
                    else if (possiblePlayersToBeActivePlayer.Count == 1)
                    {
                        Instance.ActivePlayerNumber = possiblePlayersToBeActivePlayer[0];
                        TGLogger.LogToConsole($"{Instance.ActivePlayerNumber} is the last player who didnt act this round, hes the active player now.");
                    }
                    else
                    {
                        Instance.ActivePlayerNumber =
                            Asker.Ask(
                                "Who will be next active player?",
                                possiblePlayersToBeActivePlayer.Select(_ => new Option <PlayerNumber>(_))).InnerOption;
                    }
                    //
                }
                else
                {
                    //singleplayer
                    Instance.ActivePlayerNumber = PlayerNumber.Player1;
                    //MessageBox.Show("SinglePlayer");
                }
                _MainForm.Instance.Text = $"Active Player:{Instance.ActivePlayer.Name}";
                StartNextPlayerTurn();
            }
        }
示例#2
0
文件: Game.cs 项目: TomasMike/TG
 public void StartNextPlayerTurn()
 {
     TGLogger.LogToConsole($"ACTIVE PLAYER:{Instance.ActivePlayerNumber}");
     playersWhoActedThisRound.Add(Instance.ActivePlayerNumber);
 }