Fraction dessiné correctement, correcteur d'orthographe désactivé pour les pseudos, doublons dans les deck supprimés. Positionnement correct pour le plein écran

master
cldupland 5 years ago
parent f132de140f
commit 895133fa38

@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using TheGameExtreme.model.card; using TheGameExtreme.model.card;
using TheGameExtreme.model.card.cardType; using TheGameExtreme.model.card.cardType;
@ -12,6 +13,14 @@ namespace TheGameExtreme.model.deck
while (deck.Count < nbCard && deck.Count < (borneMax - borneMin)) while (deck.Count < nbCard && deck.Count < (borneMax - borneMin))
{ {
int value = random.Next(borneMin, borneMax); 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)); InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value));
} }
} }

@ -55,11 +55,15 @@ namespace TheGameExtreme.model.deck
deck.Insert(end + 1, card); deck.Insert(end + 1, card);
return; return;
} }
else else if (deck[end].Value.CompareTo(card.Value) > 0)
{ {
deck.Insert(end, card); deck.Insert(end, card);
return; return;
} }
else
{
return;
}
} }
else else
{ {

@ -19,7 +19,7 @@ namespace TheGameExtreme.model.deck
{ {
if (deck.Count < nbCard) 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 else
{ {

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

@ -167,7 +167,8 @@
HorizontalOptions="Center" HorizontalOptions="Center"
MinimumWidthRequest="50" MinimumWidthRequest="50"
WidthRequest="200" WidthRequest="200"
MaxLength="18"/> MaxLength="18"
IsTextPredictionEnabled="False"/>
</StackLayout> </StackLayout>
</ScrollView> </ScrollView>

@ -88,7 +88,8 @@ namespace TheGameExtreme.view
WidthRequest = 200, WidthRequest = 200,
MinimumWidthRequest = 50, MinimumWidthRequest = 50,
HorizontalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center,
MaxLength = 18 MaxLength = 18,
IsTextPredictionEnabled = false
}; };

@ -198,15 +198,7 @@ namespace TheGameExtreme.view
SKPaint textPaint = new SKPaint(); 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")))); 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; float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
if (indexMode == 4 || indexMode == 3)
{
inflateWidth = 0.03f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
}
else
{
inflateWidth = 0.02f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
}
position.X -= inflateWidth; 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(); string displayMax = Math.Pow(10, ((FractionCard)(viewmodel.getListOrderedStacks()[i].Peek().View)).Fraction.SizeMax-1).ToString();
textWidth = textPaint.MeasureText(displayMax); textWidth = textPaint.MeasureText(displayMax);
textPaint.TextSize = 0.048f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText(displayMax);
} }
else else
{ {
textWidth = textPaint.MeasureText("00"); 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; position.X -= textWidth * 0.5f;
stackCollection.Add(new TouchManipulationCard(textPaint, viewmodel.getListOrderedStacks()[i].Peek(), inflateWidth) stackCollection.Add(new TouchManipulationCard(textPaint, viewmodel.getListOrderedStacks()[i].Peek(), inflateWidth)
@ -248,15 +239,7 @@ namespace TheGameExtreme.view
SKPaint textPaint = new SKPaint(); 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")))); 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; float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
if (indexMode == 4 || indexMode == 3)
{
inflateWidth = 0.03f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
}
else
{
inflateWidth = 0.015f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
}
position.X -= inflateWidth; position.X -= inflateWidth;
@ -269,13 +252,12 @@ namespace TheGameExtreme.view
{ {
string displayMax = Math.Pow(10, ((FractionCard)(viewmodel.CurrentHand[i].View)).Fraction.SizeMax-1).ToString(); string displayMax = Math.Pow(10, ((FractionCard)(viewmodel.CurrentHand[i].View)).Fraction.SizeMax-1).ToString();
textWidth = textPaint.MeasureText(displayMax); textWidth = textPaint.MeasureText(displayMax);
textPaint.TextSize = 0.048f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText(displayMax);
} }
else else
{ {
textWidth = textPaint.MeasureText("00"); 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; position.X -= textWidth * 0.5f;
textCollection.Add(new TouchManipulationCard(textPaint, viewmodel.CurrentHand[i], inflateWidth) textCollection.Add(new TouchManipulationCard(textPaint, viewmodel.CurrentHand[i], inflateWidth)

@ -129,7 +129,7 @@ namespace TheGameExtreme.view
xNum += textPaint.MeasureText("0"); xNum += textPaint.MeasureText("0");
tailleNum *= 10; tailleNum *= 10;
} }
while (tailleDen < Math.Pow(10, sizeMax * 0.5)) while (tailleDen < Math.Pow(10, (int)(sizeMax * 0.5)))
{ {
xDen += textPaint2.MeasureText("0"); xDen += textPaint2.MeasureText("0");
tailleDen *= 10; tailleDen *= 10;
@ -137,7 +137,7 @@ namespace TheGameExtreme.view
canvas.DrawRect(card, textPaint1); canvas.DrawRect(card, textPaint1);
canvas.DrawText(((FractionCard)Value.View).Fraction.Numerateur.ToString(), xNum, -height * 0.5f, textPaint); 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); canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), xDen, height * 0.5f, textPaint2);
} }
else else

Loading…
Cancel
Save