mise en place desslider

master
Baptiste ARNAUD 5 years ago
parent 952c6827ab
commit 8416ffa323

@ -1,11 +1,11 @@
#pragma warning disable 1591 #pragma warning disable 1591
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // Ce code a été généré par un outil.
// Runtime Version:4.0.30319.42000 // Version du runtime :4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// the code is regenerated. // le code est régénéré.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

@ -262,7 +262,7 @@ There is therefore no maximum card limit to play per round. However, it is advis
<data name="TypeValueTens" xml:space="preserve"> <data name="TypeValueTens" xml:space="preserve">
<value>tenth</value> <value>tenth</value>
</data> </data>
<data name="TypeValuethousandth" xml:space="preserve"> <data name="TypeValueThousandthFract" xml:space="preserve">
<value>thousandth</value> <value>thousandth</value>
</data> </data>
<data name="TypeValueWhole" xml:space="preserve"> <data name="TypeValueWhole" xml:space="preserve">

@ -262,7 +262,7 @@ There is therefore no maximum card limit to play per round. However, it is advis
<data name="TypeValueTens" xml:space="preserve"> <data name="TypeValueTens" xml:space="preserve">
<value>tenth</value> <value>tenth</value>
</data> </data>
<data name="TypeValuethousandth" xml:space="preserve"> <data name="TypeValueThousandthFract" xml:space="preserve">
<value>thousandth</value> <value>thousandth</value>
</data> </data>
<data name="TypeValueWhole" xml:space="preserve"> <data name="TypeValueWhole" xml:space="preserve">

@ -71,13 +71,25 @@
FontSize="16" FontSize="16"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/> HorizontalTextAlignment="Center"/>
<Picker
<Label
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
x:Name="nbPlayersChoose"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Slider
x:Name="PlayerSelecter" x:Name="PlayerSelecter"
BackgroundColor="{DynamicResource SkyBlueColor}" Maximum="5"
SelectedIndexChanged="ChangedPseudo" Minimum="1"
ThumbColor="{DynamicResource SkyBlueColor}"
ValueChanged="ChangedPseudo"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="Center" VerticalOptions="Center"
WidthRequest="40"/> WidthRequest="150"
Value="1"/>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
@ -107,12 +119,24 @@
FontSize="16" FontSize="16"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/> HorizontalTextAlignment="Center"/>
<Picker
<Label
x:Name="nbstacks"
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Slider
x:Name="SelectNbStack" x:Name="SelectNbStack"
BackgroundColor="{DynamicResource SkyBlueColor}" Maximum="8"
WidthRequest="40" Minimum="4"
ThumbColor="{DynamicResource SkyBlueColor}"
ValueChanged="ChangedStacks"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="Center"/> VerticalOptions="Center"
WidthRequest="150"
Value="4"/>
</StackLayout> </StackLayout>
<StackLayout <StackLayout
@ -124,12 +148,23 @@
FontSize="16" FontSize="16"
VerticalTextAlignment="Center" VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/> HorizontalTextAlignment="Center"/>
<Picker
<Label
TextColor="{DynamicResource WhiteColor}"
FontSize="16"
x:Name="nbCard"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<Slider
x:Name="SelectNbCard" x:Name="SelectNbCard"
BackgroundColor="{DynamicResource SkyBlueColor}" Maximum="100"
WidthRequest="50" Minimum="40"
ThumbColor="{DynamicResource SkyBlueColor}"
ValueChanged="ChangedNbCards"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="Center"/> VerticalOptions="Center"
WidthRequest="150"
Value="100"/>
</StackLayout> </StackLayout>
</Grid> </Grid>

