master
cldupland 5 years ago
parent d486238da1
commit 0e246bdc5b

@ -10,7 +10,7 @@ using Xamarin.Forms;
namespace TheGameExtreme.Droid namespace TheGameExtreme.Droid
{ {
[Activity(Label = "OrderStacks", 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)] // ConfigChanges.Navigation
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{ {
@ -19,17 +19,11 @@ namespace TheGameExtreme.Droid
TabLayoutResource = Resource.Layout.Tabbar; TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar; ToolbarResource = Resource.Layout.Toolbar;
/*int uiOptions = (int)Window.DecorView.SystemUiVisibility;
uiOptions |= (int)SystemUiFlags.LowProfile;
uiOptions |= (int)SystemUiFlags.Fullscreen;
uiOptions |= (int)SystemUiFlags.HideNavigation;
uiOptions |= (int)SystemUiFlags.ImmersiveSticky;
Window.DecorView.SystemUiVisibility = (StatusBarVisibility)uiOptions;*/
base.OnCreate(savedInstanceState); base.OnCreate(savedInstanceState);
Rg.Plugins.Popup.Popup.Init(this, savedInstanceState); Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.HideNavigation;
LoadApplication(new App()); LoadApplication(new App());
Window.SetStatusBarColor(Android.Graphics.Color.Argb(255, 0, 0, 0)); Window.SetStatusBarColor(Android.Graphics.Color.Argb(255, 0, 0, 0));
this.Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn); this.Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn);

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

@ -11,6 +11,7 @@ namespace TheGameExtreme
{ {
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
MainPage = new NavigationPage(new HomePage()); MainPage = new NavigationPage(new HomePage());
} }

@ -17,7 +17,9 @@ namespace TheGameExtreme.view
public GamePreparationPage() public GamePreparationPage()
{ {
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
LoadParameterName(); LoadParameterName();
PlayerSelecter.ItemsSource = listNbPlayer; PlayerSelecter.ItemsSource = listNbPlayer;
@ -42,7 +44,10 @@ namespace TheGameExtreme.view
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
if ((int)PlayerSelecter.SelectedItem == 1)
{
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
}
await Navigation.PopAsync(); await Navigation.PopAsync();
} }
@ -52,7 +57,10 @@ namespace TheGameExtreme.view
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
if ((int)PlayerSelecter.SelectedItem == 1)
{
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
}
return base.OnBackButtonPressed(); return base.OnBackButtonPressed();
} }
@ -80,6 +88,14 @@ namespace TheGameExtreme.view
private void ChangedPseudo(object sender, EventArgs args) private void ChangedPseudo(object sender, EventArgs args)
{ {
if ((int)PlayerSelecter.SelectedItem == 1)
{
LoadParameterName();
}
else
{
FirstEntry.Text = "";
}
while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem) while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem)
{ {
if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem) if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem)

@ -8,8 +8,6 @@
x:Class="TheGameExtreme.view.HomePage" x:Class="TheGameExtreme.view.HomePage"
x:Name="homepageT"> x:Name="homepageT">
<StackLayout BackgroundColor="Transparent">
<Grid x:Name="MainGrid"> <Grid x:Name="MainGrid">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -25,14 +23,15 @@
<RowDefinition Height="27*"/> <RowDefinition Height="27*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ImageButton Source="PointI.png" <ImageButton
Source="PointI.png"
Grid.Column="0" Grid.Column="0"
Grid.Row="0" Grid.Row="0"
Clicked="ImageButton_Clicked" Clicked="ImageButton_Clicked"
BackgroundColor="Transparent" BackgroundColor="Transparent"
WidthRequest="40" WidthRequest="40"
HeightRequest="40" HeightRequest="40"
VerticalOptions="End" VerticalOptions="Center"
HorizontalOptions="Center"/> HorizontalOptions="Center"/>
<Label <Label
@ -42,7 +41,7 @@
Grid.Column="1" Grid.Column="1"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
FontSize="45" FontSize="45"
VerticalTextAlignment="Start" VerticalTextAlignment="Center"
FontFamily=""/> FontFamily=""/>
@ -86,7 +85,8 @@
CornerRadius="10" CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/> BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Image Source="TrierImageB.png" <Image
Source="TrierImageB.png"
Grid.Column="1" Grid.Column="1"
Grid.Row="1"/> Grid.Row="1"/>
@ -105,7 +105,7 @@
x:Name="imageButton" x:Name="imageButton"
Grid.Column="1" Grid.Column="1"
Grid.Row="1" Grid.Row="1"
VerticalOptions="End" VerticalOptions="Center"
HorizontalOptions="Center" HorizontalOptions="Center"
Clicked="Theme_Clicked" Clicked="Theme_Clicked"
BorderColor="{DynamicResource SkyBlueColor}" BorderColor="{DynamicResource SkyBlueColor}"
@ -114,6 +114,4 @@
</Grid> </Grid>
</StackLayout>
</ContentPage> </ContentPage>

