Placement de l'icone entre pendant le jeu, redimensionnement de ce dernier, amélioration des créations de deck et de piles, implémentations de la gestion du nombre de carte par partie + divers corrections

master
cldupland 5 years ago
parent 198c1f7aeb
commit 37bdf0fb20

@ -2,5 +2,4 @@ Mono-utilisateur:
- Multilangue
- Changer les thèmes et les couleurs (en option) V => pour l'instant thème blanc et noir
- Option pour mettre/enlever le pas de 10
- Logo entre les piles (à finir de placer et de redimensionner)
- nb carte
- gérer les différents pas pour les différents deck (multiples, etc...)

@ -10,7 +10,7 @@ using Xamarin.Forms;
namespace TheGameExtreme.Droid
{
[Activity(Label = "TheGameExtreme", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Landscape)]
[Activity(Label = "OrderStacks", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Landscape)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -45,11 +45,13 @@
<None Remove="Media\Engrenage.jpeg" />
<None Remove="Media\moon.jpg" />
<None Remove="AppRessources-br.Designer.cs.orig" />
<None Remove="Media\TrierImageB.png" />
<None Remove="Media\TrierImageBMax.png" />
<None Remove="Media\TrierImageBMin.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Media\thegame.jpg" />
<EmbeddedResource Include="Media\TrierImageB.png" />
<EmbeddedResource Include="Media\TrierImageBMax.png" />
<EmbeddedResource Include="Media\TrierImageBMin.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="AppRessource.resx">

@ -6,15 +6,15 @@ namespace TheGameExtreme.model.deck
{
public class CentaineDeck : Deck
{
public CentaineDeck()
public CentaineDeck(int nbCard, decimal borneMin, decimal borneMax) : base(nbCard)
{
decimal d;
Random random = new Random();
for (int i = -499; i <= 499; i += 10)
int borneMinRandom = (int)(borneMin * 100);
int borneMaxRandom = (int)(borneMax * 100);
while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom))
{
d = (decimal)(random.Next(i, i+10)) / 100;
deck.Add(new ClassicCard(d));
decimal value = (decimal)(random.Next(borneMinRandom, borneMaxRandom)) / 100;
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value));
}
}
}

@ -6,11 +6,13 @@ namespace TheGameExtreme.model.deck
{
public class ClassicDeck : Deck
{
public ClassicDeck()
public ClassicDeck(int nbCard, int borneMin, int borneMax) : base(nbCard)
{
for (int i = 2; i <= 99; i++)
Random random = new Random();
while (deck.Count < nbCard && deck.Count < (borneMax - borneMin))
{
deck.Add(new ClassicCard(i));
int value = random.Next(borneMin, borneMax);
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value));
}
}
}

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

@ -8,6 +8,12 @@ namespace TheGameExtreme.model.deck
{
protected List<Card> deck = new List<Card>();
protected int nbCard;
protected Deck(int nbCard)
{
this.nbCard = nbCard;
}
public int size()
{
@ -74,36 +80,6 @@ namespace TheGameExtreme.model.deck
return;
}
}
//int mediane = (end - start) / 2 + start;
//int comparateur = deck[mediane].Value.CompareTo(card.Value);
//if (mediane == end)
//{
// if (comparateur < 0)
// {
// deck.Insert(start, card);
// }
// else
// {
// deck.Insert(end, card);
// }
// return;
//}
//if (comparateur == 0)
//{
// return;
//}
//else if (comparateur < 0)
//{
// InsertionDichotomique(deck, start, mediane, card);
// return;
//}
//else
//{
// InsertionDichotomique(deck, mediane, end, card);
// return;
//}
}
}
}

@ -1,16 +1,19 @@
using System;
using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.deck
{
public class DizaineDeck : Deck
{
public DizaineDeck()
public DizaineDeck(int nbCard, decimal borneMin, decimal borneMax) : base(nbCard)
{
for (decimal i = -4.9m; i <= 4.9m; i += 0.1m)
Random random = new Random();
int borneMinRandom = (int)(borneMin * 10);
int borneMaxRandom = (int)(borneMax * 10);
while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom))
{
deck.Add(new ClassicCard(i));
decimal value = (decimal)(random.Next(borneMinRandom, borneMaxRandom)) / 10;
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value));
}
}
}

