Resolution conflict

master
Baptiste ARNAUD 5 years ago
commit 5f09c3407d

@ -1,57 +1,44 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Ce code a été généré par un outil. // This code was generated by a tool.
// Version du runtime :4.0.30319.42000 // Runtime Version:4.0.30319.42000
// //
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si // Changes to this file may cause incorrect behavior and will be lost if
// le code est régénéré. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace TheGameExtreme { namespace TheGameExtreme {
using System; using System;
using System.Reflection;
/// <summary> [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. [System.Diagnostics.DebuggerNonUserCodeAttribute()]
/// </summary> [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
// Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
// à l'aide d'un outil, tel que ResGen ou Visual Studio.
// Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
// avec l'option /str ou régénérez votre projet VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class AppRessource { internal class AppRessource {
private static global::System.Resources.ResourceManager resourceMan; private static System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal AppRessource() { internal AppRessource() {
} }
/// <summary> [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. internal static System.Resources.ResourceManager ResourceManager {
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.Equals(null, resourceMan)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TheGameExtreme.AppRessource", typeof(AppRessource).Assembly); System.Resources.ResourceManager temp = new System.Resources.ResourceManager("TheGameExtreme.AppRessource", typeof(AppRessource).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes internal static System.Globalization.CultureInfo Culture {
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@ -60,114 +47,71 @@ namespace TheGameExtreme {
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Pile ascendante.
/// </summary>
internal static string StrAcendingStack { internal static string StrAcendingStack {
get { get {
return ResourceManager.GetString("StrAcendingStack", resourceCulture); return ResourceManager.GetString("StrAcendingStack", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à La pile choisie n&apos;existe pas!.
/// </summary>
internal static string StrCantGetStack { internal static string StrCantGetStack {
get { get {
return ResourceManager.GetString("StrCantGetStack", resourceCulture); return ResourceManager.GetString("StrCantGetStack", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Vous n&apos;avez pas joué assez de carte! essaye encore.
/// </summary>
internal static string StrCardPlayedLessThanTwo { internal static string StrCardPlayedLessThanTwo {
get { get {
return ResourceManager.GetString("StrCardPlayedLessThanTwo", resourceCulture); return ResourceManager.GetString("StrCardPlayedLessThanTwo", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Veuillez selectionner une carte à placer sur une pile.
/// </summary>
internal static string StrChooseCardToPlay { internal static string StrChooseCardToPlay {
get { get {
return ResourceManager.GetString("StrChooseCardToPlay", resourceCulture); return ResourceManager.GetString("StrChooseCardToPlay", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Selectionner la pile sur laquelle vous souhaitez poser la carte.
/// </summary>
internal static string StrChooseStack { internal static string StrChooseStack {
get { get {
return ResourceManager.GetString("StrChooseStack", resourceCulture); return ResourceManager.GetString("StrChooseStack", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Pile Descendante.
/// </summary>
internal static string StrDownStack { internal static string StrDownStack {
get { get {
return ResourceManager.GetString("StrDownStack", resourceCulture); return ResourceManager.GetString("StrDownStack", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est fini! Veuillez lancer une nouvelle partie!.
/// </summary>
internal static string StrEndOfGame { internal static string StrEndOfGame {
get { get {
return ResourceManager.GetString("StrEndOfGame", resourceCulture); return ResourceManager.GetString("StrEndOfGame", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Fin de tour.
/// </summary>
internal static string StrEndTurn { internal static string StrEndTurn {
get { get {
return ResourceManager.GetString("StrEndTurn", resourceCulture); return ResourceManager.GetString("StrEndTurn", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Veuillez saisir votre pseudo.
/// </summary>
internal static string StrEnterPseudo {
get {
return ResourceManager.GetString("StrEnterPseudo", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est terminé! Désolé, vous avez perdu... Essayez encore!.
/// </summary>
internal static string StrLose { internal static string StrLose {
get { get {
return ResourceManager.GetString("StrLose", resourceCulture); return ResourceManager.GetString("StrLose", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est terminé! Désolé, vous avez perdu... Vous deviez jouer trois cartes à cause de l&apos;effet \&quot;Trois cartes joué\&quot; hors votre jeu ne permet pas d&apos;en jouer autant! Essayez encore!.
/// </summary>
internal static string StrLose3CardEffect { internal static string StrLose3CardEffect {
get { get {
return ResourceManager.GetString("StrLose3CardEffect", resourceCulture); return ResourceManager.GetString("StrLose3CardEffect", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Le joueur n&apos;a plus de carte dans sa main.
/// </summary>
internal static string StrNoMoreCardOnHand { internal static string StrNoMoreCardOnHand {
get { get {
return ResourceManager.GetString("StrNoMoreCardOnHand", resourceCulture); return ResourceManager.GetString("StrNoMoreCardOnHand", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Recherche une chaîne localisée semblable à Veuillez choisir un nombre de joueur et leur(s) nom(s). /// Recherche une chaîne localisée semblable à Veuillez choisir un nombre de joueur et leur(s) nom(s).
/// </summary> /// </summary>
@ -198,31 +142,40 @@ namespace TheGameExtreme {
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Désolé, vous n&apos;avez pas recouvert la tête de mort... Réessayez ;).
/// </summary>
internal static string StrSkullEffect { internal static string StrSkullEffect {
get { get {
return ResourceManager.GetString("StrSkullEffect", resourceCulture); return ResourceManager.GetString("StrSkullEffect", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à Le jeu est terminé!\n Bravo vous avez gagné!.
/// </summary>
internal static string StrWin { internal static string StrWin {
get { get {
return ResourceManager.GetString("StrWin", resourceCulture); return ResourceManager.GetString("StrWin", resourceCulture);
} }
} }
/// <summary>
/// Recherche une chaîne localisée semblable à La carte ne rentre pas dans la pile sectionnée!.
/// </summary>
internal static string StrWrongStack { internal static string StrWrongStack {
get { get {
return ResourceManager.GetString("StrWrongStack", resourceCulture); return ResourceManager.GetString("StrWrongStack", resourceCulture);
} }
} }
internal static string StrPlayerSelection {
get {
return ResourceManager.GetString("StrPlayerSelection", resourceCulture);
}
}
internal static string StrEnterPseudo {
get {
return ResourceManager.GetString("StrEnterPseudo", resourceCulture);
}
}
internal static string StrCardDoesntExist {
get {
return ResourceManager.GetString("StrCardDoesntExist", resourceCulture);
}
}
} }
} }

@ -0,0 +1,185 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TheGameExtreme {
using System;
using System.Reflection;
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class AppRessource {
private static System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal AppRessource() {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Resources.ResourceManager ResourceManager {
get {
if (object.Equals(null, resourceMan)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("TheGameExtreme.AppRessource", typeof(AppRessource).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static string StrAcendingStack {
get {
return ResourceManager.GetString("StrAcendingStack", resourceCulture);
}
}
internal static string StrCantGetStack {
get {
return ResourceManager.GetString("StrCantGetStack", resourceCulture);
}
}
internal static string StrCardPlayedLessThanTwo {
get {
return ResourceManager.GetString("StrCardPlayedLessThanTwo", resourceCulture);
}
}
internal static string StrChooseCardToPlay {
get {
return ResourceManager.GetString("StrChooseCardToPlay", resourceCulture);
}
}
internal static string StrChooseStack {
get {
return ResourceManager.GetString("StrChooseStack", resourceCulture);
}
}
internal static string StrDownStack {
get {
return ResourceManager.GetString("StrDownStack", resourceCulture);
}
}
internal static string StrEndOfGame {
get {
return ResourceManager.GetString("StrEndOfGame", resourceCulture);
}
}
internal static string StrEndTurn {
get {
return ResourceManager.GetString("StrEndTurn", resourceCulture);
}
}
internal static string StrLose {
get {
return ResourceManager.GetString("StrLose", resourceCulture);
}
}
internal static string StrLose3CardEffect {
get {
return ResourceManager.GetString("StrLose3CardEffect", resourceCulture);
}
}
internal static string StrNoMoreCardOnHand {
get {
return ResourceManager.GetString("StrNoMoreCardOnHand", resourceCulture);
}
}
<<<<<<< HEAD
/// <summary>
/// Recherche une chaîne localisée semblable à Veuillez choisir un nombre de joueur et leur(s) nom(s).
/// </summary>
internal static string StrPlayerSelection {
get {
return ResourceManager.GetString("StrPlayerSelection", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à -L&apos;objectif est de battre la machine ! Seul ou à plusieurs !
///
///-Le but est de pouvoir poser toute les cartes de la pioche sur les différentes piles à votre disposition.
///
///-Le jeu comporte 98 cartes numérotées de 2 à 99.
///
///-4 piles sont à votre disposition, deux ascendantes(↑), et deux descendantes(↓).
///
///-L&apos;objectif est de réussir à poser la totalité des cartes sur les piles proposées, afin de gagner la partie.
///
///-Chaque joueur doit jouer au minimum deux cartes par tour.
///
///-Pour empiler les cartes sur [le reste de la chaîne a été tronqué]&quot;;.
/// </summary>
=======
>>>>>>> cdc2bef24a6392b08e134d0afee1b981aa8f2c80
internal static string StrRules {
get {
return ResourceManager.GetString("StrRules", resourceCulture);
}
}
internal static string StrSkullEffect {
get {
return ResourceManager.GetString("StrSkullEffect", resourceCulture);
}
}
internal static string StrWin {
get {
return ResourceManager.GetString("StrWin", resourceCulture);
}
}
internal static string StrWrongStack {
get {
return ResourceManager.GetString("StrWrongStack", resourceCulture);
}
}
internal static string StrPlayerSelection {
get {
return ResourceManager.GetString("StrPlayerSelection", resourceCulture);
}
}
internal static string StrEnterPseudo {
get {
return ResourceManager.GetString("StrEnterPseudo", resourceCulture);
}
}
internal static string StrCardDoesntExist {
get {
return ResourceManager.GetString("StrCardDoesntExist", resourceCulture);
}
}
}
}

@ -189,4 +189,7 @@
<data name="StrEnterPseudo" xml:space="preserve"> <data name="StrEnterPseudo" xml:space="preserve">
<value>Veuillez saisir votre pseudo</value> <value>Veuillez saisir votre pseudo</value>
</data> </data>
<data name="StrCardDoesntExist" xml:space="preserve">
<value>Carte inexistante</value>
</data>
</root> </root>

@ -22,6 +22,8 @@
<Folder Include="model\gameActions\extreme\" /> <Folder Include="model\gameActions\extreme\" />
<Folder Include="model\gameActions\classic\" /> <Folder Include="model\gameActions\classic\" />
<Folder Include="Media\" /> <Folder Include="Media\" />
<Folder Include="model\card\cardType\" />
<Folder Include="model\piles\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="model\effect\StopColm.cs" /> <Compile Remove="model\effect\StopColm.cs" />

@ -7,8 +7,8 @@ namespace TheGameExtreme.model.card
{ {
//public event PropertyChangedEventHandler PropertyChanged; //public event PropertyChangedEventHandler PropertyChanged;
private int value; private decimal value;
public int Value public decimal Value
{ {
get { return value; } get { return value; }
set set
@ -23,7 +23,7 @@ namespace TheGameExtreme.model.card
//} //}
public Card(int value) public Card(decimal value)
{ {
Value = value; Value = value;
} }

@ -1,13 +1,13 @@
using System; using System;
namespace TheGameExtreme.model.card namespace TheGameExtreme.model.card.cardType
{ {
public class ClassicCard : Card public class ClassicCard : Card
{ {
public static readonly String CARD_CLASSIC = "ClassicCard"; public static readonly String CARD_CLASSIC = "ClassicCard";
public ClassicCard(int value) public ClassicCard(decimal value)
: base(value) : base(value)
{ {
} }

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TheGameExtreme.model.gameActions.classic; using TheGameExtreme.model.gameActions.classic;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model namespace TheGameExtreme.model
{ {

@ -1,5 +1,6 @@
using System; using System;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.deck namespace TheGameExtreme.model.deck
{ {

@ -0,0 +1,19 @@
using System;
using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.deck
{
public class DecimalDeck : Deck
{
public DecimalDeck()
{
Card card;
for (decimal i = 0.02m; i <= 0.99m; i += 0.01m)
{
card = new ClassicCard(i);
deck.Add(card);
}
}
}
}

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
namespace TheGameExtreme.model namespace TheGameExtreme.model.deck
{ {
public abstract class Deck public abstract class Deck
{ {

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
using TheGameExtreme.model.card.rapidCard; using TheGameExtreme.model.card.rapidCard;
namespace TheGameExtreme.model.deck namespace TheGameExtreme.model.deck

@ -0,0 +1,19 @@
using System;
using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.deck
{
public class _50Range100Deck : Deck
{
public _50Range100Deck()
{
Card card;
for (int i = -49; i <= 49; i++)
{
card = new ClassicCard(i);
deck.Add(card);
}
}
}
}

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using TheGameExtreme.model.piles;
using TheGameExtreme.model.card;
namespace TheGameExtreme.model.gameActions namespace TheGameExtreme.model.gameActions
{ {

@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using TheGameExtreme.model.card;
namespace TheGameExtreme.model.gameActions
{
public class Piles
{
private List<Stack<Card>> ListOrderedStacks { get; set; }
public Piles()
{
ListOrderedStacks = new List<Stack<Card>>();
ListOrderedStacks.Add(new Stack<Card>());
ListOrderedStacks.Add(new Stack<Card>());
ListOrderedStacks.Add(new Stack<Card>());
ListOrderedStacks.Add(new Stack<Card>());
for (int i = 0; i < 4; i++)
{
if (i < 2)
{
ListOrderedStacks[i].Push(new ClassicCard(1));
}
else
{
ListOrderedStacks[i].Push(new ClassicCard(100));
}
}
}
public Stack<Card> getStack(int i)
{
return ListOrderedStacks[i];
}
}
}

@ -3,6 +3,7 @@ using System.Collections.Generic;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.deck; using TheGameExtreme.model.deck;
using TheGameExtreme.model.@event; using TheGameExtreme.model.@event;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.classic namespace TheGameExtreme.model.gameActions.classic
{ {
@ -33,20 +34,19 @@ namespace TheGameExtreme.model.gameActions.classic
#endregion #endregion
public GameMode() public GameMode(Piles piles, Deck deck)
{ {
gameActions = new List<GameAction>(); gameActions = new List<GameAction>();
Piles = piles;
this.deck = deck;
} }
public void load(int nbPlayer, List<Player> players) public void load(int nbPlayer, List<Player> players)
{ {
Piles = new Piles();
gameActions.Add(new Piocher(Piles)); gameActions.Add(new Piocher(Piles));
gameActions.Add(new JouerUneCarte(Piles)); gameActions.Add(new JouerUneCarte(Piles));
gameActions.Add(new TerminerSonTour(Piles)); gameActions.Add(new TerminerSonTour(Piles));
deck = new ClassicDeck();
defineNbMaxCard(nbPlayer); defineNbMaxCard(nbPlayer);
distribueCard(players); distribueCard(players);
} }
@ -74,9 +74,9 @@ namespace TheGameExtreme.model.gameActions.classic
{ {
if (start < end) if (start < end)
{ {
int pivot = ar[end].Value; decimal pivot = ar[end].Value;
int pIndex = start; int pIndex = start;
int swap; decimal swap;
for (int i = start; i < end; i++) for (int i = start; i < end; i++)
{ {
@ -119,7 +119,7 @@ namespace TheGameExtreme.model.gameActions.classic
quickSort(currentHand, 0, currentHand.Count - 1); quickSort(currentHand, 0, currentHand.Count - 1);
} }
public bool playCard(int valueCard, List<Card> currentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed) public bool playCard(decimal valueCard, List<Card> currentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed)
{ {
Message = null; Message = null;
if (((JouerUneCarte)gameActions[1]).play(valueCard, currentHand, orderedStackSelected, player, CurrentCardPlayed)) if (((JouerUneCarte)gameActions[1]).play(valueCard, currentHand, orderedStackSelected, player, CurrentCardPlayed))
@ -141,14 +141,27 @@ namespace TheGameExtreme.model.gameActions.classic
pioche(currentHand, player); pioche(currentHand, player);
CurrentCardPlayed.Clear(); CurrentCardPlayed.Clear();
OnPlayerChanged(null); OnPlayerChanged(null);
return ((TerminerSonTour)gameActions[2]).Test(currentHand); if (((TerminerSonTour)gameActions[2]).Test(currentHand))
{
return false;
} }
else else
{ {
Message = ((TerminerSonTour)gameActions[2]).ErrorMessage; OnEndGame(new EventArgs());
return true; return true;
} }
} }
else
{
Message = ((TerminerSonTour)gameActions[2]).ErrorMessage;
return false;
}
}
public string getScore()
{
return deck.size().ToString();
}
#region Decaler dans un GameAction #region Decaler dans un GameAction

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.classic namespace TheGameExtreme.model.gameActions.classic
{ {
@ -14,11 +15,11 @@ namespace TheGameExtreme.model.gameActions.classic
{ {
} }
public bool play(int valueCard, List<Card> CurrentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed) public bool play(decimal valueCard, List<Card> CurrentHand, int orderedStackSelected, Player player, List<Card> CurrentCardPlayed)
{ {
foreach (Card card in CurrentHand) foreach (Card card in CurrentHand)
{ {
if (valueCard == card.Value) if (valueCard.CompareTo(card.Value) == 0)
{ {
if (orderedStackSelected >= 0 && orderedStackSelected < 4) if (orderedStackSelected >= 0 && orderedStackSelected < 4)
{ {
@ -39,12 +40,13 @@ namespace TheGameExtreme.model.gameActions.classic
} }
} }
} }
ErrorMessage = AppRessource.StrCardDoesntExist;
return false; return false;
} }
private bool rule(Card card, Stack<Card> stack, bool bottomUp, Player player, List<Card> CurrentCardPlayed) private bool rule(Card card, Stack<Card> stack, bool bottomUp, Player player, List<Card> CurrentCardPlayed)
{ {
if ((bottomUp && card.Value > stack.Peek().Value) || (!bottomUp && card.Value < stack.Peek().Value) || card.Value == stack.Peek().Value - 10 || card.Value == stack.Peek().Value + 10) if ((bottomUp && card.Value > stack.Peek().Value) || (!bottomUp && card.Value < stack.Peek().Value) || card.Value.CompareTo(stack.Peek().Value - 10) == 0 || card.Value.CompareTo(stack.Peek().Value + 10) == 0)
{ {
OldCard = stack.Peek(); OldCard = stack.Peek();
player.joue(card); player.joue(card);

@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.deck;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.classic namespace TheGameExtreme.model.gameActions.classic
{ {

@ -2,13 +2,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.card.rapidCard; using TheGameExtreme.model.card.rapidCard;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.classic namespace TheGameExtreme.model.gameActions.classic
{ {
public class TerminerSonTour : GameAction public class TerminerSonTour : GameAction
{ {
public TerminerSonTour(Piles ListOrderedStacks) : base(ListOrderedStacks) public TerminerSonTour(Piles ListOrderedStacks) : base(ListOrderedStacks)
{ {
} }

@ -1,5 +1,6 @@
using System; using System;
using TheGameExtreme.model.gameActions.classic; using TheGameExtreme.model.gameActions.classic;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.extreme namespace TheGameExtreme.model.gameActions.extreme
{ {

@ -1,11 +1,13 @@
using System; using System;
using TheGameExtreme.model.deck;
using TheGameExtreme.model.gameActions.classic; using TheGameExtreme.model.gameActions.classic;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.extreme namespace TheGameExtreme.model.gameActions.extreme
{ {
public class ExtremeMode : GameMode public class ExtremeMode : GameMode
{ {
public ExtremeMode() public ExtremeMode(Piles piles, Deck deck) : base(piles, deck)
{ {
gameActions.Add(new ExtremePiocher(Piles)); gameActions.Add(new ExtremePiocher(Piles));
gameActions.Add(new ExtremeJouerUneCarte(Piles)); gameActions.Add(new ExtremeJouerUneCarte(Piles));

@ -1,5 +1,6 @@
using System; using System;
using TheGameExtreme.model.gameActions.classic; using TheGameExtreme.model.gameActions.classic;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.extreme namespace TheGameExtreme.model.gameActions.extreme
{ {

@ -1,5 +1,6 @@
using System; using System;
using TheGameExtreme.model.gameActions.classic; using TheGameExtreme.model.gameActions.classic;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.gameActions.extreme namespace TheGameExtreme.model.gameActions.extreme
{ {

@ -4,6 +4,7 @@ using System.ComponentModel;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.@event; using TheGameExtreme.model.@event;
using TheGameExtreme.model.gameActions; using TheGameExtreme.model.gameActions;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.model.manager namespace TheGameExtreme.model.manager
{ {
@ -48,6 +49,17 @@ namespace TheGameExtreme.model.manager
currentIndexPlayer = 0; currentIndexPlayer = 0;
} }
CurrentHand = parametreur.players[currentIndexPlayer].getCardList(); CurrentHand = parametreur.players[currentIndexPlayer].getCardList();
int i = 0;
while (CurrentHand.Count == 0 && i != 5)
{
currentIndexPlayer += 1;
if (currentIndexPlayer == parametreur.players.Count)
{
currentIndexPlayer = 0;
}
CurrentHand = parametreur.players[currentIndexPlayer].getCardList();
i++; // Garde fou
}
PlayerChanged?.Invoke(source, new PlayerChangedEventArgs(CurrentHand, parametreur.players[currentIndexPlayer].Pseudo)); PlayerChanged?.Invoke(source, new PlayerChangedEventArgs(CurrentHand, parametreur.players[currentIndexPlayer].Pseudo));
parametreur.GameMode.NbCardAtBeginOfTurn = CurrentHand.Count; parametreur.GameMode.NbCardAtBeginOfTurn = CurrentHand.Count;
} }
@ -71,7 +83,7 @@ namespace TheGameExtreme.model.manager
public bool joue(int valueCard, int orderedStackSelected) public bool joue(int orderedStackSelected, decimal valueCard)
{ {
bool isPlayed = parametreur.GameMode.playCard(valueCard, currentHand, orderedStackSelected, parametreur.players[currentIndexPlayer], CurrentCardPlayed); // Mettre le joueur actif bool isPlayed = parametreur.GameMode.playCard(valueCard, currentHand, orderedStackSelected, parametreur.players[currentIndexPlayer], CurrentCardPlayed); // Mettre le joueur actif
EndMessage = parametreur.GameMode.Message; EndMessage = parametreur.GameMode.Message;
@ -82,215 +94,19 @@ namespace TheGameExtreme.model.manager
{ {
if(parametreur.GameMode.endTurn(currentHand, CurrentCardPlayed, parametreur.players[currentIndexPlayer])) if(parametreur.GameMode.endTurn(currentHand, CurrentCardPlayed, parametreur.players[currentIndexPlayer]))
{ {
EndMessage = parametreur.GameMode.Message; EndMessage = parametreur.GameMode.Message + "Il vous restait " + parametreur.GameMode.getScore() + " cartes à jouer!";
if (isEndGame())
{
EndMessage = parametreur.GameMode.Message;
return true; return true;
} }
else else
{ {
return false; EndMessage = parametreur.GameMode.Message;
}
}
else
{
return false; return false;
} }
} }
private bool isEndGame()
{
return parametreur.GameMode.isEndGame(currentHand);
}
public Piles getPiles() public Piles getPiles()
{ {
return parametreur.GameMode.Piles; return parametreur.GameMode.Piles;
} }
//public readonly int nbPlayer;
//protected int nbMaxCard;
//protected int currentIndexPlayer;
//protected List<Player> playerList = new List<Player>();
//public List<Stack<Card>> ListOrderedStacks { get; set; }
//protected Deck deck;
//protected bool win = true;
//public String EndMessage { get; set; }
//public List<Card> CurrentHand { get; set; }
//protected int nbCardAtBeginOfTurn;
//protected List<Card> CurrentCardPlayed = new List<Card>();
//protected string langue;
//public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
//public event EventHandler<PlayerChangedEventArgs> PlayerChanged;
//protected GameManager(int nbPlayer, List<String> players)
//{
// ListOrderedStacks = new List<Stack<Card>>();
// CurrentHand = new List<Card>();
// this.nbPlayer = nbPlayer;
// players.ForEach(player => playerList.Add(new Player(player)));
// initStacks();
// initRule();
// createDeck();
// defineNbMaxCard();
// distribueCard();
// CurrentHand = playerList[currentIndexPlayer].getCardList();
// nbCardAtBeginOfTurn = CurrentHand.Count;
//}
//protected void initStacks()
//{
// ListOrderedStacks = new List<Stack<Card>>();
// ListOrderedStacks.Add(new Stack<Card>());
// ListOrderedStacks.Add(new Stack<Card>());
// ListOrderedStacks.Add(new Stack<Card>());
// ListOrderedStacks.Add(new Stack<Card>());
// for (int i = 0; i < 4; i++)
// {
// if (i < 2)
// {
// ListOrderedStacks[i].Push(new ClassicCard(1));
// }
// else
// {
// ListOrderedStacks[i].Push(new ClassicCard(100));
// }
// }
//}
//protected void createDeck()
//{
// switch (true)
// {
// case false:
// deck = new ClassicDeck();
// break;
// default:
// deck = new ExtremeDeck();
// break;
// }
//}
//protected void defineNbMaxCard()
//{
// switch (nbPlayer)
// {
// case 1:
// nbMaxCard = 8;
// break;
// case 2:
// nbMaxCard = 7;
// break;
// default:
// nbMaxCard = 6;
// break;
// }
//}
//protected void distribueCard()
//{
// for (int i = 0; i < nbMaxCard; i++)
// {
// players.ForEach(player =>
// {
// int r = new Random().Next(0, deck.size() - 1);
// player.pioche(deck.getCard(r));
// deck.removeAt(r);
// });
// }
//}
//public void joue(int valueCard, int orderedStackSelected)
//{
// gameMode.playCard(valueCard, CurrentHand, orderedStackSelected, players[0], CurrentCardPlayed); // Mettre le joueur actif
//}
//protected void testPossibility(Card card, Stack<Card> orderedStack, bool bottomUp)
//{
// //if (gameMode.checkPlayRule(card, orderedStack, bottomUp, CurrentHand))
// //{
// // Card oldCard = orderedStack.Peek();
// // playerList[currentIndexPlayer].joue(card);
// // CurrentCardPlayed.Add(card);
// // orderedStack.Push(card);
// // OnTopRangeChanged(new TopRangeChangedEventArgs(card, oldCard, ListOrderedStacks.IndexOf(orderedStack)));
// // //if (CurrentHand.Count == 0)
// // //{
// // // endTurn(); // Presque bon, oublie juste d'afficher les nouvelles cartes
// // //}
// //}
// //else
// //{
// // throw new Exception(AppRessource.StrWrongStack);
// //}
//}
//protected internal void OnTopRangeChanged(TopRangeChangedEventArgs args)
//{
// TopRangeChanged?.Invoke(this, args);
//}
//protected internal void OnPlayerChanged(PlayerChangedEventArgs args)
//{
// PlayerChanged?.Invoke(this, args);
//}
//public bool isCanPlay()
//{
// if (CurrentHand.Count > 0)
// {
// return true;
// }
// else
// {
// return false;
// }
//}
//abstract public bool endTurn();
//abstract protected bool isEndGame();
//abstract protected void tryToFindSoluce(List<Card> playableCard);
//abstract protected bool testEndGame(List<Card> playableCard);
//abstract protected bool effectLose();
//public int getCurentIndexPlayer()
//{
// return currentIndexPlayer;
//}
} }
} }

@ -12,164 +12,5 @@ namespace TheGameExtreme.model.manager
{ {
} }
//public override bool endTurn()
//{
// //if (gameMode.checkBeforeEndTurnRule(CurrentCardPlayed, nbCardAtBeginOfTurn, CurrentHand))
// //{
// // //verifyNbCardPlay();
// // pioche();
// // currentIndexPlayer += 1;
// // if (currentIndexPlayer == playerList.Count)
// // {
// // currentIndexPlayer = 0;
// // }
// // CurrentHand = playerList[currentIndexPlayer].getCardList();
// // OnPlayerChanged(new PlayerChangedEventArgs(CurrentHand, playerList[currentIndexPlayer].Pseudo));
// // nbCardAtBeginOfTurn = CurrentHand.Count;
// // CurrentCardPlayed.Clear();
// // if (gameMode.checkEndTurnRule(CurrentCardPlayed, nbCardAtBeginOfTurn, CurrentHand))
// // {
// // //if (isEndGame()) // Ajouter le score en calculant les cartes restantes dans la pile et dans les mains des joueurs
// // //{
// // // displayWinner();
// // // return true;
// // //}
// // return false;
// // }
// // else
// // {
// // return true;
// // }
// //}
// //else
// //{
// // return false;
// //}
//}
//protected void verifyNbCardPlay()
//{
// foreach (Card cardPlayed in CurrentCardPlayed)
// {
// if (Equals(cardPlayed.GetType(), ThreeCard.CARD_THREE))
// {
// if ((nbCardAtBeginOfTurn - CurrentHand.Count) < 3) // Penser à vérifier s'il a joué une ThreeCard pour regarder s'il a bien joué 3 cartes
// {
// testIsEndGame();
// }
// return;
// }
// }
// if ((nbCardAtBeginOfTurn - CurrentHand.Count) < 2) // Penser à vérifier s'il a joué une ThreeCard pour regarder s'il a bien joué 3 cartes
// {
// testIsEndGame();
// }
//}
//protected void testIsEndGame()
//{
// if (isEndGame())
// {
// displayWinner();
// }
// else
// {
// //throw new Exception("Vous n'avez pas joué assez de carte!");
// throw new Exception(AppRessources_br.StrCardPlayedLessThanTwo);
// }
//}
//protected void displayWinner()
//{
// if (win)
// {
// EndMessage = "Le jeu est terminé!\n Bravo vous avez gagné!";
// EndMessage = AppRessource.StrWin;
// }
//}
//protected void pioche()
//{
// int nbPickedCard = nbMaxCard - CurrentHand.Count;
// for (int i = 0; i < nbPickedCard; i++)
// {
// if (deck.size() == 0)
// {
// return;
// }
// int random = new Random().Next(0, deck.size() - 1);
// playerList[currentIndexPlayer].pioche(deck.getCard(random));
// deck.removeAt(random);
// }
//}
//protected override bool isEndGame()
//{
// if (CurrentHand.Count != 0)
// {
// List<Card> playableCard = new List<Card>();
// tryToFindSoluce(playableCard);
// return testEndGame(playableCard);
// }
// return false;
//}
//protected override void tryToFindSoluce(List<Card> playableCard)
//{
// CurrentHand.ForEach(card =>
// {
// if (card.Value > ListOrderedStacks[0].Peek().Value || card.Value > ListOrderedStacks[1].Peek().Value || card.Value < ListOrderedStacks[2].Peek().Value || card.Value < ListOrderedStacks[3].Peek().Value)
// {
// playableCard.Add(card);
// }
// });
//}
//protected override bool testEndGame(List<Card> playableCard)
//{
// if (playableCard.Count == 2)
// {
// foreach (Card c in playableCard)
// {
// if (Equals(c.getName(), ThreeCard.CARD_THREE))
// {
// win = false;
// EndMessage = "Le jeu est terminé!\n Désolé, vous avez perdu... Vous deviez jouer trois cartes à cause de l'effet \"Trois cartes joué\" hors votre jeu ne permet pas d'en jouer autant! Essayez encore!";
// return true;
// }
// }
// }
// else if (playableCard.Count < 2)
// {
// win = false;
// EndMessage = "Le jeu est terminé!\n Désolé, vous avez perdu... Essayez encore!";
// return true;
// }
// else if (effectLose())
// {
// win = false;
// EndMessage = "Désolé, vous n'avez pas recouvert la tête de mort... Réessayez ;)";
// return true;
// }
// return false;
//}
//protected override bool effectLose()
//{
// foreach (Stack<Card> orderedStack in ListOrderedStacks)
// {
// if (Equals(orderedStack.Peek().getName(), EndGameCard.CARD_ENDGAME))
// {
// return true;
// }
// }
// return false;
//}
} }
} }

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
using TheGameExtreme.model.deck;
namespace TheGameExtreme.model.piles
{
public class ClassicPiles : Piles
{
public ClassicPiles(int nbPile) : base(nbPile)
{
for (int i = 0; i < nbPile; i++)
{
if (i < (nbPile * 0.5))
{
ListOrderedStacks[i].Push(new ClassicCard(1));
}
else
{
ListOrderedStacks[i].Push(new ClassicCard(100));
}
}
}
}
}

@ -0,0 +1,24 @@
using System;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.piles
{
public class DecimalPiles : Piles
{
public DecimalPiles(int nbPile) : base(nbPile)
{
for (int i = 0; i < nbPile; i++)
{
if (i < (nbPile * 0.5))
{
ListOrderedStacks[i].Push(new ClassicCard(0.01m));
}
else
{
ListOrderedStacks[i].Push(new ClassicCard(1m));
}
}
}
}
}

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using TheGameExtreme.model.card;
namespace TheGameExtreme.model.piles
{
public abstract class Piles
{
protected List<Stack<Card>> ListOrderedStacks { get; set; } = new List<Stack<Card>>();
public Piles(int nbPile)
{
for (int i = 0; i < nbPile; i++)
{
ListOrderedStacks.Add(new Stack<Card>());
}
}
public Stack<Card> getStack(int i)
{
return ListOrderedStacks[i];
}
}
}

@ -0,0 +1,23 @@
using System;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.piles
{
public class _50Range100Piles : Piles
{
public _50Range100Piles(int nbPile) : base(nbPile)
{
for (int i = 0; i < nbPile; i++)
{
if (i < (nbPile * 0.5))
{
ListOrderedStacks[i].Push(new ClassicCard(-50));
}
else
{
ListOrderedStacks[i].Push(new ClassicCard(50));
}
}
}
}
}

@ -65,14 +65,21 @@ namespace TheGameExtreme.view
canvas = args.Surface.Canvas; canvas = args.Surface.Canvas;
canvas.Clear(); canvas.Clear();
foreach (TouchManipulationBitmap textPaint in stackCollection) for (int i = 0; i < stackCollection.Count; i++)
{ {
textPaint.Paint(canvas); if (i < (stackCollection.Count * 0.5))
{
stackCollection[i].Paint(canvas, SKColors.Green);
}
else
{
stackCollection[i].Paint(canvas, SKColors.Red);
}
} }
foreach (TouchManipulationBitmap textPaint in textCollection) foreach (TouchManipulationBitmap textPaint in textCollection)
{ {
textPaint.Paint(canvas); textPaint.Paint(canvas, SKColors.SkyBlue);
} }
} }
@ -127,7 +134,7 @@ namespace TheGameExtreme.view
if (stack.HitTest(point)) if (stack.HitTest(point))
{ {
int indexPile = stackCollection.IndexOf(stack); int indexPile = stackCollection.IndexOf(stack);
if (played(indexPile, int.Parse(bitmap.Value))) if (played(indexPile, decimal.Parse(bitmap.Value)))
{ {
point = stack.InitialPoint; point = stack.InitialPoint;
bitmap.ProcessTouchEvent(args.Id, TouchActionType.Moved, point); bitmap.ProcessTouchEvent(args.Id, TouchActionType.Moved, point);
@ -169,7 +176,7 @@ namespace TheGameExtreme.view
stackCollection.Clear(); stackCollection.Clear();
SKPaint textPaint = new SKPaint(); SKPaint textPaint = new SKPaint();
float textWidth = textPaint.MeasureText("01"); float textWidth = textPaint.MeasureText("001");
float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth; float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.05) - (textWidth * 0.5)), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.01 + 2 * textSize)); SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.05) - (textWidth * 0.5)), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.01 + 2 * textSize));
@ -184,14 +191,14 @@ namespace TheGameExtreme.view
InitialPoint = position InitialPoint = position
}); });
position.X += (float)(DeviceDisplay.MainDisplayInfo.Width * 0.2); position.X += (float)((DeviceDisplay.MainDisplayInfo.Width * 0.9) / viewmodel.getListOrderedStacks().Count);
} }
} }
private void InflateHand() private void InflateHand()
{ {
SKPaint textPaint = new SKPaint(); SKPaint textPaint = new SKPaint();
float textWidth = textPaint.MeasureText("01"); float textWidth = textPaint.MeasureText("001");
float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth; float textSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
SKPoint position = new SKPoint((float)(DeviceDisplay.MainDisplayInfo.Width * 0.05), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.2 - textSize)); SKPoint position = new SKPoint((float)(DeviceDisplay.MainDisplayInfo.Width * 0.05), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.2 - textSize));
@ -222,7 +229,7 @@ namespace TheGameExtreme.view
gameOption.Children.Add(retryButton); gameOption.Children.Add(retryButton);
} }
private bool played(int numStack, int value) private bool played(int numStack, decimal value)
{ {
if (!viewmodel.played(numStack, value)) if (!viewmodel.played(numStack, value))
{ {

@ -11,17 +11,18 @@ namespace TheGameExtreme.view
Dictionary<long, TouchManipulationInfo> touchDictionary = new Dictionary<long, TouchManipulationInfo>(); Dictionary<long, TouchManipulationInfo> touchDictionary = new Dictionary<long, TouchManipulationInfo>();
public string Value; public string Value;
public TouchManipulationBitmap(SKPaint textPaint, int value) public TouchManipulationBitmap(SKPaint textPaint, decimal value)
{ {
this.textPaint = textPaint; this.textPaint = textPaint;
if (value > 0 && value < 10)
{
Value = "0" + value.ToString();
}
else
{
Value = value.ToString(); Value = value.ToString();
} //if (value > 0 && value < 10)
//{
// Value = "0" + value.ToString();
//}
//else
//{
// Value = value.ToString();
//}
Matrix = SKMatrix.MakeIdentity(); Matrix = SKMatrix.MakeIdentity();
@ -35,14 +36,14 @@ namespace TheGameExtreme.view
public SKMatrix Matrix { set; get; } public SKMatrix Matrix { set; get; }
public void Paint(SKCanvas canvas) public void Paint(SKCanvas canvas, SKColor color)
{ {
canvas.Save(); canvas.Save();
SKMatrix matrix = Matrix; SKMatrix matrix = Matrix;
canvas.Concat(ref matrix); canvas.Concat(ref matrix);
textPaint.Color = SKColors.SkyBlue; textPaint.Color = color;
textPaint.StrokeWidth = 5; textPaint.StrokeWidth = 5;
textPaint.Style = SKPaintStyle.Stroke; textPaint.Style = SKPaintStyle.Stroke;
@ -57,6 +58,12 @@ namespace TheGameExtreme.view
canvas.DrawText(Value, 0, 0, textPaint); canvas.DrawText(Value, 0, 0, textPaint);
canvas.Restore(); canvas.Restore();
}
public void ChangeColor(SKColor color)
{
textPaint.Color = color;
} }
public bool HitTest(SKPoint location) public bool HitTest(SKPoint location)

@ -13,8 +13,8 @@ namespace TheGameExtreme.viewmodel
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
public Card View { get; set; } public Card View { get; set; }
protected int value; protected decimal value;
public int Value { public decimal Value {
get { return value; } get { return value; }
set set
{ {

@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using TheGameExtreme.model; using TheGameExtreme.model;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.deck;
using TheGameExtreme.model.@event; using TheGameExtreme.model.@event;
using TheGameExtreme.model.gameActions.classic; using TheGameExtreme.model.gameActions.classic;
using TheGameExtreme.model.manager; using TheGameExtreme.model.manager;
using TheGameExtreme.model.piles;
namespace TheGameExtreme.viewmodel namespace TheGameExtreme.viewmodel
{ {
@ -51,10 +53,11 @@ namespace TheGameExtreme.viewmodel
public Main(List<string> playersNames) public Main(List<string> playersNames)
{ {
int nbPile = 4;
playersNames.ForEach(name => players.Add(new PlayerVM(new Player(name)))); playersNames.ForEach(name => players.Add(new PlayerVM(new Player(name))));
Parametreur parametreur = new Parametreur(new GameMode()); Parametreur parametreur = new Parametreur(new GameMode(new ClassicPiles(nbPile), new ClassicDeck()));
players.ForEach(player => parametreur.AddPlayer(player.View)); players.ForEach(player => parametreur.AddPlayer(player.View));
gameManager = new SoloGameManager(parametreur) ; // Donner le nom des joueurs gameManager = new SoloGameManager(parametreur);
gameManager.EndGame += OnEndGame; gameManager.EndGame += OnEndGame;
@ -67,7 +70,7 @@ namespace TheGameExtreme.viewmodel
Pseudo = players[0].Pseudo; Pseudo = players[0].Pseudo;
for (int i = 0; i < 4; i++) for (int i = 0; i < nbPile; i++)
{ {
Stack<Card> pileView = gameManager.getPiles().getStack(i); Stack<Card> pileView = gameManager.getPiles().getStack(i);
Stack<CardVM> pile = new Stack<CardVM>(); Stack<CardVM> pile = new Stack<CardVM>();
@ -106,9 +109,9 @@ namespace TheGameExtreme.viewmodel
* *
* @return booléen de fin de jeu * @return booléen de fin de jeu
*/ */
public bool played(int numStack, int valueCard) public bool played(int numStack, decimal valueCard)
{ {
if (!gameManager.joue(valueCard, numStack)) if (!gameManager.joue(numStack, valueCard))
{ {
Alert = gameManager.EndMessage; Alert = gameManager.EndMessage;
return false; return false;
@ -121,10 +124,6 @@ namespace TheGameExtreme.viewmodel
{ {
bool isEnd = gameManager.endTurn(); bool isEnd = gameManager.endTurn();
Alert = gameManager.EndMessage; Alert = gameManager.EndMessage;
if (isEnd)
{
OnEndGame(this, new EventArgs());
}
return isEnd; return isEnd;
} }

Loading…
Cancel
Save