@ -1,98 +0,0 @@
using System;
using Xamarin.Forms;
using TheGameExtreme.IO;
<<<<<<< HEAD
=======
using TheGameExtreme.Resx;
>>>>>>> bluetoothtest
namespace TheGameExtreme.view
{
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
LoadParameterOptionOnHomepage();
}
private async void OpenGame(object sender, EventArgs args)
{
await Navigation.PushAsync(new GamePreparationPage());
}
private async void OpenMultiPlayerMode(object sender, EventArgs args)
{
await DisplayAlert("Mode en cours de développement", null, "Fermer");
//await Navigation.PushAsync(new MultiPlayerMode());
}
private async void Rules_Clicked(object sender, EventArgs args)
{
await Navigation.PushAsync(new RulesGame());
}
public void LoadParameterOptionOnHomepage()
{
bool b = IOOptions.LoadOptionsParameter();
if (!b)
{
Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White;
imageButton.Source = "SoleilThemes.png";
}
else
{
Application.Current.Resources["BlackColor"] = Color.White;
Application.Current.Resources["WhiteColor"] = Color.Black;
imageButton.Source = "LuneSombreTheme.png";
}
}
private void Theme_Clicked(object sender, EventArgs e)
{
bool b;
ButtonGrid.Children.Remove(imageButton);
if(homepageT.BackgroundColor == Color.Black)
{
b = true;
Application.Current.Resources["BlackColor"] = Color.White;
Application.Current.Resources["WhiteColor"] = Color.Black;
imageButton = new ImageButton()
{
BackgroundColor = Color.Transparent,
BorderColor = (Color)Application.Current.Resources["SkyBlueColor"]
};
imageButton.Source = "LuneSombreTheme.png";
}
else
{
b = false;
Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White;
imageButton = new ImageButton()
{
BackgroundColor = Color.Transparent,
BorderColor = (Color)Application.Current.Resources["SkyBlueColor"]
};
imageButton.Source = "SoleilThemes.png";
}
ButtonGrid.Children.Add(imageButton, 1, 1);
imageButton.Clicked += Theme_Clicked;
imageButton.HorizontalOptions = LayoutOptions.Center;
imageButton.VerticalOptions = LayoutOptions.End;
IOOptions.SaveOptionParameter(b);
}
private async void ImageButton_Clicked(object sender, EventArgs e)
{
await DisplayAlert(AppResources.StrInfo,AppResources.StrAbout, AppResources.StrCloseWind );
}
}
}

