public override void Run() { base.Run(); Table.PlayerPortal.SendTableSummary(Table.Spectators + Table.PlayerSlots.GetPlayers(), Table.GetSummary()); DeterminePlayerHands(Table.PlayerSlots.GetPlayers()); List<Player> winners = GetWinners(Table.PlayerSlots.GetPlayers()); List<Player> losers = GetLosers(winners); RecordCurrentChips(Combine(winners, losers)); Table.PotManager.AwardPot(winners, losers, Table.PlayerSlots.GetPlayers()); DetermineProfitOrLoss(Combine(winners, losers)); GameOutcome2 go2 = new GameOutcome2(); PlayerResult[] winnersResults = new PlayerResult[winners.Count]; for (int i = 0; i < winnersResults.Length; i++) { string playerName = winners[i].Name; winnersResults[i] = new PlayerResult(); winnersResults[i].PlayerSummary = winners[i].GetSummary(Table.PlayerSlots.GetSlotPosition(playerName)); winnersResults[i].Hand = PlayerHands[playerName]; winnersResults[i].ProfitOrLoss = GetProfitOrLoss(playerName); } PlayerResult[] losersResults = new PlayerResult[losers.Count]; for (int i = 0; i < losersResults.Length; i++) { string playerName = losers[i].Name; losersResults[i] = new PlayerResult(); losersResults[i].PlayerSummary = losers[i].GetSummary(Table.PlayerSlots.GetSlotPosition(playerName)); losersResults[i].Hand = PlayerHands[playerName]; losersResults[i].ProfitOrLoss = GetProfitOrLoss(playerName); } go2.Winners = winnersResults; go2.Losers = losersResults; go2.WasItAShowDown = (winners.Count + losers.Count) > 1; //-- If it was not a showdown, clear the hands before you send them out. if (go2.WasItAShowDown == false) { go2.ClearHands(); } Table.PlayerPortal.SendGameOutcome(Table.Spectators + Table.PlayerSlots.GetPlayers(), go2); UpdatePlayerStates(); Table.PlayerPortal.SendPlayerSummaries(Table.Spectators + Table.PlayerSlots.GetPlayers(), Table.PlayerSlots.GetPlayerSummaries().ToArray()); }
public void Reset(GameOutcome2 go2) { GameOutcome = go2; m_lblWinners.Text = string.Empty; m_lblLosers.Text = string.Empty; //var winnerQuery = from w in GameOutcome.Winners // select new // { // Name = w.Player.Name, // Cards = w.Cards.ToString(), // Combination = w.BestCombination.ToString() // }; //m_dgvWinners.DataSource = winnerQuery; //var loserQuery = from l in GameOutcome.Losers // select new // { // Name = l.Player.Name, // Cards = l.Cards.ToString(), // Combination = l.BestCombination.ToString() // }; //m_dgvLosers.DataSource = loserQuery; foreach (PlayerResult winner in GameOutcome.Winners) { string playerName = string.Empty; if (winner.PlayerSummary.Name.Equals(GameClient.Player.Name)) playerName = winner.PlayerSummary.Name + " (You)"; else playerName = winner.PlayerSummary.Name; string row = playerName + ": " + winner.Hand.ToString() + ", " + winner.Hand.BestCombination.ToString() + Environment.NewLine; m_lblWinners.Text += row; } foreach (PlayerResult loser in GameOutcome.Losers) { string playerName = string.Empty; if (loser.PlayerSummary.Name.Equals(GameClient.Player.Name)) playerName = loser.PlayerSummary.Name + " (You)"; else playerName = loser.PlayerSummary.Name; string row = playerName + ": " + loser.Hand.ToString() + ", " + loser.Hand.BestCombination.ToString() + Environment.NewLine; m_lblLosers.Text += row; } }
public void SendGameOutcome(List<Player> recipients, GameOutcome2 go2) { AddToOutgoingMessageQueue(GameMessageType.Client_ReceiveGameOutcome, go2, recipients); }