public void OnShowdownWinner(EvaluatorStrength evaluatorElement) { if (OnShowdownWinnerEvent != null) { OnShowdownWinnerEvent(evaluatorElement); } }
/// <summary> /// Rozpoczecie pokazywania kart i wygranych /// </summary> public void ShowdownStart() { var gameTable = Game.GameTableModel; var showingPlayer = GetShowdownPlayerStart(); var showingPlayerLoop = true; Evaluator = new Evaluator(Game); Evaluator.CalculateStrength(); // Showdown rozpoczyna się wraz z graczem, który jako pierwszy wrzucił ostatnią stawkę do puli. // Jest nim ten gracz, który ustanowił stawkę do której wszyscy inni gracze dorównali. //Inicializacyjana wartosc, stack ktory pozostal do rozdania jest rowny sumie EvaluatorStrength bestStrenghtNow = null; do { if (showingPlayer.Status.HasFlag(PlayerModel.PlayerStatus.INGAME) || showingPlayer.Status.HasFlag(PlayerModel.PlayerStatus.DONTPLAY)) { //Obliczamy sile rozdan obecnych graczy EvaluatorStrength playerStrenght = Evaluator.GetStrenght(showingPlayer); if ( bestStrenghtNow == null || bestStrenghtNow.Points <= playerStrenght.Points || playerStrenght.Player.Stack == 0 ) { if (playerStrenght.Player.Stack != 0) { bestStrenghtNow = playerStrenght; } //Pokazanie kart dla innych graczy if (!PlayerShowedCardsEarlier(playerStrenght.Player)) { //Pokazanie kart CardShowupAction cardActionPlayer = new CardShowupAction() { Cards = playerStrenght.Player.Cards, Stage = Game.GameTableModel.Stage, CreatedAt = DateTime.Now, Player = playerStrenght.Player }; Game.GameTableModel.ActionHistory.Add(cardActionPlayer); //Podswietlamy wygrany układ CardHighlightAction cardHighlight = new CardHighlightAction() { Cards = playerStrenght.WinCardList, Stage = Game.GameTableModel.Stage, CreatedAt = DateTime.Now, Player = playerStrenght.Player }; Game.GameTableModel.ActionHistory.Add(cardHighlight); } string message = "Gracz " + playerStrenght.Player.User.Username + " pokazuje " + Evaluator.CardHandName(playerStrenght); Console.Write(message); Game.SendDealerMessage(message); Thread.Sleep(1000); } else { //Ukrycie kart CardHideupAction cardActionPlayer = new CardHideupAction() { Stage = Game.GameTableModel.Stage, CreatedAt = DateTime.Now, Player = playerStrenght.Player }; Game.GameTableModel.ActionHistory.Add(cardActionPlayer); //Gracz nie musi pokazywać tych kart Console.Write("Gracz " + showingPlayer.User.Username + " zrzuca karty"); Game.SendDealerMessage("Gracz " + showingPlayer.User.Username + " zrzuca karty"); } } showingPlayer = Game.NextPlayer(showingPlayer); if (showingPlayer == GetShowdownPlayerStart()) { showingPlayerLoop = false; } } while (showingPlayerLoop); }