@ -1,175 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
Title="THEGAME"
BackgroundColor="{DynamicResource BlackColor}"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:TheGameExtreme.Resx"
x:Class="TheGameExtreme.view.HomePage"
x:Name="homepageT">
<<<<<<< HEAD
<StackLayout BackgroundColor="Transparent">
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="15*"/>
<ColumnDefinition Width="70*"/>
<ColumnDefinition Width="15*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="19*"/>
<RowDefinition Height="27*"/>
<RowDefinition Height="27*"/>
<RowDefinition Height="27*"/>
<RowDefinition Height="27*"/>
</Grid.RowDefinitions>
=======
<Grid
Margin="5,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="15*"/>
<ColumnDefinition Width="70*"/>
<ColumnDefinition Width="15*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="31*"/>
<RowDefinition Height="23*"/>
<RowDefinition Height="23*"/>
<RowDefinition Height="23*"/>
</Grid.RowDefinitions>
>>>>>>> 3badad823975148fed6467984295274bc7006685
<Label
Text="{x:Static resources:AppResources.StrTitle}"
TextColor="{DynamicResource WhiteColor}"
Grid.Row="0"
Grid.Column="1"
HorizontalTextAlignment="Center"
FontSize="45"
VerticalTextAlignment="Start"
FontFamily=""/>
<<<<<<< HEAD
<Button
Text="{x:Static resources:AppResources.StrLocalGame}"
FontSize="18"
Grid.Row="2"
Grid.Column="1"
HorizontalOptions="Center"
WidthRequest="230"
HeightRequest="57"
VerticalOptions="Center"
Clicked="OpenGame"
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button
Text="{x:Static resources:AppResources.StrMultiplayer}"
FontSize="18"
Grid.Row="3"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="57"
WidthRequest="230"
Clicked="OpenMultiPlayerMode"
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button Text="{x:Static resources:AppResources.StrTitleRules}"
FontSize="18"
Grid.Row="4"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="57"
WidthRequest="230"
Clicked="Rules_Clicked"
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Image Source="TrierImageB.png"
Grid.Column="1"
Grid.Row="1"/>
<Grid Grid.Row="0" Grid.Column="2" x:Name="ButtonGrid">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="6*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="6*" />
</Grid.ColumnDefinitions>
<ImageButton
x:Name="imageButton"
Grid.Column="1"
Grid.Row="1"
VerticalOptions="End"
HorizontalOptions="Center"
Clicked="Theme_Clicked"
BorderColor="{DynamicResource SkyBlueColor}"
BackgroundColor="Transparent"/>
</Grid>
=======
<ImageButton
Source="EngrenageV1.png"
Grid.Row="0"
Grid.Column="2"
VerticalOptions="StartAndExpand"
HorizontalOptions="End"
HeightRequest="60"
WidthRequest="68"
Clicked="OpenSetting"
BackgroundColor="{DynamicResource BlackColor}"/>
<Button
Text="{x:Static resources:AppResources.StrLocalGame}"
FontSize="18"
Grid.Row="1"
Grid.Column="1"
HorizontalOptions="Center"
WidthRequest="230"
HeightRequest="57"
VerticalOptions="Center"
Clicked="OpenGame"
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button
Text="{x:Static resources:AppResources.StrMultiplayer}"
FontSize="18"
Grid.Row="2"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="57"
WidthRequest="230"
Clicked="OpenMultiPlayerMode"
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
>>>>>>> 3badad823975148fed6467984295274bc7006685
<ImageButton
Source="imagesRules.png"
Grid.Column="0"
Grid.Row="0"
HeightRequest="50"
WidthRequest="35"
VerticalOptions="StartAndExpand"
HorizontalOptions="Start"
Clicked="Rules_Clicked"
BackgroundColor="{DynamicResource BlackColor}"/>
</Grid>
</ContentPage>

