Version stable. Deployer sur le playstore

master
cldupland 5 years ago
parent 1ff7e4f3e2
commit 0fedf74b9d

@ -7,155 +7,164 @@
xmlns:resources="clr-namespace:TheGameExtreme.Resx" xmlns:resources="clr-namespace:TheGameExtreme.Resx"
x:Class="TheGameExtreme.view.GamePreparationPage"> x:Class="TheGameExtreme.view.GamePreparationPage">
<ScrollView> <Grid
Margin="5,5,5,5">
<Grid.RowDefinitions>
<RowDefinition Height="20*" />
<RowDefinition Height="80*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<StackLayout
Grid.Row="0"
Grid.Column="0">
<ImageButton Source="ArrowSettingsBack.png"
VerticalOptions="Start"
HorizontalOptions="StartAndExpand"
HeightRequest="40"
WidthRequest="50"
Clicked="Back"
BackgroundColor="Transparent"
Margin="10,5,0,0"/>
</StackLayout>
<StackLayout
Grid.Row="0"
Grid.Column="1">
<Button
Text="{x:Static resources:AppResources.StrBtnPlay}"
Clicked="Play"
HorizontalOptions="End"
MinimumWidthRequest="30"
WidthRequest="100"
BackgroundColor="{DynamicResource SkyBlueColor}"
CornerRadius="10"
Margin="0,5,10,0"/>
</StackLayout>
<Grid <Grid
Margin="5,0,5,5"> Grid.Row="1"
Grid.Column="1">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="5*" />
<RowDefinition Height="10*" />
<RowDefinition Height="5*" />
<RowDefinition Height="10*" /> <RowDefinition Height="10*" />
<RowDefinition Height="90*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<StackLayout <StackLayout
Grid.Row="0" Grid.Row="0"
Grid.Column="0"> Grid.Column="0">
<ImageButton Source="ArrowSettingsBack.png" <Label
VerticalOptions="Start" Text="{x:Static resources:AppResources.StrNbPlayers}"
HorizontalOptions="StartAndExpand" TextColor="{DynamicResource WhiteColor}"
HeightRequest="40" FontSize="16"
WidthRequest="50" VerticalTextAlignment="Center"
Clicked="Back" HorizontalTextAlignment="Center"/>
BackgroundColor="Transparent"
Margin="10,5,0,0"/>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
Grid.Row="0" Grid.Row="1"
Grid.Column="1"> Grid.Column="0">
<Picker
<Button x:Name="PlayerSelecter"
Text="{x:Static resources:AppResources.StrBtnPlay}"
Clicked="Play"
HorizontalOptions="End"
MinimumWidthRequest="30"
WidthRequest="100"
BackgroundColor="{DynamicResource SkyBlueColor}" BackgroundColor="{DynamicResource SkyBlueColor}"
CornerRadius="10" SelectedIndexChanged="ChangedPseudo"
Margin="0,5,10,0"/> HorizontalOptions="Center"
VerticalOptions="Center"
MinimumWidthRequest="30"
WidthRequest="100"/>
</StackLayout>
<StackLayout
Grid.Row="2"
Grid.Column="0">
<Label Text="{x:Static resources:AppResources.StrValueType}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
</StackLayout> </StackLayout>
<StackLayout
Grid.Row="3"
Grid.Column="0">
<Picker
x:Name="SelectMode"
BackgroundColor="{DynamicResource SkyBlueColor}"
HorizontalOptions="Center"
VerticalOptions="Center"
MinimumWidthRequest="30"
WidthRequest="110"/>
</StackLayout>
<Grid <StackLayout
Grid.Row="1" Grid.Row="0"
Grid.Column="1"> Grid.Column="1">
<Grid.RowDefinitions> <Label Text="{x:Static resources:AppResources.StrNbStacksInGame}"
<RowDefinition Height="10*" />
<RowDefinition Height="10*" />
<RowDefinition Height="10*" />
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
Margin="0,0,10,0"
Orientation="Vertical">
<Label Text="{x:Static resources:AppResources.StrNbPlayers}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker
x:Name="PlayerSelecter"
BackgroundColor="{DynamicResource SkyBlueColor}"
SelectedIndexChanged="ChangedPseudo"
HorizontalOptions="Center"
VerticalOptions="Center"
MinimumWidthRequest="30"
WidthRequest="100"
Margin="0,0,10,0"/>
</StackLayout>
<StackLayout
Grid.Row="1"
Margin="0,0,10,0">
<Label Text="{x:Static resources:AppResources.StrValueType}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker
x:Name="SelectMode"
BackgroundColor="{DynamicResource SkyBlueColor}"
HorizontalOptions="Center"
VerticalOptions="Center"
MinimumWidthRequest="30"
WidthRequest="100"
Margin="0,0,10,0"/>
</StackLayout>
<StackLayout
Grid.Row="0"
Grid.Column="2"
Margin="0,0,20,0">
<Label Text="{x:Static resources:AppResources.StrNbStacksInGame}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker x:Name="SelectNbStack"
BackgroundColor="{DynamicResource SkyBlueColor}"
Margin="0,0,10,0"
MinimumWidthRequest="30"
WidthRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
<StackLayout
Grid.Row="1"
Grid.Column="2"
Margin="0,0,20,0">
<Label Text="{x:Static resources:AppResources.StrNbCards}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker x:Name="SelectNbCard"
BackgroundColor="{DynamicResource SkyBlueColor}"
Margin="0,0,10,0"
MinimumWidthRequest="30"
WidthRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
</Grid>
<ScrollView
Grid.Column="0"
Grid.Row="1"
Margin="10,0,0,0">
<StackLayout
x:Name="NameList">
<Label
Text="{x:Static resources:AppResources.StrPseudoGM}"
TextColor="{DynamicResource WhiteColor}" TextColor="{DynamicResource WhiteColor}"
FontSize="16" FontSize="16"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/> HorizontalTextAlignment="Center"/>
</StackLayout>
<StackLayout
Grid.Row="1"
Grid.Column="1">
<Picker x:Name="SelectNbStack"
BackgroundColor="{DynamicResource SkyBlueColor}"
MinimumWidthRequest="30"
WidthRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
<StackLayout
Grid.Row="2"
Grid.Column="1">
<Label Text="{x:Static resources:AppResources.StrNbCards}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
</StackLayout>
<StackLayout
Grid.Row="3"
Grid.Column="1">
<Picker
x:Name="SelectNbCard"
BackgroundColor="{DynamicResource SkyBlueColor}"
Margin="0,0,10,0"
MinimumWidthRequest="30"
WidthRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
</Grid>
<ScrollView
Grid.Column="0"
Grid.Row="1">
<StackLayout
x:Name="NameList">
<Label
Text="{x:Static resources:AppResources.StrPseudoGM}"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Entry <Entry
BackgroundColor="{DynamicResource SkyBlueColor}" BackgroundColor="{DynamicResource SkyBlueColor}"
@ -164,11 +173,10 @@
MinimumWidthRequest="50" MinimumWidthRequest="50"
WidthRequest="200" WidthRequest="200"
MaxLength="18"/> MaxLength="18"/>
</StackLayout>
</ScrollView> </StackLayout>
</ScrollView>
</Grid> </Grid>
</ScrollView>
</ContentPage> </ContentPage>

