En cours d'implémentation du changement des fractions

master
cldupland 5 years ago
parent ae80225ad3
commit f310a99634

@ -13,8 +13,8 @@ namespace TheGameExtreme.model.deck
int borneMaxRandom = (int)(borneMax * 100); int borneMaxRandom = (int)(borneMax * 100);
while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom)) while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom))
{ {
decimal value = (decimal)(random.Next(borneMinRandom, borneMaxRandom)) / 100; int value = random.Next(borneMinRandom, borneMaxRandom);
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value)); InsertionDichotomique(deck, 0, deck.Count-1, new FractionCard(new Fraction(value, 100)));
} }
} }
} }

@ -12,8 +12,8 @@ namespace TheGameExtreme.model.deck
int borneMaxRandom = (int)(borneMax * 10); int borneMaxRandom = (int)(borneMax * 10);
while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom)) while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom))
{ {
decimal value = (decimal)(random.Next(borneMinRandom, borneMaxRandom)) / 10; int value = random.Next(borneMinRandom, borneMaxRandom);
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value)); InsertionDichotomique(deck, 0, deck.Count-1, new FractionCard(new Fraction(value, 10)));
} }
} }
} }

@ -13,8 +13,8 @@ namespace TheGameExtreme.model.deck
int borneMaxRandom = (int)(borneMax * 1000); int borneMaxRandom = (int)(borneMax * 1000);
while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom)) while (deck.Count < nbCard && deck.Count < (borneMaxRandom - borneMinRandom))
{ {
decimal value = (decimal)(random.Next(borneMinRandom, borneMaxRandom)) / 1000; int value = random.Next(borneMinRandom, borneMaxRandom);
InsertionDichotomique(deck, 0, deck.Count-1, new ClassicCard(value)); InsertionDichotomique(deck, 0, deck.Count-1, new FractionCard(new Fraction(value, 1000)));
} }
} }
} }

@ -214,25 +214,24 @@ namespace TheGameExtreme.view
textPaint = new SKPaint(); textPaint = new SKPaint();
float textWidth; float textWidth;
if (indexMode == 5) if (indexMode == 2 || indexMode == 5)
{ {
textWidth = textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("00");
textPaint.TextSize = 0.04f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textPaint.TextSize = 0.04f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
} }
else else if (indexMode == 3)
{
if (indexMode == 3)
{ {
textPaint.TextSize = 0.035f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("000");
textPaint.TextSize = 0.04f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("000");
} }
else if (indexMode == 4) else if (indexMode == 4)
{ {
textPaint.TextSize = 0.025f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("0000");
textPaint.TextSize = 0.038f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("0000");
} }
else else
{ {
textPaint.TextSize = 0.04f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textPaint.TextSize = 0.04f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
}
textWidth = textPaint.MeasureText(viewmodel.getListOrderedStacks()[i].Peek().Value.ToString()); textWidth = textPaint.MeasureText(viewmodel.getListOrderedStacks()[i].Peek().Value.ToString());
} }
position.X -= textWidth * 0.5f; position.X -= textWidth * 0.5f;
@ -272,25 +271,24 @@ namespace TheGameExtreme.view
textPaint = new SKPaint(); textPaint = new SKPaint();
float textWidth; float textWidth;
if (indexMode == 5) if (indexMode == 2 || indexMode == 5)
{ {
textWidth = textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("00");
textPaint.TextSize = 0.048f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textPaint.TextSize = 0.048f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
} }
else else if (indexMode == 3)
{
if (indexMode == 3)
{ {
textPaint.TextSize = 0.038f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("000");
textPaint.TextSize = 0.048f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("000");
} }
else if (indexMode == 4) else if (indexMode == 4)
{ {
textPaint.TextSize = 0.028f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("0000");
textPaint.TextSize = 0.038f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("0000");
} }
else else
{ {
textPaint.TextSize = 0.048f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00"); textPaint.TextSize = 0.048f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
}
textWidth = textPaint.MeasureText(viewmodel.CurrentHand[i].Value.ToString()); textWidth = textPaint.MeasureText(viewmodel.CurrentHand[i].Value.ToString());
} }
position.X -= textWidth * 0.5f; position.X -= textWidth * 0.5f;

Loading…
Cancel
Save