@ -20,7 +20,7 @@ namespace TheGameExtreme.view
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {
private Main viewmodel; private Main viewmodel;
private List<string> playersNames; private List<string> playersNames = new List<string>();
private int nbPile; private int nbPile;
private int nbCard; private int nbCard;
private int indexMode; private int indexMode;
@ -37,17 +37,27 @@ namespace TheGameExtreme.view
*/ */
public MainPage(List<string> playersNames, int nbPile, int indexMode, int nbCard) public MainPage(List<string> playersNames, int nbPile, int indexMode, int nbCard)
{ {
this.playersNames = playersNames;
this.nbPile = nbPile; this.nbPile = nbPile;
this.nbCard = nbCard; this.nbCard = nbCard;
this.indexMode = indexMode; this.indexMode = indexMode;
Random random = new Random();
int r = random.Next(0, playersNames.Count);
int size = playersNames.Count;
for (int i = 0; i < size; i++)
{
this.playersNames.Add(playersNames[r]);
playersNames.RemoveAt(r);
r = random.Next(0, playersNames.Count);
}
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
EndTurnButton.Text = AppResources.StrEndTurn; // Trouver le moyen d'avoir du binding EndTurnButton.Text = AppResources.StrEndTurn; // Trouver le moyen d'avoir du binding
viewmodel = new Main(playersNames, nbPile, nbCard, indexMode); viewmodel = new Main(this.playersNames, nbPile, nbCard, indexMode);
viewmodel.EndGame += OnEndGame; viewmodel.EndGame += OnEndGame;
@ -89,17 +99,17 @@ namespace TheGameExtreme.view
{ {
if (i < (stackCollection.Count * 0.5)) if (i < (stackCollection.Count * 0.5))
{ {
stackCollection[i].Paint(canvas, new SKColor(33, 255, 40)); stackCollection[i].Paint(canvas);
} }
else else
{ {
stackCollection[i].Paint(canvas, SKColors.Red); stackCollection[i].Paint(canvas);
} }
} }
foreach (TouchManipulationCard textPaint in textCollection) foreach (TouchManipulationCard textPaint in textCollection)
{ {
textPaint.Paint(canvas, SKColors.SkyBlue); textPaint.Paint(canvas);
} }
} }
@ -142,9 +152,24 @@ namespace TheGameExtreme.view
case TouchActionType.Moved: case TouchActionType.Moved:
if (textDictionary.ContainsKey(args.Id)) if (textDictionary.ContainsKey(args.Id))
{ {
bool isStackable = false;
TouchManipulationCard card = textDictionary[args.Id]; TouchManipulationCard card = textDictionary[args.Id];
point.Y -= 120; point.Y -= 120;
point.X -= 50; point.X -= 50;
foreach (TouchManipulationCard stack in stackCollection)
{
SKPoint pointVisuCard = new SKPoint(point.X, point.Y - 120);
if (stack.HitTest(point) || stack.HitTest(pointVisuCard))
{
card.Color = stack.Color;
isStackable = true;
}
}
if (!isStackable)
{
card.Color = SKColors.SkyBlue;
}
card.ProcessTouchEvent(args.Id, args.Type, point); card.ProcessTouchEvent(args.Id, args.Type, point);
canvasView.InvalidateSurface(); canvasView.InvalidateSurface();
} }
@ -168,6 +193,7 @@ namespace TheGameExtreme.view
{ {
card.ProcessTouchEvent(args.Id, TouchActionType.Moved, stack.InitialPoint); card.ProcessTouchEvent(args.Id, TouchActionType.Moved, stack.InitialPoint);
card.InitialPoint = stackCollection[stackCollection.IndexOf(stack)].InitialPoint; card.InitialPoint = stackCollection[stackCollection.IndexOf(stack)].InitialPoint;
card.Color = stack.Color;
stackCollection[stackCollection.IndexOf(stack)] = card; stackCollection[stackCollection.IndexOf(stack)] = card;
textCollection.RemoveAt(textCollection.Count - 1); textCollection.RemoveAt(textCollection.Count - 1);
find = true; find = true;
@ -178,6 +204,7 @@ namespace TheGameExtreme.view
if (!find) if (!find)
{ {
card.ProcessTouchEvent(args.Id, TouchActionType.Moved, card.InitialPoint); card.ProcessTouchEvent(args.Id, TouchActionType.Moved, card.InitialPoint);
card.Color = SKColors.SkyBlue;
} }
card.ProcessTouchEvent(args.Id, args.Type, point); card.ProcessTouchEvent(args.Id, args.Type, point);
textDictionary.Remove(args.Id); textDictionary.Remove(args.Id);
@ -199,7 +226,7 @@ namespace TheGameExtreme.view
float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width - 20 - inflateWidth) / (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 * 0.92f - 20 - inflateWidth) / (viewmodel.getListOrderedStacks().Count * 2)) + 10f + (float)DeviceDisplay.MainDisplayInfo.Width * 0.04f, (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"))));
position.X -= inflateWidth; position.X -= inflateWidth;
@ -220,14 +247,25 @@ namespace TheGameExtreme.view
textPaint.TextSize = 0.03f * (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;
SKColor color;
if (i < (viewmodel.getListOrderedStacks().Count * 0.5))
{
color = new SKColor(33, 255, 40);
}
else
{
color = SKColors.Red;
}
stackCollection.Add(new TouchManipulationCard(textPaint, viewmodel.getListOrderedStacks()[i].Peek(), inflateWidth) stackCollection.Add(new TouchManipulationCard(textPaint, viewmodel.getListOrderedStacks()[i].Peek(), inflateWidth)
{ {
Matrix = SKMatrix.MakeTranslation(position.X, position.Y), Matrix = SKMatrix.MakeTranslation(position.X, position.Y),
InitialMatrix = SKMatrix.MakeTranslation(position.X, position.Y), InitialMatrix = SKMatrix.MakeTranslation(position.X, position.Y),
InitialPoint = position InitialPoint = position,
Color = color
}); });
position.X += (float)((DeviceDisplay.MainDisplayInfo.Width - 20 - inflateWidth) / viewmodel.getListOrderedStacks().Count) + textWidth * 0.5f; position.X += (float)((DeviceDisplay.MainDisplayInfo.Width * 0.92f - 20 - inflateWidth) / viewmodel.getListOrderedStacks().Count) + textWidth * 0.5f;
} }
} }
@ -241,7 +279,7 @@ namespace TheGameExtreme.view
float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20); float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width - 20 - inflateWidth) / (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 * 0.92f - 20 - inflateWidth) / (viewmodel.CurrentHand.Count * 2)) + 10f + (float)DeviceDisplay.MainDisplayInfo.Width * 0.04f, (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"))));
position.X -= inflateWidth; position.X -= inflateWidth;
@ -266,10 +304,11 @@ namespace TheGameExtreme.view
{ {
Matrix = SKMatrix.MakeTranslation(position.X, position.Y), Matrix = SKMatrix.MakeTranslation(position.X, position.Y),
InitialMatrix = SKMatrix.MakeTranslation(position.X, position.Y), InitialMatrix = SKMatrix.MakeTranslation(position.X, position.Y),
InitialPoint = position InitialPoint = position,
Color = SKColors.SkyBlue
}); });
position.X += (float)((DeviceDisplay.MainDisplayInfo.Width - 20 - inflateWidth) / viewmodel.CurrentHand.Count) + textWidth * 0.5f; position.X += (float)((DeviceDisplay.MainDisplayInfo.Width * 0.92f - 20 - inflateWidth) / viewmodel.CurrentHand.Count) + textWidth * 0.5f;
} }
} }