@ -13,7 +13,7 @@ namespace TheGameExtreme.model.deck
private List<int> threeCard;
private Random random = new Random();
public ExtremeDeck()
public ExtremeDeck(int nbCard) : base(nbCard)
{
endGame = new List<int>();
threeCard = new List<int>();

@ -9,21 +9,24 @@ namespace TheGameExtreme.model.deck
/**
* Fonction permettant de créer un jeu de carte pour jouer avec les fractions
*/
public FractionDeck()
public FractionDeck(int nbCard, decimal borneMin, decimal borneMax) : base(nbCard)
{
Random random = new Random();
for (int i = 1; i < 100; i ++)
while (deck.Count < nbCard)
{
int numerateur = random.Next(1, 100);
int denominateur = random.Next(1, 100);
int pgcd = PGCD(numerateur, denominateur);
while (pgcd != 1)
int numerateur = random.Next(1, 99);
int denominateur = random.Next(1, 99);
if ((decimal)(numerateur / denominateur) > borneMin && (decimal)(numerateur / denominateur) < borneMax)
{
numerateur /= pgcd;
denominateur /= pgcd;
pgcd = PGCD(numerateur, denominateur);
int pgcd = PGCD(numerateur, denominateur);
while (pgcd != 1)
{
numerateur /= pgcd;
denominateur /= pgcd;
pgcd = PGCD(numerateur, denominateur);
}
InsertionDichotomique(deck, 0, deck.Count - 1, new FractionCard(new Fraction(numerateur, denominateur)));
}
InsertionDichotomique(deck, 0, deck.Count-1, new FractionCard(new Fraction(numerateur, denominateur)));
}
}

@ -6,15 +6,15 @@ namespace TheGameExtreme.model.deck
{
public class MilliemeDeck : Deck
{
public MilliemeDeck()
public MilliemeDeck(int nbCard, decimal borneMin, decimal borneMax) : base(nbCard)
{
decimal d;
Random random = new Random();
for (int i = -4999; i <= 4999; i += 100)
int borneMinRandom = (int)(borneMin * 1000);
int borneMaxRandom = (int)(borneMax * 1000);
while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom))
{
d = (decimal)(random.Next(i, i + 100)) / 1000;
deck.Add(new ClassicCard(d));
decimal value = (decimal)(random.Next(borneMinRandom, borneMaxRandom)) / 1000;
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value));
}
}
}

@ -0,0 +1,18 @@
using System;
using TheGameExtreme.model.card.cardType;
namespace TheGameExtreme.model.deck
{
public class RelativeDeck : Deck
{
public RelativeDeck(int nbCard, int borneMin, int borneMax) : base(nbCard)
{
Random random = new Random();
while (deck.Count < nbCard && deck.Count < (borneMax - borneMin))
{
int value = random.Next(borneMin, borneMax);
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value));
}
}
}
}

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

@ -15,11 +15,11 @@ namespace TheGameExtreme.model.piles
{
if (i < (nbPile * 0.5))
{
ListOrderedStacks[i].Push(new ClassicCard(1));
ListOrderedStacks[i].Push(new ClassicCard(0m));
}
else
{
ListOrderedStacks[i].Push(new ClassicCard(100));
ListOrderedStacks[i].Push(new ClassicCard(100m));
}
}
}

@ -11,11 +11,11 @@ namespace TheGameExtreme.model.piles
{
if (i < (nbPile * 0.5))
{
ListOrderedStacks[i].Push(new ClassicCard(0));
ListOrderedStacks[i].Push(new ClassicCard(0m));
}
else
{
ListOrderedStacks[i].Push(new ClassicCard(100));
ListOrderedStacks[i].Push(new ClassicCard(50m));
}
}
}

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

@ -8,7 +8,7 @@ namespace TheGameExtreme.view
public partial class GamePreparationPage : ContentPage
{
public List<int> listNbPlayer = new List<int> { 1, 2, 3, 4, 5 };
public List<string> listGameMode = new List<string> { "entières", "relatives", "décimales", "dizaines", "centaines", "millièmes", "fractionnées" };
public List<string> listGameMode = new List<string> { "entières", "relatives", "dizaines", "centaines", "millièmes", "fractionnées" };
public List<int> listNbStack = new List<int> { 4, 6, 8 };
public List<int> listNbCard = new List<int> { 100, 80, 60, 40 };
@ -69,7 +69,7 @@ namespace TheGameExtreme.view
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.SelectedItem, (int)SelectMode.SelectedIndex));
await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.SelectedItem, (int)SelectMode.SelectedIndex, (int)SelectNbCard.SelectedItem));
}
private void ChangedPseudo(object sender, EventArgs args)

@ -74,8 +74,8 @@
Source="imagesRules.png"
Grid.Column="0"
Grid.Row="0"
HeightRequest="40"
WidthRequest="25"
HeightRequest="50"
WidthRequest="35"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Start"
Clicked="Rules_Clicked"

@ -26,7 +26,8 @@
<StackLayout
Grid.Row="0"
Grid.Column="1">
Grid.Column="1"
VerticalOptions="CenterAndExpand">
<Label
x:Name="pseudo"
Text="Pseudo"
@ -39,7 +40,8 @@
<StackLayout
Grid.Row="0"
Grid.Column="0">
Grid.Column="0"
VerticalOptions="CenterAndExpand">
<ImageButton
Source="HomeIcon.png"
HorizontalOptions="Start"
@ -55,6 +57,7 @@
<StackLayout
Grid.Row="0"
Grid.Column="2"
VerticalOptions="CenterAndExpand"
x:Name="gameOption">
<Button
x:Name="EndTurnButton"

