Exemplo n.º 1
0
        public static void StartBets()
        {
            int placeAtTable = 0;

            LastBet = 0;

            for (int i = 0; i < Round.Players.Count; i++)
            {
                Clock.InitClock(15);

                action = PlayerAction.Wait;
                PlayerDataEventArgs args = new PlayerDataEventArgs
                {
                    Chips        = Round.Players[i].Chips,
                    PlaceAtTable = placeAtTable++,
                    LastBet      = LastBet
                };
                PokerEventsMediator.OnStartBet(null, args);

                while (action == PlayerAction.Wait)
                {
                    Thread.Sleep(10);
                }

                switch (action)
                {
                case PlayerAction.Check:
                    break;

                case PlayerAction.Bet:
                    Round.IncreasePot(PlayerBet, i);

                    LastBet = PlayerBet - LastBet;
                    if (PlayerBet > LastBet)
                    {
                        //start new betting round where index 0 = next player
                    }
                    break;

                case PlayerAction.Fold:
                    Round.Players.RemoveAt(i--);
                    break;
                }
            }

            PokerEventsMediator.OnBetsStageEnded(null, EventArgs.Empty);
            stage++;
        }
 public static void OnStartBet(object sender, PlayerDataEventArgs e)
 {
     StartBet?.Invoke(null, e);
 }
Exemplo n.º 3
0
 public static void AddPlayer(object sender, PlayerDataEventArgs e)
 {
     Game.Players.Add(new Player(e.Name, e.Chips));
 }
 public static void OnAddPlayer(object sender, PlayerDataEventArgs e)
 {
     AddPlayer?.Invoke(null, e);
 }