@ -22,6 +22,7 @@ namespace TheGameExtreme.view
public string display; public string display;
private float width; private float width;
private float height; private float height;
public SKColor Color;
/** /**
@ -75,14 +76,14 @@ namespace TheGameExtreme.view
* <param name="canvas">Canvas où l'on souhaite dessiner l'objet contenu dans l'instance</param> * <param name="canvas">Canvas où l'on souhaite dessiner l'objet contenu dans l'instance</param>
* <param name="color">Couleur qui sera prise par l'objet</param> * <param name="color">Couleur qui sera prise par l'objet</param>
*/ */
public void Paint(SKCanvas canvas, SKColor color) public void Paint(SKCanvas canvas)
{ {
canvas.Save(); canvas.Save();
SKMatrix matrix = Matrix; SKMatrix matrix = Matrix;
canvas.Concat(ref matrix); canvas.Concat(ref matrix);
textPaint.Color = color; textPaint.Color = Color;
textPaint.StrokeWidth = 5; textPaint.StrokeWidth = 5;
textPaint.Style = SKPaintStyle.Stroke; textPaint.Style = SKPaintStyle.Stroke;
@ -91,10 +92,10 @@ namespace TheGameExtreme.view
if (Value.View.GetType() == typeof(FractionCard)) if (Value.View.GetType() == typeof(FractionCard))
{ {
card = new SKRect(-width, -height - textPaint.TextSize, width + textPaint.MeasureText(Math.Pow(10, ((FractionCard)(Value.View)).Fraction.SizeMax-1).ToString()), height); card = new SKRect(-width, -height - textPaint.TextSize, width + textPaint.MeasureText(Math.Pow(10, ((FractionCard)(Value.View)).Fraction.SizeMax-1).ToString()), height);
textPaint1.Color = color; textPaint1.Color = Color;
textPaint1.StrokeWidth = 5; textPaint1.StrokeWidth = 5;
textPaint1.Style = SKPaintStyle.Stroke; textPaint1.Style = SKPaintStyle.Stroke;
textPaint2.Color = color; textPaint2.Color = Color;
textPaint2.StrokeWidth = 5; textPaint2.StrokeWidth = 5;
textPaint2.Style = SKPaintStyle.Stroke; textPaint2.Style = SKPaintStyle.Stroke;
} }

Loading…
Cancel
Save