示例#1
0
文件: Game.cs 项目: bobcorn/yahtzee
 private void OnPlayerTurnEnded(PlayerTurn sender, EventArgs e)
 {
     if (PlayerTurnEnd != null)
     {
         PlayerTurnEnd(sender, e);
     }
 }
示例#2
0
文件: Turn.cs 项目: bobcorn/yahtzee
        public void NewPlayerTurn()
        {
            var pt = new PlayerTurn(_players[_currentPlayerTurnIndex]);

            pt.TurnStarted   += OnPlayerTurnStarted;
            pt.TurnEnded     += OnPlayerTurnEnd;
            pt.FinishedRolls += OnPlayerFinishesRolls;
            _playerTurns[_currentPlayerTurnIndex] = pt;
            pt.Start();
        }
示例#3
0
文件: Turn.cs 项目: bobcorn/yahtzee
        private void OnPlayerTurnEnd(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " ended turn.");

            PlayerTurnEnd?.Invoke(sender, e);

            if (++_currentPlayerTurnIndex == _players.Count)
            {
                End();
            }
            else
            {
                NewPlayerTurn();
            }
        }
示例#4
0
文件: Turn.cs 项目: bobcorn/yahtzee
        private void OnPlayerTurnStarted(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " started turn.");

            PlayerTurnStarted?.Invoke(sender, EventArgs.Empty);
        }
示例#5
0
文件: Turn.cs 项目: bobcorn/yahtzee
 private void OnPlayerFinishesRolls(PlayerTurn sender, EventArgs e)
 {
     Console.WriteLine("Player " + sender.Player.Name + " finished rolls.");
 }