public void LogEndGame(bool onePlayerLeft, bool isSplitPot) { IsSplitPot = isSplitPot; CardType[] communityCards = new CardType[5]; for (int i = 0; i < 5; i++) { if (game.State.TableCards[i] != null) { communityCards[i] = game.State.TableCards[i].getCardId(); } } List <PlayerCardsInfo> playersCards = new List <PlayerCardsInfo>(); foreach (var player in game.Seats) { if (!player.Folded) { playersCards.Add(new PlayerCardsInfo(player.Cards[0].getCardId(), player.Cards[1].getCardId(), game.Id, player.PlayerId, player.Username)); } } EndGameInfo endGameInfo = new EndGameInfo(game.Id, isSplitPot, game.Winner.Username, playersCards, communityCards, onePlayerLeft); string str = EndGameInfo.ConvertToString(endGameInfo); LatestAction = str; game.Subject.NotifyEndGame(); }
void GetEndGameInfo() { EndGame _endObject = GameObject.Find("Maze End").GetComponent <EndGame>(); info = _endObject.GetEndGameInfo(); Destroy(_endObject.gameObject); StartCoroutine(DisplayEndResults()); }
public void UpdateEndGameInfo(string content) { EndGameInfo endGameInfoInfo = new EndGameInfo(content); foreach (GameListener gameListener in RECEIVER.gameListeners) { gameListener.Update(endGameInfoInfo); } }
public void Update(EndGameInfo endGameInfo) { Dispatcher.Invoke(() => { if (endGameInfo.GameID == gameID) { this.Content = new UserControlEndGame(endGameInfo); } }); }
public UserControlEndGame(EndGameInfo endGameInfo) { InitializeComponent(); images = new Image[16] { Img11, Img12, Img21, Img22, Img31, Img32, Img41, Img42, Img51, Img52, Img61, Img62, Img71, Img72, Img81, Img82 }; labels = new Label[8] { Lbl1, Lbl2, Lbl3, Lbl4, Lbl5, Lbl6, Lbl7, Lbl8 }; UpdateEndGameWindow(endGameInfo); }
private void ChessGameHasEnded(EndGameInfo endGameInfo) { User user1 = this.dbContext.Users.Single(u => u.Username == this.chessGame.User1WhitesName); User user2 = this.dbContext.Users.Single(u => u.Username == this.chessGame.User2BlacksName); Game game = new Game() { NormalMoves = this.chessGame.movesInTheGame.Where(m => m is NormalMoveDabModel).Select(m => (NormalMoveDabModel)m).ToList(), Castlings = this.chessGame.movesInTheGame.Where(m => m is Castling).Select(m => (Castling)m).ToList(), ProducingPawns = this.chessGame.movesInTheGame.Where(m => m is ProducingPawn).Select(m => (ProducingPawn)m).ToList() }; this.dbContext.UsersGames.Add (new DatabaseModel.Modles.UsersGame() { FirstUser = user1, SecondUser = user2, Game = game, Result = endGameInfo.ToString() }); this.dbContext.SaveChanges(); this.InitialView(); this.InitialPlayGameButton.Enabled = true; }
public void Update(EndGameInfo endGameInfo) { this.Content = new UserControlEndGame(endGameInfo); }
private void UpdateEndGameWindow(EndGameInfo endGameInfo) { if (endGameInfo.IsSplitPot) { LblWinner.Content = "Split Pot"; LblWinnerName.Visibility = Visibility.Hidden; } string usernameWinner = endGameInfo.UsernameWinner; LblWinnerName.Content = usernameWinner; if (!endGameInfo.OnePlayerLeft) { List <PlayerCardsInfo> playersCards = endGameInfo.PlayersCards; int i = 0; foreach (PlayerCardsInfo playerCards in playersCards) { if (!playerCards.Username.Equals(usernameWinner)) { images[2 * i].Source = GUICards.GetImageSource(playerCards.PlayerCards[0]); images[2 * i + 1].Source = GUICards.GetImageSource(playerCards.PlayerCards[1]); labels[i].Content = playerCards.Username; i++; } else { ImgWinner1.Source = GUICards.GetImageSource(playerCards.PlayerCards[0]); ImgWinner2.Source = GUICards.GetImageSource(playerCards.PlayerCards[1]); LblWinnerCandidate.Content = usernameWinner; } } for (int j = i; j < 8; j++) { images[2 * j].Visibility = Visibility.Hidden; images[2 * j + 1].Visibility = Visibility.Hidden; labels[j].Visibility = Visibility.Hidden; } ImgCom1.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[0]); ImgCom2.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[1]); ImgCom3.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[2]); ImgCom4.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[3]); ImgCom5.Source = GUICards.GetImageSource(endGameInfo.CommunityCards[4]); } else { for (int i = 0; i < 8; i++) { images[2 * i].Visibility = Visibility.Hidden; images[2 * i + 1].Visibility = Visibility.Hidden; labels[i].Visibility = Visibility.Hidden; } ImgCom1.Visibility = Visibility.Hidden; ImgCom2.Visibility = Visibility.Hidden; ImgCom3.Visibility = Visibility.Hidden; ImgCom4.Visibility = Visibility.Hidden; ImgCom5.Visibility = Visibility.Hidden; ImgWinner1.Visibility = Visibility.Hidden; ImgWinner2.Visibility = Visibility.Hidden; LblWinnerCandidate.Visibility = Visibility.Hidden; } }
public ChessGameEndedException(ChessBoard board, string message, EndGameInfo endgameInfo) : base(board, message) => EndgameInfo = endgameInfo;
public ChessGameEndedException(ChessBoard board, EndGameInfo endgameInfo) : this(board, "This game is already ended.", endgameInfo) { }
public EndgameEventArgs(ChessBoard chessBoard, EndGameInfo endgameInfo) : base(chessBoard) { EndgameInfo = endgameInfo; }