|
|
@ -12,11 +12,27 @@ namespace TheGameExtreme.model.gameActions.classic
|
|
|
|
|
|
|
|
|
|
|
|
protected List<GameAction> gameActions;
|
|
|
|
protected List<GameAction> gameActions;
|
|
|
|
protected Piles piles;
|
|
|
|
protected Piles piles;
|
|
|
|
public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
|
|
|
|
|
|
|
|
protected int nbCardAtBeginOfTurn = 7;
|
|
|
|
protected int nbCardAtBeginOfTurn = 7;
|
|
|
|
protected Deck deck;
|
|
|
|
protected Deck deck;
|
|
|
|
private int nbMaxCard;
|
|
|
|
private int nbMaxCard;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
|
|
|
|
|
|
|
|
public event EventHandler<PlayerChangedEventArgs> PlayerChanged;
|
|
|
|
|
|
|
|
protected internal void OnTopRangeChanged(TopRangeChangedEventArgs args)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TopRangeChanged?.Invoke(this, args);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
protected internal void OnPlayerChanged(PlayerChangedEventArgs args)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PlayerChanged?.Invoke(this, args);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public GameMode()
|
|
|
|
public GameMode()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gameActions = new List<GameAction>();
|
|
|
|
gameActions = new List<GameAction>();
|
|
|
@ -91,24 +107,22 @@ namespace TheGameExtreme.model.gameActions.classic
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected internal void OnTopRangeChanged(TopRangeChangedEventArgs args)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TopRangeChanged?.Invoke(this, args);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool endTurn(List<Card> currentHand, List<Card> CurrentCardPlayed, Player player)
|
|
|
|
public bool endTurn(List<Card> currentHand, List<Card> CurrentCardPlayed, Player player)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
((TerminerSonTour)gameActions[2]).end(currentHand, nbCardAtBeginOfTurn, CurrentCardPlayed);
|
|
|
|
if (((TerminerSonTour)gameActions[2]).end(currentHand, nbCardAtBeginOfTurn, CurrentCardPlayed))
|
|
|
|
|
|
|
|
{
|
|
|
|
pioche(currentHand, player);
|
|
|
|
pioche(currentHand, player);
|
|
|
|
//currentIndexPlayer += 1;
|
|
|
|
|
|
|
|
//if (currentIndexPlayer == playerList.Count)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// currentIndexPlayer = 0;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//CurrentHand = playerList[currentIndexPlayer].getCardList();
|
|
|
|
|
|
|
|
//OnPlayerChanged(new PlayerChangedEventArgs(CurrentHand, playerList[currentIndexPlayer].Pseudo));
|
|
|
|
|
|
|
|
nbCardAtBeginOfTurn = currentHand.Count;
|
|
|
|
nbCardAtBeginOfTurn = currentHand.Count;
|
|
|
|
CurrentCardPlayed.Clear();
|
|
|
|
CurrentCardPlayed.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OnPlayerChanged(new PlayerChangedEventArgs(currentHand, player.Pseudo));
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//if (isEndGame()) // Ajouter le score en calculant les cartes restantes dans la pile et dans les mains des joueurs
|
|
|
|
//if (isEndGame()) // Ajouter le score en calculant les cartes restantes dans la pile et dans les mains des joueurs
|
|
|
|
//{
|
|
|
|
//{
|
|
|
|
// displayWinner();
|
|
|
|
// displayWinner();
|
|
|
@ -118,7 +132,6 @@ namespace TheGameExtreme.model.gameActions.classic
|
|
|
|
//{
|
|
|
|
//{
|
|
|
|
// return true;
|
|
|
|
// return true;
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
return false; // Changer
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//protected void displayWinner()
|
|
|
|
//protected void displayWinner()
|
|
|
|