@ -1,132 +0,0 @@
using System;
using System.Collections.Generic;
using TheGameExtreme.IO;
using TheGameExtreme.Resx;
using Xamarin.Forms;
namespace TheGameExtreme.view
{
public partial class GamePreparationPage : ContentPage
{
public List<int> listNbPlayer = new List<int> { 1, 2, 3, 4, 5 };
<<<<<<< HEAD
public List<string> listGameMode = new List<string> { "entières", "relatives", "dizaines", "centaines", "millièmes", "fractionnées" };
=======
public List<string> listGameMode = new List<string> { AppResources.TypeValueWhole, AppResources.TypeValueRelative, AppResources.TypeValueTens, AppResources.TypeValuehundredth, AppResources.TypeValuethousandth, AppResources.TypeValuefractionated };
>>>>>>> bluetoothtest
public List<int> listNbStack = new List<int> { 4, 6, 8 };
public List<int> listNbCard = new List<int> { 100, 80, 60, 40 };
public GamePreparationPage()
{
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
PlayerSelecter.ItemsSource = listNbPlayer;
LoadParameterNbPlayerGamePreparation();
SelectMode.ItemsSource = listGameMode;
LoadParameterGameModeValueGamePreparation();
SelectNbStack.ItemsSource = listNbStack;
LoadParameterNbStacksGamePreparation();
SelectNbCard.ItemsSource = listNbCard;
LoadParameterNbCardsGamePreparation();
}
private async void Back(object sender, EventArgs e)
{
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
await Navigation.PopAsync();
}
protected override bool OnBackButtonPressed()
{
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
return base.OnBackButtonPressed();
}
private async void Play(object sender, EventArgs args)
{
List<string> playersNames = new List<string>();
for (int i = 1; i < NameList.Children.Count; i++)
{
playersNames.Add(((Entry)NameList.Children[i]).Text);
if (string.IsNullOrWhiteSpace(playersNames[playersNames.Count - 1]))
{
await DisplayAlert("Erreur pseudo", AppResources.StrEnterPseudo, "OK");
return;
}
}
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.SelectedItem, (int)SelectMode.SelectedIndex, (int)SelectNbCard.SelectedItem));
}
private void ChangedPseudo(object sender, EventArgs args)
{
while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem)
{
if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem)
{
Entry e = new Entry
{
Placeholder = "Pseudo",
BackgroundColor = (Color)Application.Current.Resources["SkyBlueColor"],
WidthRequest = 200,
MinimumWidthRequest = 50,
HorizontalOptions = LayoutOptions.Center,
MaxLength = 18
};
NameList.Children.Add(e);
}
else
{
NameList.Children.RemoveAt(NameList.Children.Count - 1);
}
}
}
public void LoadParameterNbPlayerGamePreparation()
{
int nbJoueurs = IOGamePreparation.LoadParameterGamePreparationNbPlayers();
PlayerSelecter.SelectedIndex = nbJoueurs;
}
public void LoadParameterGameModeValueGamePreparation()
{
int gameModeValue = IOGamePreparation.LoadParameterGamePreparationGameModeValue();
SelectMode.SelectedIndex = gameModeValue;
}
public void LoadParameterNbStacksGamePreparation()
{
int nbStackSer = IOGamePreparation.LoadParamaterGamePreparationNbStacks();
SelectNbStack.SelectedIndex = nbStackSer;
}
public void LoadParameterNbCardsGamePreparation()
{
int nbCards = IOGamePreparation.LoadParameterGamePreparationNbCards();
SelectNbCard.SelectedIndex = nbCards;
}
}
}

