void ServerDealCard(texasPlayer player, bool hideCard) { var newCard = deck.GetTopCard(); newCard.hidden = hideCard; player.ServerAddCard(newCard); }//funtion in the server in purpos is to drow cards from the deck and deal it to the players
public void AddPlayer(texasPlayer player) { players.Add(player); if (players.Count == 1) //checking if the number of the clients is the minimum for play { ServerNextState("ServerState_StartDeck"); //starting the game } else { foreach (var other in players) { if (other == player) { continue; } foreach (var card in other.handCards) { var msg = new CardConstants.CardMessage(); msg.playerId = other.netId; msg.cardId = card; player.connectionToClient.Send(CardConstants.CardMsgId, msg); } } } }//add player is the function that add the player and check the minimum amount of player to began the Game
}//add player is the function that add the player and check the minimum amount of player to began the Game public void RemovePlayer(texasPlayer player) { Debug.Log("Remove player on Room manager"); players.Remove(player); //need to check the scenario when there is only on Player in the room //need to create a functuin that indicate that remove the Player slots from the table }//remove the player from the Game
void ServerClearHands()//clearing the card in the server then clearring the card at the client { communityCard.ClearCards(); cardsInTable.Clear(); foreach (var player in players) { player.ServerClearCards(); player.ServerClearBet(); } currentTurnPlayer = null; }
public void ServerNextPlayer()//control the game tempo in this function need to check player state fold/all in /check { if (currentTurnPlayer != null) { currentTurnPlayer.RpcYourTurn(false); } currentPlayerIndex += 1; while (currentPlayerIndex < players.Count) { currentTurnPlayer = players[currentPlayerIndex]; if (currentTurnPlayer != null) { if (currentTurnPlayer.bettingOnCurrentHand && currentTurnPlayer.playerState != texasPlayer.PlayerState.fold && currentTurnPlayer.playerState != texasPlayer.PlayerState.allIn) { currentTurnPlayer.RpcYourTurn(true); break; } } currentPlayerIndex += 1; } if (currentPlayerIndex >= players.Count) { players[currentPlayerIndex - 1].RpcYourTurn(false);//disable the buttons //if (AllFolded())//no player is in this bet //{ // foreach (texasPlayer player in players) // { // if (player.playerState != texasPlayer.PlayerState.fold) // { // player.ServerPayout((int)MainPot); // break; // } // } // ServerNextHand(); // return; //} if (RoomManager.singleton.cardsInTable.Count == 4)//River { ServerNextState("ServerDealRiver"); } else if (RoomManager.singleton.cardsInTable.Count == 3) //Turn { ServerNextState("ServerDealturn"); } else { if (RoomManager.singleton.cardsInTable.Count == 5)//Show Down { ServerNextState("ShowDown"); } } // all players have played their hands } }
}//add player is the function that add the player and check the minimum amount of player to began the Game public void RemovePlayer(texasPlayer player) { players.Remove(player); }//remove the player from the Game