@ -8,9 +8,9 @@ namespace TheGameExtreme.view
{ {
public partial class GamePreparationPage : ContentPage public partial class GamePreparationPage : ContentPage
{ {
public List<int> listNbPlayer = new List<int> { 1, 2, 3, 4, 5 };
public List<string> listGameMode = new List<string> { AppResources.TypeValueWhole, AppResources.TypeValueRelative, AppResources.TypeValueTenthFract, AppResources.TypeValueHundredthFract, AppResources.TypeValueThousandthFract, AppResources.TypeValuefractionated, AppResources.TypeValueTenth, AppResources.TypeValueHundredth }; public List<string> listGameMode = new List<string> { AppResources.TypeValueWhole, AppResources.TypeValueRelative, AppResources.TypeValueTenth, AppResources.TypeValueHundredth, AppResources.TypeValueThousandthFract, AppResources.TypeValuefractionated };
public List<int> listNbStack = new List<int> { 4, 6, 8 }; //public List<int> listNbStack = new List<int> { 4, 6, 8 };
public List<int> listNbCard = new List<int> { 100, 80, 60, 40 }; public List<int> listNbCard = new List<int> { 100, 80, 60, 40 };
@ -21,17 +21,24 @@ namespace TheGameExtreme.view
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
LoadParameterName(); LoadParameterName();
nbPlayersChoose.SetBinding(Label.TextProperty, new Binding("Value", source: PlayerSelecter));
nbstacks.SetBinding(Label.TextProperty, new Binding("Value", source: SelectNbStack));
nbCard.SetBinding(Label.TextProperty, new Binding("Value", source: SelectNbCard));
PlayerSelecter.ItemsSource = listNbPlayer;
LoadParameterNbPlayerGamePreparation(); LoadParameterNbPlayerGamePreparation();
SelectMode.ItemsSource = listGameMode; SelectMode.ItemsSource = listGameMode;
LoadParameterGameModeValueGamePreparation(); LoadParameterGameModeValueGamePreparation();
SelectNbStack.ItemsSource = listNbStack; //SelectNbStack.ItemsSource = listNbStack;
LoadParameterNbStacksGamePreparation(); LoadParameterNbStacksGamePreparation();
SelectNbCard.ItemsSource = listNbCard; //SelectNbCard.ItemsSource = listNbCard;
LoadParameterNbCardsGamePreparation(); LoadParameterNbCardsGamePreparation();
} }
@ -39,11 +46,11 @@ namespace TheGameExtreme.view
private async void Back(object sender, EventArgs e) private async void Back(object sender, EventArgs e)
{ {
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex); IOGamePreparation.SaveParamaterGamePreparationNbPlayers((int)PlayerSelecter.Value);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbStacks((int)SelectNbStack.Value);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbCards((int)SelectNbCard.Value);
if ((int)PlayerSelecter.SelectedItem == 1) if ((int)PlayerSelecter.Value == 1)
{ {
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
} }
@ -52,11 +59,11 @@ namespace TheGameExtreme.view
protected override bool OnBackButtonPressed() protected override bool OnBackButtonPressed()
{ {
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex); IOGamePreparation.SaveParamaterGamePreparationNbPlayers((int)PlayerSelecter.Value);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbStacks((int)SelectNbStack.Value);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbCards((int)SelectNbCard.Value);
if ((int)PlayerSelecter.SelectedItem == 1) if ((int)PlayerSelecter.Value == 1)
{ {
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
} }
@ -77,53 +84,113 @@ namespace TheGameExtreme.view
return; return;
} }
} }
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex); IOGamePreparation.SaveParamaterGamePreparationNbPlayers((int)PlayerSelecter.Value);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbStacks((int)SelectNbStack.Value);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex); IOGamePreparation.SaveParameterGamePreparationNbCards((int)SelectNbCard.Value);
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text); IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.SelectedItem, (int)SelectMode.SelectedIndex, (int)SelectNbCard.SelectedItem)); await Navigation.PushAsync(new MainPage(playersNames, (int)SelectNbStack.Value, (int)SelectMode.SelectedIndex, (int)SelectNbCard.Value));
} }
private bool canModif = true;
private void ChangedPseudo(object sender, EventArgs args) private void ChangedPseudo(object sender, EventArgs args)
{ {
if ((int)PlayerSelecter.SelectedItem == 1) if (canModif)
{ {
LoadParameterName(); canModif = false;
PlayerSelecter.Value = Math.Round(PlayerSelecter.Value);
if ((int)PlayerSelecter.Value == 1)
{
LoadParameterName();
}
else
{
FirstEntry.Text = "";
}
while (NameList.Children.Count - 1 != (int)PlayerSelecter.Value)
{
if (NameList.Children.Count - 1 < (int)PlayerSelecter.Value)
{
Entry e = new Entry
{
Placeholder = "Pseudo",
BackgroundColor = (Color)Application.Current.Resources["Gold"],
WidthRequest = 200,
MinimumWidthRequest = 50,
HorizontalOptions = LayoutOptions.Center,
MaxLength = 18,
IsTextPredictionEnabled = false
};
NameList.Children.Add(e);
}
else
{
NameList.Children.RemoveAt(NameList.Children.Count - 1);
}
}
canModif = true;
} }
else }
private void ChangedStacks(object sender, EventArgs args)
{
if (canModif)
{ {
FirstEntry.Text = ""; canModif = false;
if (SelectNbStack.Value < 5)
{
SelectNbStack.Value = 4;
}
else if (SelectNbStack.Value < 7)
{
SelectNbStack.Value = 6;
}
else
{
SelectNbStack.Value = 8;
}
canModif = true;
} }
while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem) }
private void ChangedNbCards(object sender, EventArgs args)
{
if (canModif)
{ {
if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem) canModif = false;
{
Entry e = new Entry if (SelectNbCard.Value < 50)
{ {
Placeholder = "Pseudo", SelectNbCard.Value = 40;
BackgroundColor = (Color)Application.Current.Resources["Gold"], }
WidthRequest = 150, else if (SelectNbCard.Value < 70)
MinimumWidthRequest = 50, {
HorizontalOptions = LayoutOptions.Center, SelectNbCard.Value = 60;
MaxLength = 18, }
IsTextPredictionEnabled = false else if (SelectNbCard.Value < 90)
}; {
SelectNbCard.Value = 80;
NameList.Children.Add(e);
} }
else else
{ {
NameList.Children.RemoveAt(NameList.Children.Count - 1); SelectNbCard.Value = 100;
} }
canModif = true;
} }
} }
public void LoadParameterNbPlayerGamePreparation() public void LoadParameterNbPlayerGamePreparation()
{ {
int nbJoueurs = IOGamePreparation.LoadParameterGamePreparationNbPlayers(); int nbJoueurs = IOGamePreparation.LoadParameterGamePreparationNbPlayers();
PlayerSelecter.SelectedIndex = nbJoueurs; PlayerSelecter.Value = nbJoueurs;
} }
public void LoadParameterGameModeValueGamePreparation() public void LoadParameterGameModeValueGamePreparation()
@ -135,12 +202,12 @@ namespace TheGameExtreme.view
public void LoadParameterNbStacksGamePreparation() public void LoadParameterNbStacksGamePreparation()
{ {
int nbStackSer = IOGamePreparation.LoadParamaterGamePreparationNbStacks(); int nbStackSer = IOGamePreparation.LoadParamaterGamePreparationNbStacks();
SelectNbStack.SelectedIndex = nbStackSer; SelectNbStack.Value = nbStackSer;
} }
public void LoadParameterNbCardsGamePreparation() public void LoadParameterNbCardsGamePreparation()
{ {
int nbCards = IOGamePreparation.LoadParameterGamePreparationNbCards(); int nbCards = IOGamePreparation.LoadParameterGamePreparationNbCards();
SelectNbCard.SelectedIndex = nbCards; SelectNbCard.Value = nbCards;
} }
public void LoadParameterName() public void LoadParameterName()
{ {

Loading…
Cancel
Save