@ -1,200 +0,0 @@
<?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">
<ScrollView>
<Grid
Margin="5,0,5,5">
<Grid.RowDefinitions>
<RowDefinition Height="10*" />
<RowDefinition Height="90*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<StackLayout
Grid.Row="0"
Grid.Column="0">
<ImageButton Source="ArrowSettingsBack.png"
VerticalOptions="Start"
HorizontalOptions="StartAndExpand"
HeightRequest="40"
WidthRequest="50"
Clicked="Back"
BackgroundColor="Transparent"
Margin="10,5,0,0"/>
</StackLayout>
<StackLayout
Grid.Row="0"
Grid.Column="1">
<Button
Text="Play"
Clicked="Play"
HorizontalOptions="End"
MinimumWidthRequest="30"
WidthRequest="100"
BackgroundColor="{DynamicResource SkyBlueColor}"
CornerRadius="10"
Margin="0,5,10,0"/>
</StackLayout>
<Grid
Grid.Row="1"
Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="10*" />
<RowDefinition Height="10*" />
<RowDefinition Height="10*" />
<RowDefinition Height="10*" />
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
Margin="0,0,10,0"
Orientation="Vertical">
<Label Text="Nombre de joueur : "
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker
x:Name="PlayerSelecter"
BackgroundColor="{DynamicResource SkyBlueColor}"
SelectedIndexChanged="ChangedPseudo"
HorizontalOptions="Center"
VerticalOptions="Center"
MinimumWidthRequest="30"
WidthRequest="100"
Margin="0,0,10,0"/>
</StackLayout>
<StackLayout
Grid.Row="1"
Margin="0,0,10,0">
<Label Text="Jouer avec des valeurs :"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker
x:Name="SelectMode"
BackgroundColor="{DynamicResource SkyBlueColor}"
HorizontalOptions="Center"
VerticalOptions="Center"
MinimumWidthRequest="30"
WidthRequest="100"
Margin="0,0,10,0"/>
</StackLayout>
<StackLayout
Grid.Row="0"
Grid.Column="2"
Margin="0,0,20,0">
<Label Text="Nombre de pile en jeu :"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker x:Name="SelectNbStack"
BackgroundColor="{DynamicResource SkyBlueColor}"
Margin="0,0,10,0"
MinimumWidthRequest="30"
WidthRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
<StackLayout
Grid.Row="1"
Grid.Column="2"
Margin="0,0,20,0">
<Label Text="Nombre de cartes:"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Picker x:Name="SelectNbCard"
BackgroundColor="{DynamicResource SkyBlueColor}"
Margin="0,0,10,0"
MinimumWidthRequest="30"
WidthRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
</Grid>
<<<<<<< HEAD
<StackLayout
x:Name="NameList"
=======
<!--<StackLayout
Grid.Row="0"
Grid.Column="0"
Margin="50,30,50,0">
<Label Text="Nom des joueurs"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
</StackLayout>-->
<ScrollView
>>>>>>> 0a2872694d54a6c5d0dc0475d2c05d9fc914ee7c
Grid.Column="0"
Grid.Row="1"
Margin="10,0,0,0">
<StackLayout
x:Name="NameList">
<Label
Text="Entrer vos pseudo ici:"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Entry
BackgroundColor="{DynamicResource SkyBlueColor}"
Placeholder="Pseudo"
HorizontalOptions="Center"
MinimumWidthRequest="50"
<<<<<<< HEAD
WidthRequest="200"
MaxLength="18"/>
=======
WidthRequest="200"/>
</StackLayout>
>>>>>>> 0a2872694d54a6c5d0dc0475d2c05d9fc914ee7c
</ScrollView>
</Grid>
</ScrollView>
</ContentPage>

