mise en place desslider

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

@ -1,11 +1,11 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// </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">
<value>tenth</value>
</data>
<data name="TypeValuethousandth" xml:space="preserve">
<data name="TypeValueThousandthFract" xml:space="preserve">
<value>thousandth</value>
</data>
<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">
<value>tenth</value>
</data>
<data name="TypeValuethousandth" xml:space="preserve">
<data name="TypeValueThousandthFract" xml:space="preserve">
<value>thousandth</value>
</data>
<data name="TypeValueWhole" xml:space="preserve">

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

@ -8,9 +8,9 @@ namespace TheGameExtreme.view
{
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<int> listNbStack = new List<int> { 4, 6, 8 };
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> listNbCard = new List<int> { 100, 80, 60, 40 };
@ -21,17 +21,24 @@ namespace TheGameExtreme.view
NavigationPage.SetHasNavigationBar(this, false);
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();
SelectMode.ItemsSource = listGameMode;
LoadParameterGameModeValueGamePreparation();
SelectNbStack.ItemsSource = listNbStack;
//SelectNbStack.ItemsSource = listNbStack;
LoadParameterNbStacksGamePreparation();
SelectNbCard.ItemsSource = listNbCard;
//SelectNbCard.ItemsSource = listNbCard;
LoadParameterNbCardsGamePreparation();
}
@ -39,11 +46,11 @@ namespace TheGameExtreme.view
private async void Back(object sender, EventArgs e)
{
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParamaterGamePreparationNbPlayers((int)PlayerSelecter.Value);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
if ((int)PlayerSelecter.SelectedItem == 1)
IOGamePreparation.SaveParameterGamePreparationNbStacks((int)SelectNbStack.Value);
IOGamePreparation.SaveParameterGamePreparationNbCards((int)SelectNbCard.Value);
if ((int)PlayerSelecter.Value == 1)
{
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
}
@ -52,11 +59,11 @@ namespace TheGameExtreme.view
protected override bool OnBackButtonPressed()
{
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParamaterGamePreparationNbPlayers((int)PlayerSelecter.Value);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
if ((int)PlayerSelecter.SelectedItem == 1)
IOGamePreparation.SaveParameterGamePreparationNbStacks((int)SelectNbStack.Value);
IOGamePreparation.SaveParameterGamePreparationNbCards((int)SelectNbCard.Value);
if ((int)PlayerSelecter.Value == 1)
{
IOGamePreparation.SaveParameterGamePreparationName(FirstEntry.Text);
}
@ -77,53 +84,113 @@ namespace TheGameExtreme.view
return;
}
}
IOGamePreparation.SaveParamaterGamePreparationNbPlayers(PlayerSelecter.SelectedIndex);
IOGamePreparation.SaveParamaterGamePreparationNbPlayers((int)PlayerSelecter.Value);
IOGamePreparation.SaveParameterGamePreparationGameModeValue(SelectMode.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks(SelectNbStack.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbCards(SelectNbCard.SelectedIndex);
IOGamePreparation.SaveParameterGamePreparationNbStacks((int)SelectNbStack.Value);
IOGamePreparation.SaveParameterGamePreparationNbCards((int)SelectNbCard.Value);
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)
{
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
{
Placeholder = "Pseudo",
BackgroundColor = (Color)Application.Current.Resources["Gold"],
WidthRequest = 150,
MinimumWidthRequest = 50,
HorizontalOptions = LayoutOptions.Center,
MaxLength = 18,
IsTextPredictionEnabled = false
};
NameList.Children.Add(e);
if (SelectNbCard.Value < 50)
{
SelectNbCard.Value = 40;
}
else if (SelectNbCard.Value < 70)
{
SelectNbCard.Value = 60;
}
else if (SelectNbCard.Value < 90)
{
SelectNbCard.Value = 80;
}
else
{
NameList.Children.RemoveAt(NameList.Children.Count - 1);
SelectNbCard.Value = 100;
}
canModif = true;
}
}
public void LoadParameterNbPlayerGamePreparation()
{
int nbJoueurs = IOGamePreparation.LoadParameterGamePreparationNbPlayers();
PlayerSelecter.SelectedIndex = nbJoueurs;
PlayerSelecter.Value = nbJoueurs;
}
public void LoadParameterGameModeValueGamePreparation()
@ -135,12 +202,12 @@ namespace TheGameExtreme.view
public void LoadParameterNbStacksGamePreparation()
{
int nbStackSer = IOGamePreparation.LoadParamaterGamePreparationNbStacks();
SelectNbStack.SelectedIndex = nbStackSer;
SelectNbStack.Value = nbStackSer;
}
public void LoadParameterNbCardsGamePreparation()
{
int nbCards = IOGamePreparation.LoadParameterGamePreparationNbCards();
SelectNbCard.SelectedIndex = nbCards;
SelectNbCard.Value = nbCards;
}
public void LoadParameterName()
{

Loading…
Cancel
Save