Merge branch 'multiplayer_view' of https://gitlab.iut-clermont.uca.fr/cldupland/thegameextreme into multiplayer_view

master
cldupland 6 years ago
commit 093b98efa4

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TheGameExtreme.Android\TheGameExtreme.Android.csproj" />
<ProjectReference Include="..\TheGameExtreme.iOS\TheGameExtreme.iOS.csproj" />
<ProjectReference Include="..\TheGameExtreme\TheGameExtreme.csproj" />
</ItemGroup>
</Project>

@ -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();
}
}*/
}

@ -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");

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.uca.thegameextreme" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="TheGameExtreme.Android" android:icon="@drawable/Apple"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:tabIndicatorColor="@android:color/white" app:tabGravity="fill" app:tabMode="fixed" />

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/launcher_background" />
<foreground android:drawable="@mipmap/launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" ?>

@ -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"
}
}

@ -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")]

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

@ -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();
}
}

@ -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;
}
}
}

@ -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;
}
}
}

@ -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;
}
}
}

@ -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<Player> players = new List<Player>();
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);
}
}
}
}

@ -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);
}
}
}
}

@ -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;
}
}
}

@ -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;
}
}
}

@ -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<GameAction> gameActions;
protected Piles piles;
public int NbCardAtBeginOfTurn { get; set; }
protected Deck deck;
protected int nbMaxCard;
public string Message { get; set; }
#region
public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
public event EventHandler<PlayerChangedEventArgs> PlayerChanged;
protected internal void OnTopRangeChanged(TopRangeChangedEventArgs args)
{
TopRangeChanged?.Invoke(this, args);
}
protected internal void OnPlayerChanged(PlayerChangedEventArgs args)
{
PlayerChanged?.Invoke(this, args);
}
#endregion
public GameMode()
{
gameActions = new List<GameAction>();
}
public void load(int nbPlayer, List<Player> 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<Player> 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<Card> currentHand, Player player)
{
Message = null;
((Piocher)gameActions[0]).pioche(currentHand, deck, player);
}
public void playCard(int valueCard, List<Card> currentHand, int orderedStackSelected, Player player, List<Card> 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<Card> currentHand, List<Card> 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<Card> currentHand)
{
if (currentHand.Count != 0)
{
List<Card> playableCard = new List<Card>();
tryToFindSoluce(playableCard, currentHand);
return testEndGame(playableCard);
}
return false;
}
protected void tryToFindSoluce(List<Card> playableCard, List<Card> 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<Card> playableCard)
{
if (playableCard.Count < 2)
{
Message = "Le jeu est terminé!\n Désolé, vous avez perdu... Essayez encore!";
return true;
}
return false;
}
#endregion
}
}

@ -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<Card> CurrentHand, int orderedStackSelected, Player player, List<Card> 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<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)
{
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;
}
}
}
}

@ -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)
{
}
}
}

@ -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<Card> CurrentCardPlayed = new List<Card>();
public String EndMessage { get; set; }
protected int currentIndexPlayer;
protected List<Card> currentHand;
public List<Card> CurrentHand
{
get { return currentHand; }
set
{
currentHand = value;
OnPropertyChanged("CurrentHand");
}
}
#region event
public event EventHandler<TopRangeChangedEventArgs> TopRangeChanged;
public event EventHandler<PlayerChangedEventArgs> 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<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;
//}
}
}

@ -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<Card> playableCard)
//{
// throw new NotImplementedException();
//}
//protected override void tryToFindSoluce(List<Card> playableCard)
//{
// throw new NotImplementedException();
//}
}
}

@ -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<Card> playableCard)
//{
// throw new NotImplementedException();
//}
//protected override void tryToFindSoluce(List<Card> playableCard)
//{
// throw new NotImplementedException();
//}
}
}

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="TheGameExtreme.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="BlackColor">black</Color>
<Color x:Key="WhiteColor">white</Color>
<Color x:Key="SkyBlueColor">SkyBlue</Color>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -0,0 +1,189 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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é.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TheGameExtreme {
using System;
/// <summary>
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
/// </summary>
// 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() {
}
/// <summary>
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
/// </summary>
[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;
}
}
/// <summary>
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
/// 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 {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à rising stack.
/// </summary>
internal static string StrAcendingStack {
get {
return ResourceManager.GetString("StrAcendingStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à the chosen pile does not exist.
/// </summary>
internal static string StrCantGetStack {
get {
return ResourceManager.GetString("StrCantGetStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à You have not played enough cards!.
/// </summary>
internal static string StrCardPlayedLessThanTwo {
get {
return ResourceManager.GetString("StrCardPlayedLessThanTwo", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Please select a card to place on a stack.
/// </summary>
internal static string StrChooseCardToPlay {
get {
return ResourceManager.GetString("StrChooseCardToPlay", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Select the stack on which you want to put the card.
/// </summary>
internal static string StrChooseStack {
get {
return ResourceManager.GetString("StrChooseStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Down stack.
/// </summary>
internal static string StrDownStack {
get {
return ResourceManager.GetString("StrDownStack", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à End of turn.
/// </summary>
internal static string StrEndTurn {
get {
return ResourceManager.GetString("StrEndTurn", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à .
/// </summary>
internal static string String1 {
get {
return ResourceManager.GetString("String1", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à The game is over! Sorry, you lost ... Try again!.
/// </summary>
internal static string StrLose {
get {
return ResourceManager.GetString("StrLose", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à The game is over! Sorry, you lost ... You had to play three cards because of the effect \ &quot;Three cards played \&quot; off your game does not play as much! Try again!.
/// </summary>
internal static string StrLose3CardEffect {
get {
return ResourceManager.GetString("StrLose3CardEffect", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à The player has no more cards in his hand.
/// </summary>
internal static string StrNoMoreCardOnHand {
get {
return ResourceManager.GetString("StrNoMoreCardOnHand", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Sorry, you did not cover the skull ... Try again;).
/// </summary>
internal static string StrSkullEffect {
get {
return ResourceManager.GetString("StrSkullEffect", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à The game is over! Well done you won!.
/// </summary>
internal static string StrWin {
get {
return ResourceManager.GetString("StrWin", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à The card does not fit in the selected stack!.
/// </summary>
internal static string StrWrongStack {
get {
return ResourceManager.GetString("StrWrongStack", resourceCulture);
}
}
}
}

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
BackgroundColor="{DynamicResource BlackColor}"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TheGameExtreme.view.GamePreparationPage">
<Grid
Margin="0,30,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="35*" />
<RowDefinition Height="55*"/>
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<StackLayout
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="1">
<Label x:Name="Instruction"/>
</StackLayout>
<StackLayout
Grid.Row="1"
Grid.Column="0">
</StackLayout>
<StackLayout
Grid.Row="1"
Grid.Column="1">
</StackLayout>
<StackLayout
Grid.Row="2"
Grid.Column="0">
</StackLayout>
</Grid>
</ContentPage>

@ -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;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@ -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;
}
}
}

@ -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")]
Loading…
Cancel
Save