@ -220,9 +220,9 @@ namespace TheGameExtreme.view
SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.9) / (viewmodel.getListOrderedStacks().Count * 2)) + (float)(DeviceDisplay.MainDisplayInfo.Width * 0.01), (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 * 0.9) / (viewmodel.getListOrderedStacks().Count * 2)) + (float)(DeviceDisplay.MainDisplayInfo.Width * 0.01), (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;
if (indexMode == 4) if (indexMode == 4 || indexMode == 3)
{ {
inflateWidth = 0.01f * (float)DeviceDisplay.MainDisplayInfo.Width; inflateWidth = 0.02f * (float)DeviceDisplay.MainDisplayInfo.Width;
} }
else else
{ {
@ -237,12 +237,23 @@ namespace TheGameExtreme.view
if (indexMode == 5) if (indexMode == 5)
{ {
textWidth = textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("00");
textPaint.TextSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth; textPaint.TextSize = 0.04f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
} }
else else
{ {
if (indexMode == 3)
{
textPaint.TextSize = 0.035f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
}
else if (indexMode == 4)
{
textPaint.TextSize = 0.025f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
}
else
{
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());
textPaint.TextSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
} }
position.X -= textWidth * 0.5f; position.X -= textWidth * 0.5f;
@ -267,7 +278,7 @@ namespace TheGameExtreme.view
SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.9) / (viewmodel.CurrentHand.Count * 2)) + (float)(DeviceDisplay.MainDisplayInfo.Width * 0.01), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.1 - 2 * (0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("001")))); SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.9) / (viewmodel.CurrentHand.Count * 2)) + (float)(DeviceDisplay.MainDisplayInfo.Width * 0.01), (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.1 - 2 * (0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("001"))));
float inflateWidth; float inflateWidth;
if (indexMode == 4) if (indexMode == 4 || indexMode == 3)
{ {
inflateWidth = 0.01f * (float)DeviceDisplay.MainDisplayInfo.Width; inflateWidth = 0.01f * (float)DeviceDisplay.MainDisplayInfo.Width;
} }
@ -284,12 +295,23 @@ namespace TheGameExtreme.view
if (indexMode == 5) if (indexMode == 5)
{ {
textWidth = textPaint.MeasureText("00"); textWidth = textPaint.MeasureText("00");
textPaint.TextSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth; textPaint.TextSize = 0.048f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
} }
else else
{ {
if (indexMode == 3)
{
textPaint.TextSize = 0.038f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
}
else if (indexMode == 4)
{
textPaint.TextSize = 0.028f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("00");
}
else
{
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());
textPaint.TextSize = 0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textWidth;
} }
position.X -= textWidth * 0.5f; position.X -= textWidth * 0.5f;

