You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
3.8 KiB
127 lines
3.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using TheGameExtreme.model.card;
|
|
using TheGameExtreme.model.gameActions;
|
|
|
|
namespace TheGameExtreme.model.gameActions.classic
|
|
{
|
|
public class GameMode
|
|
{
|
|
|
|
protected List<GameAction> gameActions;
|
|
protected Piles piles;
|
|
|
|
public GameMode()
|
|
{
|
|
gameActions = new List<GameAction>();
|
|
|
|
gameActions.Add(new Piocher(piles));
|
|
gameActions.Add(new JouerUneCarte(piles));
|
|
gameActions.Add(new TerminerSonTour(piles));
|
|
}
|
|
|
|
public void load()
|
|
{
|
|
piles = new Piles();
|
|
}
|
|
|
|
public void pioche()
|
|
{
|
|
((Piocher)gameActions[0]).pioche();
|
|
}
|
|
|
|
public void playCard(int valueCard, List<Card> CurrentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed)
|
|
{
|
|
((JouerUneCarte)gameActions[1]).play(valueCard, CurrentHand, orderedStackSelected, player, CurrentCardPlayed);
|
|
if (CurrentHand.Count == 0)
|
|
{
|
|
endTurn(); // Presque bon, oublie juste d'afficher les nouvelles cartes
|
|
}
|
|
}
|
|
|
|
public void endTurn()
|
|
{
|
|
((TerminerSonTour)gameActions[2]).end();
|
|
}
|
|
|
|
|
|
// private List<Rule> playRule = new List<Rule>();
|
|
// private List<Rule> beforeEndTurnRule = new List<Rule>();
|
|
// private List<Rule> endTurnRule = new List<Rule>();
|
|
// private List<Rule> commonRule = new List<Rule>();
|
|
|
|
// public GameMode()
|
|
// {
|
|
// }
|
|
|
|
// public void addPlayRule(PlayRule rule)
|
|
// {
|
|
// playRule?.Add(rule);
|
|
// }
|
|
|
|
// public void addEndTurnRule(EndTurnRule rule)
|
|
// {
|
|
// endTurnRule?.Add(rule);
|
|
// }
|
|
|
|
// public void addBeforeEndTurnRule(BeforeEndTurnRule rule)
|
|
// {
|
|
// beforeEndTurnRule?.Add(rule);
|
|
// }
|
|
|
|
// public void addCommonRule(Rule rule)
|
|
// {
|
|
// // Vérifier que se ne soit ni une PlayRule, ni une EndTurnRule ?
|
|
// commonRule?.Add(rule);
|
|
// }
|
|
|
|
// public bool checkPlayRule(Card card, Stack<Card> orderedStack, bool bottomUp, List<Card> CurrentHand)
|
|
// {
|
|
// foreach(PlayRule rule in playRule)
|
|
// {
|
|
// if (rule.Test(card, orderedStack, bottomUp, CurrentHand)) // Gestion des messages pour savoir qu'elle règle n'est pas respecter.
|
|
// {
|
|
// return true;
|
|
// }
|
|
// }
|
|
// foreach (Rule rule in commonRule)
|
|
// {
|
|
|
|
// }
|
|
// return false;
|
|
// }
|
|
|
|
// public bool checkBeforeEndTurnRule(List<Card> CurrentCardPlayed, int nbCardAtBeginOfTurn, List<Card> CurrentHand)
|
|
// {
|
|
// foreach (BeforeEndTurnRule rule in beforeEndTurnRule)
|
|
// {
|
|
// if (!rule.Test(CurrentCardPlayed, nbCardAtBeginOfTurn, CurrentHand)) // Gestion des messages pour savoir qu'elle règle n'est pas respecter.
|
|
// {
|
|
// return false;
|
|
// }
|
|
// }
|
|
// foreach (Rule rule in commonRule)
|
|
// {
|
|
|
|
// }
|
|
// return true;
|
|
// }
|
|
|
|
// public bool checkEndTurnRule(List<Card> CurrentCardPlayed, int nbCardAtBeginOfTurn, List<Card> CurrentHand)
|
|
// {
|
|
// foreach (EndTurnRule rule in endTurnRule)
|
|
// {
|
|
// if (!rule.Test(CurrentCardPlayed, nbCardAtBeginOfTurn, CurrentHand)) // Gestion des messages pour savoir qu'elle règle n'est pas respecter.
|
|
// {
|
|
// return false;
|
|
// }
|
|
// }
|
|
// foreach (Rule rule in commonRule)
|
|
// {
|
|
|
|
// }
|
|
// return true;
|
|
// }
|
|
}
|
|
}
|