diff --git a/TheGameExtreme.Android/Properties/AndroidManifest.xml b/TheGameExtreme.Android/Properties/AndroidManifest.xml index 469b73b..3521662 100644 --- a/TheGameExtreme.Android/Properties/AndroidManifest.xml +++ b/TheGameExtreme.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/TheGameExtreme.Android/Resources/Resource.designer.cs b/TheGameExtreme.Android/Resources/Resource.designer.cs index 4d79f6d..66d6375 100644 --- a/TheGameExtreme.Android/Resources/Resource.designer.cs +++ b/TheGameExtreme.Android/Resources/Resource.designer.cs @@ -1,11 +1,11 @@ #pragma warning disable 1591 //------------------------------------------------------------------------------ // -// Ce code a été généré par un outil. -// Version du runtime :4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si -// le code est régénéré. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ diff --git a/TheGameExtreme/Resx/AppResources.Designer.cs b/TheGameExtreme/Resx/AppResources.Designer.cs index c7c8c86..e455e5a 100644 --- a/TheGameExtreme/Resx/AppResources.Designer.cs +++ b/TheGameExtreme/Resx/AppResources.Designer.cs @@ -161,18 +161,12 @@ namespace TheGameExtreme.Resx { } } - /// - /// Recherche une chaîne localisée semblable à Suivant. - /// public static string StrNext { get { return ResourceManager.GetString("StrNext", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à Veuillez choisir un nombre de joueur ainsi que leur(s) nom(s). - /// public static string StrPlayerSelections { get { return ResourceManager.GetString("StrPlayerSelections", resourceCulture); @@ -191,128 +185,84 @@ namespace TheGameExtreme.Resx { } } - /// - /// Recherche une chaîne localisée semblable à - L'objectif est de battre la machine seul et/ou en coopération.. - /// public static string StrTiret1 { get { return ResourceManager.GetString("StrTiret1", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Une fois votre tour terminé, vous appuyez sur le boutton "Fin de tour" afin de passer au joueur suivant.. - /// public static string StrTiret10 { get { return ResourceManager.GetString("StrTiret10", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - La partie est finie quand toutes les cartes sont jouées ou quand le joueur dont c'est le tour ne peut plus jouer.. - /// public static string StrTiret11 { get { return ResourceManager.GetString("StrTiret11", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Afin de préparer la partie, vous disposez d'un écran permettant de choisir le nombre de joueur et leur pseudo, le type de jeu auquels vous souhaitez jouer et enfin le nombre de piles pour jouer.. - /// public static string StrTiret12 { get { return ResourceManager.GetString("StrTiret12", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Le type de jeu permet de définir les valeurs présentent sur les cartes. Vous pouvez jouer avec des valeurs entières, relatives, décimales (1 chiffre), décimales (2 chiffres), décimales (3 chiffres) et avec des fractions décimales. - /// public static string StrTiret13 { get { return ResourceManager.GetString("StrTiret13", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Afin d'atteindre l'objectif, les joueurs disposent de 4 piles (par défaut): deux piles ascendantes vertes et deux piles descendantes rouges.. - /// public static string StrTiret2 { get { return ResourceManager.GetString("StrTiret2", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Sur les piles ascendantes, le joueur doit poser des cartes plus grandes et inversement sur les piles descendantes.. - /// public static string StrTiret3 { get { return ResourceManager.GetString("StrTiret3", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Le but est de poser les 98 cartes du jeu sur les différentes piles à votre disposition.. - /// public static string StrTiret4 { get { return ResourceManager.GetString("StrTiret4", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Pour jouer, il suffit de faire glisser une carte sur la pile que vous avez décidé.. - /// public static string StrTiret5 { get { return ResourceManager.GetString("StrTiret5", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Cette carte doit être plus grande que celle déjà présente s'il s'agit d'une pile ascendante et plus petite si c'est l'inverse.. - /// public static string StrTiret6 { get { return ResourceManager.GetString("StrTiret6", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Il est possible de poser une carte plus petite sur une pile ascendante à condition que ce soit d''une dizaine inférieur. De la même manière, si la carte est plus grande d'une dizaine, il est possible de la poser sur une pile descendante.. - /// public static string StrTiret7 { get { return ResourceManager.GetString("StrTiret7", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Ex : Sur une pile descendante, nous avons 22 => Nous pouvons alors poser 32. - /// Sur une pile ascendante, nous avons 16 => Nous pouvons poser 6.. - /// public static string StrTiret8 { get { return ResourceManager.GetString("StrTiret8", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à - Chaque joueur doit jouer au minimum deux cartes par tour. - /// Il n'y a donc aucune limite maximale de carte à jouer par tour. Cependant, il est conseillé dans la plupart des cas de ne pas jouer toutes les cartes en sa possessions.. - /// public static string StrTiret9 { get { return ResourceManager.GetString("StrTiret9", resourceCulture); } } - /// - /// Recherche une chaîne localisée semblable à OrderStacks. - /// public static string StrTitle { get { return ResourceManager.GetString("StrTitle", resourceCulture); @@ -349,9 +299,9 @@ namespace TheGameExtreme.Resx { } } - public static string TypeValuehundredth { + public static string TypeValueHundredthFract { get { - return ResourceManager.GetString("TypeValuehundredth", resourceCulture); + return ResourceManager.GetString("TypeValueHundredthFract", resourceCulture); } } @@ -361,15 +311,15 @@ namespace TheGameExtreme.Resx { } } - public static string TypeValueTens { + public static string TypeValueTenthFract { get { - return ResourceManager.GetString("TypeValueTens", resourceCulture); + return ResourceManager.GetString("TypeValueTenthFract", resourceCulture); } } - public static string TypeValuethousandth { + public static string TypeValueThousandthFract { get { - return ResourceManager.GetString("TypeValuethousandth", resourceCulture); + return ResourceManager.GetString("TypeValueThousandthFract", resourceCulture); } } @@ -379,6 +329,18 @@ namespace TheGameExtreme.Resx { } } + public static string TypeValueTenth { + get { + return ResourceManager.GetString("TypeValueTenth", resourceCulture); + } + } + + public static string TypeValueHundredth { + get { + return ResourceManager.GetString("TypeValueHundredth", resourceCulture); + } + } + public static string WhiteTheme { get { return ResourceManager.GetString("WhiteTheme", resourceCulture); diff --git a/TheGameExtreme/Resx/AppResources.resx b/TheGameExtreme/Resx/AppResources.resx index 81da45d..bfa8e38 100644 --- a/TheGameExtreme/Resx/AppResources.resx +++ b/TheGameExtreme/Resx/AppResources.resx @@ -253,21 +253,27 @@ Une possibilité de changer le thème de l'application grâce aux images du sole Fractionnées - - Décimales (2 chiffres) + + 2 Décimales (Fraction) Relatives - - Décimales (1 chiffre) + + 1 Décimales (Fraction) - - Décimales (3 chiffres) + + 3 Décimales (Fraction) Entière + + 1 Décimales + + + 2 Décimales + Thème clair : diff --git a/TheGameExtreme/model/Parametreur.cs b/TheGameExtreme/model/Parametreur.cs index b1e0da0..fa18a66 100644 --- a/TheGameExtreme/model/Parametreur.cs +++ b/TheGameExtreme/model/Parametreur.cs @@ -29,5 +29,15 @@ namespace TheGameExtreme.model players.Add(player); } } + + public string getScore() + { + int score = GameMode.getScore(); + players.ForEach(player => + { + score += player.getCardList().Count; + }); + return score.ToString(); + } } } diff --git a/TheGameExtreme/model/deck/ClassicDeck.cs b/TheGameExtreme/model/deck/ClassicDeck.cs index b13e1ef..38c54ee 100644 --- a/TheGameExtreme/model/deck/ClassicDeck.cs +++ b/TheGameExtreme/model/deck/ClassicDeck.cs @@ -13,14 +13,6 @@ namespace TheGameExtreme.model.deck while (deck.Count < nbCard && deck.Count < (borneMax - borneMin)) { int value = random.Next(borneMin, borneMax); - //foreach (Card card in deck) - //{ - // if (card.Value.CompareTo(value) == 0) - // { - // Debug.WriteLine("Regarde!"); - // break; - // } - //} InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value)); } } diff --git a/TheGameExtreme/model/deck/Decimal1.cs b/TheGameExtreme/model/deck/Decimal1.cs new file mode 100644 index 0000000..bdc7374 --- /dev/null +++ b/TheGameExtreme/model/deck/Decimal1.cs @@ -0,0 +1,18 @@ +using System; +using TheGameExtreme.model.card.cardType; + +namespace TheGameExtreme.model.deck +{ + public class Decimal1Deck : Deck + { + public Decimal1Deck(int nbCard, int borneMin, int borneMax) : base(nbCard) + { + Random random = new Random(); + while (deck.Count < nbCard && deck.Count < (borneMax - borneMin)) + { + decimal value = random.Next(borneMin, borneMax) * 0.1m; + InsertionDichotomique(deck, 0, deck.Count - 1, new ClassicCard(value)); + } + } + } +} diff --git a/TheGameExtreme/model/deck/Decimal2.cs b/TheGameExtreme/model/deck/Decimal2.cs new file mode 100644 index 0000000..293be22 --- /dev/null +++ b/TheGameExtreme/model/deck/Decimal2.cs @@ -0,0 +1,18 @@ +using System; +using TheGameExtreme.model.card.cardType; + +namespace TheGameExtreme.model.deck +{ + public class Decimal2Deck : Deck + { + public Decimal2Deck(int nbCard, int borneMin, int borneMax) : base(nbCard) + { + Random random = new Random(); + while (deck.Count < nbCard && deck.Count < (borneMax - borneMin)) + { + decimal value = random.Next(borneMin, borneMax) * 0.01m; + InsertionDichotomique(deck, 0, deck.Count - 1, new ClassicCard(value)); + } + } + } +} diff --git a/TheGameExtreme/model/gameActions/abstractRules/GameMode.cs b/TheGameExtreme/model/gameActions/abstractRules/GameMode.cs index 82277f8..ab39166 100644 --- a/TheGameExtreme/model/gameActions/abstractRules/GameMode.cs +++ b/TheGameExtreme/model/gameActions/abstractRules/GameMode.cs @@ -112,9 +112,9 @@ namespace TheGameExtreme.model.gameActions.abstractRules public abstract void TestEndGame(List currentHand); - public string getScore() + public int getScore() { - return deck.size().ToString(); + return deck.size(); } } } diff --git a/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs b/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs index 53abaa4..8135616 100644 --- a/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs +++ b/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs @@ -4,6 +4,7 @@ using TheGameExtreme.model.card; using TheGameExtreme.model.deck; using TheGameExtreme.model.gameActions.abstractRules; using TheGameExtreme.model.piles; +using TheGameExtreme.Resx; namespace TheGameExtreme.model.gameActions.classic { diff --git a/TheGameExtreme/model/manager/GameManager.cs b/TheGameExtreme/model/manager/GameManager.cs index 5c4abe1..240d42e 100644 --- a/TheGameExtreme/model/manager/GameManager.cs +++ b/TheGameExtreme/model/manager/GameManager.cs @@ -104,7 +104,7 @@ namespace TheGameExtreme.model.manager { if(parametreur.GameMode.endTurn(currentHand, CurrentCardPlayed, parametreur.players[currentIndexPlayer])) { - EndMessage = parametreur.GameMode.Message + "Il vous restait " + parametreur.GameMode.getScore() + " cartes à jouer!"; + EndMessage = parametreur.GameMode.Message + "Il vous restait " + parametreur.getScore() + " cartes à jouer!"; return true; } else @@ -112,6 +112,7 @@ namespace TheGameExtreme.model.manager EndMessage = parametreur.GameMode.Message; if (win) { + EndMessage = AppResources.StrWin; OnEndGame(this, new EventArgs()); return true; } diff --git a/TheGameExtreme/view/GamePreparationPage.xaml.cs b/TheGameExtreme/view/GamePreparationPage.xaml.cs index 7ccff9f..b100345 100644 --- a/TheGameExtreme/view/GamePreparationPage.xaml.cs +++ b/TheGameExtreme/view/GamePreparationPage.xaml.cs @@ -9,7 +9,7 @@ namespace TheGameExtreme.view public partial class GamePreparationPage : ContentPage { public List listNbPlayer = new List { 1, 2, 3, 4, 5 }; - public List listGameMode = new List { AppResources.TypeValueWhole, AppResources.TypeValueRelative, AppResources.TypeValueTens, AppResources.TypeValuehundredth, AppResources.TypeValuethousandth, AppResources.TypeValuefractionated }; + public List listGameMode = new List { AppResources.TypeValueWhole, AppResources.TypeValueRelative, AppResources.TypeValueTenthFract, AppResources.TypeValueHundredthFract, AppResources.TypeValueThousandthFract, AppResources.TypeValuefractionated, AppResources.TypeValueTenth, AppResources.TypeValueHundredth }; public List listNbStack = new List { 4, 6, 8 }; public List listNbCard = new List { 100, 80, 60, 40 }; @@ -104,7 +104,7 @@ namespace TheGameExtreme.view { Placeholder = "Pseudo", BackgroundColor = (Color)Application.Current.Resources["Gold"], - WidthRequest = 200, + WidthRequest = 150, MinimumWidthRequest = 50, HorizontalOptions = LayoutOptions.Center, MaxLength = 18, diff --git a/TheGameExtreme/view/GamePreparationPage.xaml.cs.orig b/TheGameExtreme/view/GamePreparationPage.xaml.cs.orig deleted file mode 100644 index 8c9f238..0000000 --- a/TheGameExtreme/view/GamePreparationPage.xaml.cs.orig +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using TheGameExtreme.IO; -using TheGameExtreme.Resx; -using Xamarin.Forms; - -namespace TheGameExtreme.view -{ - public partial class GamePreparationPage : ContentPage - { - public List listNbPlayer = new List { 1, 2, 3, 4, 5 }; - public List listGameMode = new List { AppResources.TypeValueWhole, AppResources.TypeValueRelative, AppResources.TypeValueTens, AppResources.TypeValuehundredth, AppResources.TypeValuethousandth, AppResources.TypeValuefractionated }; - public List listNbStack = new List { 4, 6, 8 }; - public List listNbCard = new List { 100, 80, 60, 40 }; - - - public GamePreparationPage() - { - InitializeComponent(); - - NavigationPage.SetHasNavigationBar(this, false); - - LoadParameterName(); - - PlayerSelecter.ItemsSource = listNbPlayer; - LoadParameterNbPlayerGamePreparation(); - - SelectMode.ItemsSource = listGameMode; - LoadParameterGameModeValueGamePreparation(); - - SelectNbStack.ItemsSource = listNbStack; - LoadParameterNbStacksGamePreparation(); - - SelectNbCard.ItemsSource = listNbCard; - LoadParameterNbCardsGamePreparation(); - - - - } - - private async void Back(object sender, EventArgs e) - { - IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); -<<<<<<< HEAD - IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); - await Navigation.PopToRootAsync(); -======= - if ((int)PlayerSelecter.SelectedItem == 1) - { - IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); - } - await Navigation.PopAsync(); ->>>>>>> 6006856012a9420076ac40947eee0560f1e65e3e - } - - protected override bool OnBackButtonPressed() - { - IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); - if ((int)PlayerSelecter.SelectedItem == 1) - { - IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); - } - return base.OnBackButtonPressed(); - } - - private async void Play(object sender, EventArgs args) - { - List playersNames = new List(); - - - for (int i = 1; i < NameList.Children.Count; i++) - { - playersNames.Add(((Entry)NameList.Children[i]).Text); - if (string.IsNullOrWhiteSpace(playersNames[playersNames.Count - 1])) - { - await DisplayAlert(AppResources.WrongPseudo, AppResources.StrEnterPseudo, AppResources.StrCloseWind); - return; - } - } - IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); - IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); - await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.SelectedItem, (int)SelectMode.SelectedIndex, (int)SelectNbCard.SelectedItem)); - } - - private void ChangedPseudo(object sender, EventArgs args) - { - if ((int)PlayerSelecter.SelectedItem == 1) - { - LoadParameterName(); - } - else - { - FirstEntry.Text = ""; - } - while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem) - { - if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem) - { - - Entry e = new Entry - { - Placeholder = "Pseudo", - BackgroundColor = (Color)Application.Current.Resources["Gold"], - WidthRequest = 200, - MinimumWidthRequest = 50, - HorizontalOptions = LayoutOptions.Center, - MaxLength = 18, - IsTextPredictionEnabled = false - }; - - - NameList.Children.Add(e); - } - else - { - NameList.Children.RemoveAt(NameList.Children.Count - 1); - } - } - } - public void LoadParameterNbPlayerGamePreparation() - { - int nbJoueurs = IOGamePreparation.LoadParameterGamePreparationNbPlayers(); - PlayerSelecter.SelectedIndex = nbJoueurs; - } - - public void LoadParameterGameModeValueGamePreparation() - { - int gameModeValue = IOGamePreparation.LoadParameterGamePreparationGameModeValue(); - SelectMode.SelectedIndex = gameModeValue; - } - - public void LoadParameterNbStacksGamePreparation() - { - int nbStackSer = IOGamePreparation.LoadParamaterGamePreparationNbStacks(); - SelectNbStack.SelectedIndex = nbStackSer; - } - public void LoadParameterNbCardsGamePreparation() - { - int nbCards = IOGamePreparation.LoadParameterGamePreparationNbCards(); - SelectNbCard.SelectedIndex = nbCards; - } - public void LoadParameterName() - { - string pseudo = IOGamePreparation.LoadNameFromGamePrepararion(); - FirstEntry.Text = pseudo; - } - - - - } -} diff --git a/TheGameExtreme/view/HomePage.xaml.orig b/TheGameExtreme/view/HomePage.xaml.orig deleted file mode 100644 index 82da23b..0000000 --- a/TheGameExtreme/view/HomePage.xaml.orig +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -