diff --git a/Documentations/Cahier des charges 3.docx b/Documentations/Cahier des charges 3.docx new file mode 100644 index 0000000..49af8de Binary files /dev/null and b/Documentations/Cahier des charges 3.docx differ diff --git a/Documentations/Sketch/Sketch_FGlobal 2.bmpr b/Documentations/Sketch/Sketch_FGlobal 2.bmpr new file mode 100644 index 0000000..9515f85 Binary files /dev/null and b/Documentations/Sketch/Sketch_FGlobal 2.bmpr differ diff --git a/Documentations/Sketch/Sketch_FHomePage 2.bmpr b/Documentations/Sketch/Sketch_FHomePage 2.bmpr new file mode 100644 index 0000000..6d5a6a1 Binary files /dev/null and b/Documentations/Sketch/Sketch_FHomePage 2.bmpr differ diff --git a/TestUnit/TestUnit 2.csproj b/TestUnit/TestUnit 2.csproj new file mode 100644 index 0000000..36979d1 --- /dev/null +++ b/TestUnit/TestUnit 2.csproj @@ -0,0 +1,22 @@ + + + + netcoreapp3.0 + + false + + + + + + + + + + + + + + + + diff --git a/TestUnitaire/AppInitializer 2.cs b/TestUnitaire/AppInitializer 2.cs new file mode 100644 index 0000000..23d1d7d --- /dev/null +++ b/TestUnitaire/AppInitializer 2.cs @@ -0,0 +1,43 @@ +using System; +using System.IO; +using System.Linq; +using Xamarin.Essentials; +using Xamarin.UITest; +using Xamarin.UITest.Queries; + +namespace TestUnitaire +{ + /*public class AppInitializer + { + public static IApp StartApp(Platform platform) + { + // TODO: If the iOS or Android app being tested is included in the solution + // then open the Unit Tests window, right click Test Apps, select Add App Project + // and select the app projects that should be tested. + // + // The iOS project should have the Xamarin.TestCloud.Agent NuGet package + // installed. To start the Test Cloud Agent the following code should be + // added to the FinishedLaunching method of the AppDelegate: + // + // #if ENABLE_TEST_CLOUD + // Xamarin.Calabash.Start(); + // #endif + if (platform == Platform.Android) + { + return ConfigureApp + .Android + // TODO: Update this path to point to your Android app and uncomment the + // code if the app is not included in the solution. + //.ApkFile ("../../../Droid/bin/Debug/xamarinforms.apk") + .StartApp(); + } + + return ConfigureApp + .iOS + // TODO: Update this path to point to your iOS app and uncomment the + // code if the app is not included in the solution. + //.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app") + .StartApp(); + } + }*/ +} diff --git a/TheGameExtreme.Android/Assets/AboutAssets 2.txt b/TheGameExtreme.Android/Assets/AboutAssets 2.txt new file mode 100644 index 0000000..072563f --- /dev/null +++ b/TheGameExtreme.Android/Assets/AboutAssets 2.txt @@ -0,0 +1,19 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/TheGameExtreme.Android/Properties/AndroidManifest 2.xml b/TheGameExtreme.Android/Properties/AndroidManifest 2.xml new file mode 100644 index 0000000..c09a9f3 --- /dev/null +++ b/TheGameExtreme.Android/Properties/AndroidManifest 2.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TheGameExtreme.Android/Resources/AboutResources 3.txt b/TheGameExtreme.Android/Resources/AboutResources 3.txt new file mode 100644 index 0000000..cb30f20 --- /dev/null +++ b/TheGameExtreme.Android/Resources/AboutResources 3.txt @@ -0,0 +1,50 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.xml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable-hdpi/ + icon.png + + drawable-ldpi/ + icon.png + + drawable-mdpi/ + icon.png + + layout/ + main.xml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called +"Resource" that contains the tokens for each one of the resources included. For example, +for the above Resources layout, this is what the Resource class would expose: + +public class Resource { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main +to reference the layout/main.xml file, or Resource.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/TheGameExtreme.Android/Resources/drawable/Apple 2.png b/TheGameExtreme.Android/Resources/drawable/Apple 2.png new file mode 100644 index 0000000..a8533f0 Binary files /dev/null and b/TheGameExtreme.Android/Resources/drawable/Apple 2.png differ diff --git a/TheGameExtreme.Android/Resources/drawable/ArrowSettingsBack 2.png b/TheGameExtreme.Android/Resources/drawable/ArrowSettingsBack 2.png new file mode 100644 index 0000000..cdeadec Binary files /dev/null and b/TheGameExtreme.Android/Resources/drawable/ArrowSettingsBack 2.png differ diff --git a/TheGameExtreme.Android/Resources/drawable/FontStyle/IndieFlower 2.ttf b/TheGameExtreme.Android/Resources/drawable/FontStyle/IndieFlower 2.ttf new file mode 100644 index 0000000..0ee42d3 Binary files /dev/null and b/TheGameExtreme.Android/Resources/drawable/FontStyle/IndieFlower 2.ttf differ diff --git a/TheGameExtreme.Android/Resources/layout/Tabbar 2.xml b/TheGameExtreme.Android/Resources/layout/Tabbar 2.xml new file mode 100644 index 0000000..b2d0868 --- /dev/null +++ b/TheGameExtreme.Android/Resources/layout/Tabbar 2.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/TheGameExtreme.Android/Resources/mipmap-anydpi-v26/icon 2.xml b/TheGameExtreme.Android/Resources/mipmap-anydpi-v26/icon 2.xml new file mode 100644 index 0000000..88d1d0a --- /dev/null +++ b/TheGameExtreme.Android/Resources/mipmap-anydpi-v26/icon 2.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/TheGameExtreme.Android/Resources/mipmap-hdpi/icon 2.png b/TheGameExtreme.Android/Resources/mipmap-hdpi/icon 2.png new file mode 100644 index 0000000..4623ca2 Binary files /dev/null and b/TheGameExtreme.Android/Resources/mipmap-hdpi/icon 2.png differ diff --git a/TheGameExtreme.Android/Resources/mipmap-mdpi/icon 2.png b/TheGameExtreme.Android/Resources/mipmap-mdpi/icon 2.png new file mode 100644 index 0000000..9b1d25e Binary files /dev/null and b/TheGameExtreme.Android/Resources/mipmap-mdpi/icon 2.png differ diff --git a/TheGameExtreme.Android/Resources/mipmap-xhdpi/icon 2.png b/TheGameExtreme.Android/Resources/mipmap-xhdpi/icon 2.png new file mode 100644 index 0000000..844dfe5 Binary files /dev/null and b/TheGameExtreme.Android/Resources/mipmap-xhdpi/icon 2.png differ diff --git a/TheGameExtreme.Android/Resources/mipmap-xxhdpi/icon 2.png b/TheGameExtreme.Android/Resources/mipmap-xxhdpi/icon 2.png new file mode 100644 index 0000000..e20ec9a Binary files /dev/null and b/TheGameExtreme.Android/Resources/mipmap-xxhdpi/icon 2.png differ diff --git a/TheGameExtreme.Android/Resources/mipmap-xxxhdpi/icon 2.png b/TheGameExtreme.Android/Resources/mipmap-xxxhdpi/icon 2.png new file mode 100644 index 0000000..8a08bf7 Binary files /dev/null and b/TheGameExtreme.Android/Resources/mipmap-xxxhdpi/icon 2.png differ diff --git a/TheGameExtreme.Android/Resources/values/Strings 2.xml b/TheGameExtreme.Android/Resources/values/Strings 2.xml new file mode 100644 index 0000000..0ea0c13 --- /dev/null +++ b/TheGameExtreme.Android/Resources/values/Strings 2.xml @@ -0,0 +1 @@ + diff --git a/TheGameExtreme.iOS/Assets.xcassets/AppIcon.appiconset/Contents 2.json b/TheGameExtreme.iOS/Assets.xcassets/AppIcon.appiconset/Contents 2.json new file mode 100644 index 0000000..98f4d03 --- /dev/null +++ b/TheGameExtreme.iOS/Assets.xcassets/AppIcon.appiconset/Contents 2.json @@ -0,0 +1,117 @@ +{ + "images": [ + { + "scale": "2x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon40.png" + }, + { + "scale": "3x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon60.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon58.png" + }, + { + "scale": "3x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon87.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon80.png" + }, + { + "scale": "3x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "2x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "3x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon180.png" + }, + { + "scale": "1x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon20.png" + }, + { + "scale": "2x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "1x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon29.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon58.png" + }, + { + "scale": "1x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon80.png" + }, + { + "scale": "1x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon76.png" + }, + { + "scale": "2x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon152.png" + }, + { + "scale": "2x", + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon167.png" + }, + { + "scale": "1x", + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon1024.png" + } + ], + "properties": {}, + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/TheGameExtreme.iOS/Properties/AssemblyInfo 2.cs b/TheGameExtreme.iOS/Properties/AssemblyInfo 2.cs new file mode 100644 index 0000000..a8b2213 --- /dev/null +++ b/TheGameExtreme.iOS/Properties/AssemblyInfo 2.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("TheGameExtreme.iOS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TheGameExtreme.iOS")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/TheGameExtreme.iOS/Resources/Apple 2.png b/TheGameExtreme.iOS/Resources/Apple 2.png new file mode 100644 index 0000000..a8533f0 Binary files /dev/null and b/TheGameExtreme.iOS/Resources/Apple 2.png differ diff --git a/TheGameExtreme.iOS/Resources/FontStyle/ENSOTYPE License & FAQ - DO READ THIS! 2.pdf b/TheGameExtreme.iOS/Resources/FontStyle/ENSOTYPE License & FAQ - DO READ THIS! 2.pdf new file mode 100644 index 0000000..2ab6b3f Binary files /dev/null and b/TheGameExtreme.iOS/Resources/FontStyle/ENSOTYPE License & FAQ - DO READ THIS! 2.pdf differ diff --git a/TheGameExtreme.iOS/Resources/FontStyle/IndieFlower 2.ttf b/TheGameExtreme.iOS/Resources/FontStyle/IndieFlower 2.ttf new file mode 100644 index 0000000..0ee42d3 Binary files /dev/null and b/TheGameExtreme.iOS/Resources/FontStyle/IndieFlower 2.ttf differ diff --git a/TheGameExtreme/model/Card/Card 2.cs b/TheGameExtreme/model/Card/Card 2.cs new file mode 100644 index 0000000..cd06e34 --- /dev/null +++ b/TheGameExtreme/model/Card/Card 2.cs @@ -0,0 +1,34 @@ +using System; +using System.ComponentModel; + +namespace TheGameExtreme.model.card +{ + public abstract class Card // : INotifyPropertyChanged + { + + //public event PropertyChangedEventHandler PropertyChanged; + private int value; + public int Value + { + get { return value; } + set { + this.value = value; + //OnPropertyChange("Value"); + } + } + //private void OnPropertyChange(string v) + //{ + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(v)); + //} + + + public Card(int value) + { + Value = value; + } + + public abstract String getName(); + public abstract bool rapidEffect(); + + } +} diff --git a/TheGameExtreme/model/Card/ClassicCard 2.cs b/TheGameExtreme/model/Card/ClassicCard 2.cs new file mode 100644 index 0000000..559ad26 --- /dev/null +++ b/TheGameExtreme/model/Card/ClassicCard 2.cs @@ -0,0 +1,26 @@ +using System; + +namespace TheGameExtreme.model.card +{ + public class ClassicCard : Card + { + + public static readonly String CARD_CLASSIC = "ClassicCard"; + + public ClassicCard(int value) + : base(value) + { + } + + public override bool rapidEffect() + { + return false; + } + + override public String getName() + { + return CARD_CLASSIC; + } + + } +} \ No newline at end of file diff --git a/TheGameExtreme/model/Card/rapidCard/EndGameCard 2.cs b/TheGameExtreme/model/Card/rapidCard/EndGameCard 2.cs new file mode 100644 index 0000000..be6781b --- /dev/null +++ b/TheGameExtreme/model/Card/rapidCard/EndGameCard 2.cs @@ -0,0 +1,20 @@ +using System; +namespace TheGameExtreme.model.card.rapidCard +{ + public class EndGameCard : RapidCard + { + + public static readonly String CARD_ENDGAME = "EndGameCard"; + + public EndGameCard(int value) + :base(value) + { + } + + override public String getName() + { + return CARD_ENDGAME; + } + + } +} diff --git a/TheGameExtreme/model/Card/rapidCard/RapidCard 2.cs b/TheGameExtreme/model/Card/rapidCard/RapidCard 2.cs new file mode 100644 index 0000000..b3bc178 --- /dev/null +++ b/TheGameExtreme/model/Card/rapidCard/RapidCard 2.cs @@ -0,0 +1,16 @@ +using System; +namespace TheGameExtreme.model.card.rapidCard +{ + public abstract class RapidCard : Card + { + public RapidCard(int value) : base(value) + { + } + + public override bool rapidEffect() + { + return true; + } + + } +} diff --git a/TheGameExtreme/model/Preparateur 3.cs b/TheGameExtreme/model/Preparateur 3.cs new file mode 100644 index 0000000..ac4b603 --- /dev/null +++ b/TheGameExtreme/model/Preparateur 3.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.gameActions.classic; + +namespace TheGameExtreme.model +{ + public class Parametreur + { + + public GameMode GameMode { get; set; } + public List players = new List(); + public int NbPlayer { get; set; } + + public Parametreur(GameMode gameMode) + { + GameMode = gameMode; + } + + public void Prepare() + { + NbPlayer = players.Count; + GameMode.load(NbPlayer, players); + } + + public void AddPlayer(Player player) + { + if (player != null) + { + players.Add(player); + } + } + } +} diff --git a/TheGameExtreme/model/deck/ClassicDeck 2.cs b/TheGameExtreme/model/deck/ClassicDeck 2.cs new file mode 100644 index 0000000..72f53a1 --- /dev/null +++ b/TheGameExtreme/model/deck/ClassicDeck 2.cs @@ -0,0 +1,18 @@ +using System; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.deck +{ + public class ClassicDeck : Deck + { + public ClassicDeck() + { + Card card; + for (int i = 2; i <= 99; i++) + { + card = new ClassicCard(i); + deck.Add(card); + } + } + } +} diff --git a/TheGameExtreme/model/event/HandCardChangeEventArgs 2.cs b/TheGameExtreme/model/event/HandCardChangeEventArgs 2.cs new file mode 100644 index 0000000..1961739 --- /dev/null +++ b/TheGameExtreme/model/event/HandCardChangeEventArgs 2.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.@event +{ + public class HandCardChangedEventArgs : EventArgs + { + + public Card NewCard { get; set; } + public int Position { get; set; } + + public HandCardChangedEventArgs(Card newCard, int position) + { + NewCard = newCard; + Position = position; + } + } +} diff --git a/TheGameExtreme/model/gameActions/GameAction 2.cs b/TheGameExtreme/model/gameActions/GameAction 2.cs new file mode 100644 index 0000000..26af12d --- /dev/null +++ b/TheGameExtreme/model/gameActions/GameAction 2.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.gameActions +{ + public abstract class GameAction + { + protected Piles ListOrderedStacks { get; set; } + public String ErrorMessage { get; set; } + + protected GameAction(Piles listOrderedStacks) + { + ListOrderedStacks = listOrderedStacks; + } + } +} diff --git a/TheGameExtreme/model/gameActions/classic/GameMode 2.cs b/TheGameExtreme/model/gameActions/classic/GameMode 2.cs new file mode 100644 index 0000000..c0dcc4d --- /dev/null +++ b/TheGameExtreme/model/gameActions/classic/GameMode 2.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.card; +using TheGameExtreme.model.deck; +using TheGameExtreme.model.@event; + +namespace TheGameExtreme.model.gameActions.classic +{ + public class GameMode + { + + protected List gameActions; + protected Piles piles; + public int NbCardAtBeginOfTurn { get; set; } + protected Deck deck; + protected int nbMaxCard; + public string Message { get; set; } + + + #region + + public event EventHandler TopRangeChanged; + public event EventHandler PlayerChanged; + protected internal void OnTopRangeChanged(TopRangeChangedEventArgs args) + { + TopRangeChanged?.Invoke(this, args); + } + protected internal void OnPlayerChanged(PlayerChangedEventArgs args) + { + PlayerChanged?.Invoke(this, args); + } + + #endregion + + + public GameMode() + { + gameActions = new List(); + } + + public void load(int nbPlayer, List players) + { + piles = new Piles(); + + gameActions.Add(new Piocher(piles)); + gameActions.Add(new JouerUneCarte(piles)); + gameActions.Add(new TerminerSonTour(piles)); + + createDeck(); + defineNbMaxCard(nbPlayer); + distribueCard(players); + } + + protected void createDeck() + { + switch (true) + { + case false: + deck = new ClassicDeck(); + break; + + default: + deck = new ExtremeDeck(); + break; + } + } + + protected void defineNbMaxCard(int nbPlayer) + { + switch (nbPlayer) + { + case 1: + nbMaxCard = 8; + NbCardAtBeginOfTurn = 8; + break; + case 2: + nbMaxCard = 7; + NbCardAtBeginOfTurn = 7; + break; + default: + nbMaxCard = 6; + NbCardAtBeginOfTurn = 6; + break; + } + } + + protected void distribueCard(List players) + { + 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 pioche(List currentHand, Player player) + { + Message = null; + ((Piocher)gameActions[0]).pioche(currentHand, deck, player); + } + + public void playCard(int valueCard, List currentHand, int orderedStackSelected, Player player, List CurrentCardPlayed) + { + Message = null; + if (((JouerUneCarte)gameActions[1]).play(valueCard, currentHand, orderedStackSelected, player, CurrentCardPlayed)) + { + OnTopRangeChanged(new TopRangeChangedEventArgs(piles.getStack(orderedStackSelected).Peek(), ((JouerUneCarte)gameActions[1]).OldCard, orderedStackSelected)); + } + else + { + Message = ((JouerUneCarte)gameActions[1]).ErrorMessage; + } + } + + public bool endTurn(List currentHand, List CurrentCardPlayed, Player player) + { + Message = null; + if (((TerminerSonTour)gameActions[2]).end(currentHand, NbCardAtBeginOfTurn, CurrentCardPlayed)) + { + pioche(currentHand, player); + CurrentCardPlayed.Clear(); + + OnPlayerChanged(null); + return false; + } + else + { + Message = ((TerminerSonTour)gameActions[2]).ErrorMessage; + return true; + } + } + + #region Decaler dans un GameAction + + public bool isEndGame(List currentHand) + { + if (currentHand.Count != 0) + { + List playableCard = new List(); + tryToFindSoluce(playableCard, currentHand); + return testEndGame(playableCard); + } + return false; + } + + protected void tryToFindSoluce(List playableCard, List currentHand) + { + currentHand.ForEach(card => + { + if (card.Value > piles.getStack(0).Peek().Value || card.Value > piles.getStack(1).Peek().Value || card.Value < piles.getStack(2).Peek().Value || card.Value < piles.getStack(3).Peek().Value) + { + playableCard.Add(card); + } + }); + } + + protected bool testEndGame(List playableCard) + { + if (playableCard.Count < 2) + { + Message = "Le jeu est terminé!\n Désolé, vous avez perdu... Essayez encore!"; + return true; + } + + return false; + } + + #endregion + } +} diff --git a/TheGameExtreme/model/gameActions/classic/JouerUneCarte 2.cs b/TheGameExtreme/model/gameActions/classic/JouerUneCarte 2.cs new file mode 100644 index 0000000..ba07eec --- /dev/null +++ b/TheGameExtreme/model/gameActions/classic/JouerUneCarte 2.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.model.gameActions.classic +{ + public class JouerUneCarte : GameAction + { + + public Card OldCard { get; set; } + + + public JouerUneCarte(Piles ListOrderedStacks) : base(ListOrderedStacks) + { + } + + public bool play(int valueCard, List CurrentHand, int orderedStackSelected, Player player, List CurrentCardPlayed) + { + foreach (Card card in CurrentHand) + { + if (valueCard == card.Value) + { + if (orderedStackSelected >= 0 && orderedStackSelected < 4) + { + if (orderedStackSelected < 2) + { + ErrorMessage = null; + return rule(card, ListOrderedStacks.getStack(orderedStackSelected), true, player, CurrentCardPlayed); + } + else + { + ErrorMessage = null; + return rule(card, ListOrderedStacks.getStack(orderedStackSelected), false, player, CurrentCardPlayed); + } + } + else + { + ErrorMessage = AppRessource.StrCantGetStack; + } + } + } + return false; + } + + private bool rule(Card card, Stack stack, bool bottomUp, Player player, List 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) + { + OldCard = stack.Peek(); + player.joue(card); + CurrentCardPlayed.Add(card); + stack.Push(card); + + return true; + //OnTopRangeChanged(new TopRangeChangedEventArgs(card, oldCard, ListOrderedStacks.IndexOf(orderedStack))); + } + else + { + ErrorMessage = AppRessource.StrWrongStack; + return false; + } + } + } +} diff --git a/TheGameExtreme/model/gameActions/extreme/ExtremeJouerUneCarte 2.cs b/TheGameExtreme/model/gameActions/extreme/ExtremeJouerUneCarte 2.cs new file mode 100644 index 0000000..9877c84 --- /dev/null +++ b/TheGameExtreme/model/gameActions/extreme/ExtremeJouerUneCarte 2.cs @@ -0,0 +1,12 @@ +using System; +using TheGameExtreme.model.gameActions.classic; + +namespace TheGameExtreme.model.gameActions.extreme +{ + public class ExtremeJouerUneCarte : JouerUneCarte + { + public ExtremeJouerUneCarte(Piles ListOrderedStacks) : base(ListOrderedStacks) + { + } + } +} diff --git a/TheGameExtreme/model/manager/GameManager 2.cs b/TheGameExtreme/model/manager/GameManager 2.cs new file mode 100644 index 0000000..d0cf165 --- /dev/null +++ b/TheGameExtreme/model/manager/GameManager 2.cs @@ -0,0 +1,293 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using TheGameExtreme.model.card; +using TheGameExtreme.model.@event; +using TheGameExtreme.model.gameActions; + +namespace TheGameExtreme.model.manager +{ + public abstract class GameManager: INotifyPropertyChanged + { + + /* GameMaster implémente un mode de jeu (classe fille de gameMode qui connait les actions a effectué en fonction du mode de jeu */ + + protected Parametreur parametreur; + public Piles ListOrderedStacks { get; set; } + protected List CurrentCardPlayed = new List(); + public String EndMessage { get; set; } + protected int currentIndexPlayer; + + + protected List currentHand; + public List CurrentHand + { + get { return currentHand; } + set + { + currentHand = value; + OnPropertyChanged("CurrentHand"); + } + } + + #region event + + public event EventHandler TopRangeChanged; + public event EventHandler PlayerChanged; + public event PropertyChangedEventHandler PropertyChanged; + public virtual void OnPropertyChanged(string info) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info)); + } + public void OnTopRangeChanged(object source, TopRangeChangedEventArgs args) + { + TopRangeChanged?.Invoke(this, args); + } + protected internal void OnPlayerChanged(object source, PlayerChangedEventArgs args) + { + currentIndexPlayer += 1; + if (currentIndexPlayer == parametreur.players.Count) + { + currentIndexPlayer = 0; + } + CurrentHand = parametreur.players[currentIndexPlayer].getCardList(); + PlayerChanged?.Invoke(this, new PlayerChangedEventArgs(CurrentHand, parametreur.players[currentIndexPlayer].Pseudo)); + parametreur.GameMode.NbCardAtBeginOfTurn = CurrentHand.Count; + } + + #endregion + + + + protected GameManager(Parametreur parametreur) + { + this.parametreur = parametreur; + + parametreur.Prepare(); + + parametreur.GameMode.TopRangeChanged += OnTopRangeChanged; + + parametreur.GameMode.PlayerChanged += OnPlayerChanged; + + CurrentHand = parametreur.players[0].getCardList(); + } + + + + public void joue(int valueCard, int orderedStackSelected) + { + parametreur.GameMode.playCard(valueCard, currentHand, orderedStackSelected, parametreur.players[currentIndexPlayer], CurrentCardPlayed); // Mettre le joueur actif + EndMessage = parametreur.GameMode.Message; + } + + public bool endTurn() + { + if(parametreur.GameMode.endTurn(currentHand, CurrentCardPlayed, parametreur.players[currentIndexPlayer])) + { + EndMessage = parametreur.GameMode.Message; + if (isEndGame()) + { + EndMessage = parametreur.GameMode.Message; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + private bool isEndGame() + { + return parametreur.GameMode.isEndGame(currentHand); + } + + + + + + + + + + + + + + + + + + + + + //public readonly int nbPlayer; + //protected int nbMaxCard; + //protected int currentIndexPlayer; + //protected List playerList = new List(); + //public List> ListOrderedStacks { get; set; } + //protected Deck deck; + //protected bool win = true; + //public String EndMessage { get; set; } + //public List CurrentHand { get; set; } + //protected int nbCardAtBeginOfTurn; + //protected List CurrentCardPlayed = new List(); + //protected string langue; + //public event EventHandler TopRangeChanged; + //public event EventHandler PlayerChanged; + + + //protected GameManager(int nbPlayer, List players) + //{ + // ListOrderedStacks = new List>(); + // CurrentHand = new List(); + + // 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>(); + + // ListOrderedStacks.Add(new Stack()); + // ListOrderedStacks.Add(new Stack()); + // ListOrderedStacks.Add(new Stack()); + // ListOrderedStacks.Add(new Stack()); + + // 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 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 playableCard); + + //abstract protected bool testEndGame(List playableCard); + + //abstract protected bool effectLose(); + + //public int getCurentIndexPlayer() + //{ + // return currentIndexPlayer; + //} + + } +} diff --git a/TheGameExtreme/model/manager/multiplayer/LocalGameManager 2.cs b/TheGameExtreme/model/manager/multiplayer/LocalGameManager 2.cs new file mode 100644 index 0000000..ac880d6 --- /dev/null +++ b/TheGameExtreme/model/manager/multiplayer/LocalGameManager 2.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.card; +using TheGameExtreme.model.gameActions.classic; + +namespace TheGameExtreme.model.manager +{ + public class LocalGameManager : MultiplayerGameManager + { + public LocalGameManager(Parametreur parametreur) : base(parametreur) + { + } + + //public override bool endTurn() + //{ + // throw new NotImplementedException(); + //} + + //protected override bool effectLose() + //{ + // throw new NotImplementedException(); + //} + + //protected override bool isEndGame() + //{ + // throw new NotImplementedException(); + //} + + //protected override void pioche() + //{ + // throw new NotImplementedException(); + //} + + //protected override bool testEndGame(List playableCard) + //{ + // throw new NotImplementedException(); + //} + + //protected override void tryToFindSoluce(List playableCard) + //{ + // throw new NotImplementedException(); + //} + } +} diff --git a/TheGameExtreme/model/manager/multiplayer/RemoteGameManager 2.cs b/TheGameExtreme/model/manager/multiplayer/RemoteGameManager 2.cs new file mode 100644 index 0000000..dd30116 --- /dev/null +++ b/TheGameExtreme/model/manager/multiplayer/RemoteGameManager 2.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using TheGameExtreme.model.card; +using TheGameExtreme.model.gameActions.classic; + +namespace TheGameExtreme.model.manager.multiplayer +{ + public class RemoteGameManager : MultiplayerGameManager + { + public RemoteGameManager(Parametreur parametreur) : base(parametreur) + { + } + + //public override bool endTurn() + //{ + // throw new NotImplementedException(); + //} + + //protected override bool effectLose() + //{ + // throw new NotImplementedException(); + //} + + //protected override bool isEndGame() + //{ + // throw new NotImplementedException(); + //} + + //protected override void pioche() + //{ + // throw new NotImplementedException(); + //} + + //protected override bool testEndGame(List playableCard) + //{ + // throw new NotImplementedException(); + //} + + //protected override void tryToFindSoluce(List playableCard) + //{ + // throw new NotImplementedException(); + //} + } +} diff --git a/TheGameExtreme/view/App 2.xaml b/TheGameExtreme/view/App 2.xaml new file mode 100644 index 0000000..2dea446 --- /dev/null +++ b/TheGameExtreme/view/App 2.xaml @@ -0,0 +1,13 @@ + + + + + + black + white + SkyBlue + + + + + \ No newline at end of file diff --git a/TheGameExtreme/view/AppRessources-br.Designer 2.cs b/TheGameExtreme/view/AppRessources-br.Designer 2.cs new file mode 100644 index 0000000..0958a53 --- /dev/null +++ b/TheGameExtreme/view/AppRessources-br.Designer 2.cs @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------------ +// +// Ce code a été généré par un outil. +// Version du runtime :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é. +// +//------------------------------------------------------------------------------ + +namespace TheGameExtreme { + using System; + + + /// + /// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées. + /// + // 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 AppRessources_br { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal AppRessources_br() { + } + + /// + /// Retourne l'instance ResourceManager mise en cache utilisée par cette classe. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TheGameExtreme.AppRessources-br", typeof(AppRessources_br).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Remplace la propriété CurrentUICulture du thread actuel pour toutes + /// les recherches de ressources à l'aide de cette classe de ressource fortement typée. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Recherche une chaîne localisée semblable à rising stack. + /// + internal static string StrAcendingStack { + get { + return ResourceManager.GetString("StrAcendingStack", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à the chosen pile does not exist. + /// + internal static string StrCantGetStack { + get { + return ResourceManager.GetString("StrCantGetStack", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à You have not played enough cards!. + /// + internal static string StrCardPlayedLessThanTwo { + get { + return ResourceManager.GetString("StrCardPlayedLessThanTwo", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Please select a card to place on a stack. + /// + internal static string StrChooseCardToPlay { + get { + return ResourceManager.GetString("StrChooseCardToPlay", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Select the stack on which you want to put the card. + /// + internal static string StrChooseStack { + get { + return ResourceManager.GetString("StrChooseStack", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Down stack. + /// + internal static string StrDownStack { + get { + return ResourceManager.GetString("StrDownStack", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à End of turn. + /// + internal static string StrEndTurn { + get { + return ResourceManager.GetString("StrEndTurn", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à . + /// + internal static string String1 { + get { + return ResourceManager.GetString("String1", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à The game is over! Sorry, you lost ... Try again!. + /// + internal static string StrLose { + get { + return ResourceManager.GetString("StrLose", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à The game is over! Sorry, you lost ... You had to play three cards because of the effect \ "Three cards played \" off your game does not play as much! Try again!. + /// + internal static string StrLose3CardEffect { + get { + return ResourceManager.GetString("StrLose3CardEffect", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à The player has no more cards in his hand. + /// + internal static string StrNoMoreCardOnHand { + get { + return ResourceManager.GetString("StrNoMoreCardOnHand", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à Sorry, you did not cover the skull ... Try again;). + /// + internal static string StrSkullEffect { + get { + return ResourceManager.GetString("StrSkullEffect", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à The game is over! Well done you won!. + /// + internal static string StrWin { + get { + return ResourceManager.GetString("StrWin", resourceCulture); + } + } + + /// + /// Recherche une chaîne localisée semblable à The card does not fit in the selected stack!. + /// + internal static string StrWrongStack { + get { + return ResourceManager.GetString("StrWrongStack", resourceCulture); + } + } + } +} diff --git a/TheGameExtreme/view/GamePreparationPage 3.xaml b/TheGameExtreme/view/GamePreparationPage 3.xaml new file mode 100644 index 0000000..2346f0f --- /dev/null +++ b/TheGameExtreme/view/GamePreparationPage 3.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TheGameExtreme/view/GamePreparationPage.xaml 3.cs b/TheGameExtreme/view/GamePreparationPage.xaml 3.cs new file mode 100644 index 0000000..3377323 --- /dev/null +++ b/TheGameExtreme/view/GamePreparationPage.xaml 3.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Xamarin.Forms; + +namespace TheGameExtreme.view +{ + public partial class GamePreparationPage : ContentPage + { + + private string instructionText; + public string InstructionText + { + get { return instructionText; } + set + { + instructionText = value; + OnPropertyChanged("InstructionText"); + } + } + + + public GamePreparationPage() + { + InitializeComponent(); + NavigationPage.SetHasNavigationBar(this, false); + Instruction.SetBinding(Label.TextProperty, new Binding("InstructionText", source: this)); + InstructionText = AppRessource.StrPlayerSelection; + } + } +} diff --git a/TheGameExtreme/view/Image/thegame 2.jpg b/TheGameExtreme/view/Image/thegame 2.jpg new file mode 100644 index 0000000..524a62e Binary files /dev/null and b/TheGameExtreme/view/Image/thegame 2.jpg differ diff --git a/TheGameExtreme/viewmodel/CardVM 2.cs b/TheGameExtreme/viewmodel/CardVM 2.cs new file mode 100644 index 0000000..9416d8b --- /dev/null +++ b/TheGameExtreme/viewmodel/CardVM 2.cs @@ -0,0 +1,33 @@ +using System; +using System.ComponentModel; +using TheGameExtreme.model.card; + +namespace TheGameExtreme.viewmodel +{ + public class CardVM : INotifyPropertyChanged + { + + public event PropertyChangedEventHandler PropertyChanged; + public Card View { get; set; } + private int value; + public int Value { + get { return value; } + set + { + this.value = value; + OnPropertyChanged("Value"); + } + } + protected virtual void OnPropertyChanged(string info) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info)); + } + + public CardVM(Card view) + { + View = view; + + Value = view.Value; + } + } +} diff --git a/UnitTestProjectGame/Properties/AssemblyInfo 4.cs b/UnitTestProjectGame/Properties/AssemblyInfo 4.cs new file mode 100644 index 0000000..1fab91b --- /dev/null +++ b/UnitTestProjectGame/Properties/AssemblyInfo 4.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("UnitTestProjectGame")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("UnitTestProjectGame")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("4092c852-d253-42f7-a800-e618c99c349e")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]