@ -22,6 +22,7 @@ namespace TheGameExtreme.view
private Main viewmodel;
private List<string> playersNames;
private int nbPile;
private int nbCard;
private int indexMode;
List<TouchManipulationCard> textCollection = new List<TouchManipulationCard>();
List<TouchManipulationCard> stackCollection = new List<TouchManipulationCard>();
@ -36,10 +37,11 @@ namespace TheGameExtreme.view
* <param name="nbPile">Nombre de piles pour jouer</param>
* <param name="indexMode">Version du jeu joué</param>
*/
public MainPage(List<string> playersNames, int nbPile, int indexMode)
public MainPage(List<string> playersNames, int nbPile, int indexMode, int nbCard)
{
this.playersNames = playersNames;
this.nbPile = nbPile;
this.nbCard = nbCard;
this.indexMode = indexMode;
InitializeComponent();
@ -47,7 +49,7 @@ namespace TheGameExtreme.view
EndTurnButton.Text = AppRessource.StrEndTurn; // Trouver le moyen d'avoir du binding
viewmodel = new Main(playersNames, nbPile, indexMode);
viewmodel = new Main(playersNames, nbPile, nbCard, indexMode);
viewmodel.EndGame += OnEndGame;
@ -58,11 +60,21 @@ namespace TheGameExtreme.view
InflateStack();
InflateHand();
using (Stream stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("TheGameExtreme.Media.TrierImageB.png"))
string ressourceID;
if (DeviceDisplay.MainDisplayInfo.Height > 1500)
{
ressourceID = "TheGameExtreme.Media.TrierImageBMax.png";
}
else
{
ressourceID = "TheGameExtreme.Media.TrierImageBMin.png";
}
using (Stream stream = GetType().GetTypeInfo().Assembly.GetManifestResourceStream(ressourceID))
{
logo = SKBitmap.Decode(stream);
}
logoPoint = new SKPoint((float)DeviceDisplay.MainDisplayInfo.Width * 0.5f - logo.Width * 0.5f, (float)(DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.5f - logo.Height * 0.5f);
logoPoint = new SKPoint((float)DeviceDisplay.MainDisplayInfo.Width * 0.5f - logo.Width, (float)(DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.5f - logo.Height * 0.5f);
}
@ -291,7 +303,7 @@ namespace TheGameExtreme.view
*/
private void Retry(object sender, EventArgs args)
{
viewmodel = new Main(playersNames, nbPile, indexMode);
viewmodel = new Main(playersNames, nbPile, nbCard, indexMode);
viewmodel.EndGame += OnEndGame;

@ -52,35 +52,32 @@ namespace TheGameExtreme.viewmodel
public List<Stack<CardVM>> listOrderedStacks = new List<Stack<CardVM>>();
public Main(List<string> playersNames, int nbPile, int indexMode)
public Main(List<string> playersNames, int nbPile, int nbCard, int indexMode)
{
playersNames.ForEach(name => players.Add(new PlayerVM(new Player(name))));
GameMode gameMode;
switch (indexMode)
{
case 0:
gameMode = new GameMode(new ClassicPiles(nbPile), new ClassicDeck());
gameMode = new GameMode(new ClassicPiles(nbPile), new ClassicDeck(nbCard, 1, 99));
break;
case 1:
gameMode = new GameMode(new _50Range100Piles(nbPile), new _50Range100Deck());
gameMode = new GameMode(new PilesMoins51To51(nbPile), new RelativeDeck(nbCard, -49, 49));
break;
case 2:
gameMode = new GameMode(new Piles0To1(nbPile), new DecimalDeck());
gameMode = new GameModeDecimal(new Piles0To10(nbPile), new DizaineDeck(nbCard, 0.1m, 9.9m));
break;
case 3:
gameMode = new GameModeDecimal(new Piles0To10(nbPile), new DizaineDeck());
gameMode = new GameMode(new PilesMoins5To5(nbPile), new CentaineDeck(nbCard, -4.99m, 4.99m));
break;
case 4:
gameMode = new GameMode(new PilesMoins5To5(nbPile), new CentaineDeck());
gameMode = new GameMode(new PilesMoins5To5(nbPile), new MilliemeDeck(nbCard, -4.999m, 4.999m));
break;
case 5:
gameMode = new GameMode(new PilesMoins5To5(nbPile), new MilliemeDeck());
break;
case 6:
gameMode = new GameModeDecimal(new FractionPiles(nbPile), new FractionDeck());
gameMode = new GameModeDecimal(new FractionPiles(nbPile), new FractionDeck(nbCard, 0m, 51m));
break;
default:
gameMode = new GameMode(new ClassicPiles(nbPile), new ClassicDeck());
gameMode = new GameMode(new ClassicPiles(nbPile), new ClassicDeck(nbCard, 1, 99));
break;
}
Parametreur parametreur = new Parametreur(gameMode);

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save