diff --git a/TheGameExtreme/model/deck/ClassicDeck.cs b/TheGameExtreme/model/deck/ClassicDeck.cs index 2ca9fb5..b13e1ef 100644 --- a/TheGameExtreme/model/deck/ClassicDeck.cs +++ b/TheGameExtreme/model/deck/ClassicDeck.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using TheGameExtreme.model.card; using TheGameExtreme.model.card.cardType; @@ -12,6 +13,14 @@ namespace TheGameExtreme.model.deck while (deck.Count < nbCard && deck.Count < (borneMax - borneMin)) { int value = random.Next(borneMin, borneMax); + //foreach (Card card in deck) + //{ + // if (card.Value.CompareTo(value) == 0) + // { + // Debug.WriteLine("Regarde!"); + // break; + // } + //} InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value)); } } diff --git a/TheGameExtreme/model/deck/Deck.cs b/TheGameExtreme/model/deck/Deck.cs index 3b07b7b..d5145d3 100644 --- a/TheGameExtreme/model/deck/Deck.cs +++ b/TheGameExtreme/model/deck/Deck.cs @@ -55,11 +55,15 @@ namespace TheGameExtreme.model.deck deck.Insert(end + 1, card); return; } - else + else if (deck[end].Value.CompareTo(card.Value) > 0) { deck.Insert(end, card); return; } + else + { + return; + } } else { diff --git a/TheGameExtreme/model/deck/FractionDeck.cs b/TheGameExtreme/model/deck/FractionDeck.cs index 1b04eb4..3ab193f 100644 --- a/TheGameExtreme/model/deck/FractionDeck.cs +++ b/TheGameExtreme/model/deck/FractionDeck.cs @@ -19,7 +19,7 @@ namespace TheGameExtreme.model.deck { if (deck.Count < nbCard) { - InsertionDichotomique(deck, 0, deck.Count - 1, new FractionCard(new Fraction(i, j, 1))); + InsertionDichotomique(deck, 0, deck.Count - 1, new FractionCard(new Fraction(i, j, 2))); } else { diff --git a/TheGameExtreme/model/piles/FractionPiles.cs b/TheGameExtreme/model/piles/FractionPiles.cs index 7dbfefb..ed35363 100644 --- a/TheGameExtreme/model/piles/FractionPiles.cs +++ b/TheGameExtreme/model/piles/FractionPiles.cs @@ -11,11 +11,11 @@ namespace TheGameExtreme.model.piles { if (i < (nbPile * 0.5)) { - ListOrderedStacks[i].Push(new ClassicCard(0m)); + ListOrderedStacks[i].Push(new FractionCard(new Fraction(0, 1, 2))); } else { - ListOrderedStacks[i].Push(new ClassicCard(25m)); + ListOrderedStacks[i].Push(new FractionCard(new Fraction(25, 1, 2))); } } } diff --git a/TheGameExtreme/view/GamePreparationPage.xaml b/TheGameExtreme/view/GamePreparationPage.xaml index c357bfe..d40e0e4 100644 --- a/TheGameExtreme/view/GamePreparationPage.xaml +++ b/TheGameExtreme/view/GamePreparationPage.xaml @@ -167,7 +167,8 @@ HorizontalOptions="Center" MinimumWidthRequest="50" WidthRequest="200" - MaxLength="18"/> + MaxLength="18" + IsTextPredictionEnabled="False"/> diff --git a/TheGameExtreme/view/GamePreparationPage.xaml.cs b/TheGameExtreme/view/GamePreparationPage.xaml.cs index 760a909..0b4f868 100644 --- a/TheGameExtreme/view/GamePreparationPage.xaml.cs +++ b/TheGameExtreme/view/GamePreparationPage.xaml.cs @@ -88,7 +88,8 @@ namespace TheGameExtreme.view WidthRequest = 200, MinimumWidthRequest = 50, HorizontalOptions = LayoutOptions.Center, - MaxLength = 18 + MaxLength = 18, + IsTextPredictionEnabled = false }; diff --git a/TheGameExtreme/view/MainPage.xaml.cs b/TheGameExtreme/view/MainPage.xaml.cs index f34e99f..7288688 100644 --- a/TheGameExtreme/view/MainPage.xaml.cs +++ b/TheGameExtreme/view/MainPage.xaml.cs @@ -198,15 +198,7 @@ namespace TheGameExtreme.view SKPaint textPaint = new SKPaint(); SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width - 20) / (viewmodel.getListOrderedStacks().Count * 2)) + 10f, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.01 + 2 * (0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("001")))); - float inflateWidth; - if (indexMode == 4 || indexMode == 3) - { - inflateWidth = 0.03f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); - } - else - { - inflateWidth = 0.02f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); - } + float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); position.X -= inflateWidth; @@ -219,13 +211,12 @@ namespace TheGameExtreme.view { string displayMax = Math.Pow(10, ((FractionCard)(viewmodel.getListOrderedStacks()[i].Peek().View)).Fraction.SizeMax-1).ToString(); textWidth = textPaint.MeasureText(displayMax); - textPaint.TextSize = 0.048f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText(displayMax); } else { textWidth = textPaint.MeasureText("00"); - textPaint.TextSize = 0.04f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("00"); } + textPaint.TextSize = 0.03f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("00"); position.X -= textWidth * 0.5f; stackCollection.Add(new TouchManipulationCard(textPaint, viewmodel.getListOrderedStacks()[i].Peek(), inflateWidth) @@ -248,15 +239,7 @@ namespace TheGameExtreme.view SKPaint textPaint = new SKPaint(); SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width - 20) / (viewmodel.CurrentHand.Count * 2)) + 10f, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.1 - 2 * (0.05f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("001")))); - float inflateWidth; - if (indexMode == 4 || indexMode == 3) - { - inflateWidth = 0.03f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); - } - else - { - inflateWidth = 0.015f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); - } + float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); position.X -= inflateWidth; @@ -269,15 +252,14 @@ namespace TheGameExtreme.view { string displayMax = Math.Pow(10, ((FractionCard)(viewmodel.CurrentHand[i].View)).Fraction.SizeMax-1).ToString(); textWidth = textPaint.MeasureText(displayMax); - textPaint.TextSize = 0.048f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText(displayMax); } else { textWidth = textPaint.MeasureText("00"); - textPaint.TextSize = 0.048f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("00"); } + textPaint.TextSize = 0.03f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("00"); position.X -= textWidth * 0.5f; - + textCollection.Add(new TouchManipulationCard(textPaint, viewmodel.CurrentHand[i], inflateWidth) { Matrix = SKMatrix.MakeTranslation(position.X, position.Y), diff --git a/TheGameExtreme/view/TouchManipulationCard.cs b/TheGameExtreme/view/TouchManipulationCard.cs index eb38e4e..3777b78 100644 --- a/TheGameExtreme/view/TouchManipulationCard.cs +++ b/TheGameExtreme/view/TouchManipulationCard.cs @@ -129,7 +129,7 @@ namespace TheGameExtreme.view xNum += textPaint.MeasureText("0"); tailleNum *= 10; } - while (tailleDen < Math.Pow(10, sizeMax * 0.5)) + while (tailleDen < Math.Pow(10, (int)(sizeMax * 0.5))) { xDen += textPaint2.MeasureText("0"); tailleDen *= 10; @@ -137,7 +137,7 @@ namespace TheGameExtreme.view canvas.DrawRect(card, textPaint1); canvas.DrawText(((FractionCard)Value.View).Fraction.Numerateur.ToString(), xNum, -height * 0.5f, textPaint); - canvas.DrawText(fractionBarre, 0, -textPaint1.TextSize * 0.6f, textPaint1); + canvas.DrawText(fractionBarre, 0, -textPaint1.TextSize * 0.5f, textPaint1); canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), xDen, height * 0.5f, textPaint2); } else