@ -85,11 +85,13 @@ namespace TheGameExtreme.view
textPaint.StrokeWidth = 5; textPaint.StrokeWidth = 5;
textPaint.Style = SKPaintStyle.Stroke; textPaint.Style = SKPaintStyle.Stroke;
SKRect card = new SKRect(); //SKRect card = new SKRect(0, 0, 100, 100);
SKRect card;
if (Value.View.GetType() == typeof(FractionCard)) if (Value.View.GetType() == typeof(FractionCard))
{ {
textPaint.MeasureText("00", ref card); card = new SKRect(-width, -height - textPaint.TextSize, width + textPaint.MeasureText("00"), height);
textPaint1.Color = color; textPaint1.Color = color;
textPaint1.StrokeWidth = 5; textPaint1.StrokeWidth = 5;
textPaint1.Style = SKPaintStyle.Stroke; textPaint1.Style = SKPaintStyle.Stroke;
@ -99,9 +101,8 @@ namespace TheGameExtreme.view
} }
else else
{ {
textPaint.MeasureText(display, ref card); card = new SKRect(-width, -height - textPaint.TextSize, width + textPaint.MeasureText(display), height);
} }
card.Inflate(width, height);
if (Value.View.GetType() == typeof(FractionCard)) if (Value.View.GetType() == typeof(FractionCard))
{ {
@ -114,7 +115,7 @@ namespace TheGameExtreme.view
{ {
canvas.DrawText(((FractionCard)Value.View).Fraction.Numerateur.ToString(), 0, -50, textPaint); canvas.DrawText(((FractionCard)Value.View).Fraction.Numerateur.ToString(), 0, -50, textPaint);
} }
canvas.DrawText("__", 0, -textPaint.TextSize * 0.4f, textPaint1); canvas.DrawText("__", textPaint.MeasureText("__") * 0.1f, -textPaint.TextSize * 0.4f, textPaint1);
if (((FractionCard)Value.View).Fraction.Denominateur < 10 && ((FractionCard)Value.View).Fraction.Denominateur > 0) if (((FractionCard)Value.View).Fraction.Denominateur < 10 && ((FractionCard)Value.View).Fraction.Denominateur > 0)
{ {
canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), textPaint.MeasureText(((FractionCard)Value.View).Fraction.Denominateur.ToString()) * 0.5f, 50, textPaint2); canvas.DrawText(((FractionCard)Value.View).Fraction.Denominateur.ToString(), textPaint.MeasureText(((FractionCard)Value.View).Fraction.Denominateur.ToString()) * 0.5f, 50, textPaint2);

Loading…
Cancel
Save