|
|
|
@ -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 };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -22,16 +22,23 @@ namespace TheGameExtreme.view
|
|
|
|
|
|
|
|
|
|
LoadParameterName();
|
|
|
|
|
|
|
|
|
|
PlayerSelecter.ItemsSource = listNbPlayer;
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,17 +84,23 @@ 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)
|
|
|
|
|
{
|
|
|
|
|
canModif = false;
|
|
|
|
|
PlayerSelecter.Value = Math.Round(PlayerSelecter.Value);
|
|
|
|
|
|
|
|
|
|
if ((int)PlayerSelecter.Value == 1)
|
|
|
|
|
{
|
|
|
|
|
LoadParameterName();
|
|
|
|
|
}
|
|
|
|
@ -95,35 +108,89 @@ namespace TheGameExtreme.view
|
|
|
|
|
{
|
|
|
|
|
FirstEntry.Text = "";
|
|
|
|
|
}
|
|
|
|
|
while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem)
|
|
|
|
|
|
|
|
|
|
while (NameList.Children.Count - 1 != (int)PlayerSelecter.Value)
|
|
|
|
|
{
|
|
|
|
|
if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem)
|
|
|
|
|
if (NameList.Children.Count - 1 < (int)PlayerSelecter.Value)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Entry e = new Entry
|
|
|
|
|
{
|
|
|
|
|
Placeholder = "Pseudo",
|
|
|
|
|
BackgroundColor = (Color)Application.Current.Resources["Gold"],
|
|
|
|
|
WidthRequest = 150,
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ChangedStacks(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (canModif)
|
|
|
|
|
{
|
|
|
|
|
canModif = false;
|
|
|
|
|
|
|
|
|
|
if (SelectNbStack.Value < 5)
|
|
|
|
|
{
|
|
|
|
|
SelectNbStack.Value = 4;
|
|
|
|
|
}
|
|
|
|
|
else if (SelectNbStack.Value < 7)
|
|
|
|
|
{
|
|
|
|
|
SelectNbStack.Value = 6;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SelectNbStack.Value = 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
canModif = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ChangedNbCards(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (canModif)
|
|
|
|
|
{
|
|
|
|
|
canModif = false;
|
|
|
|
|
|
|
|
|
|
if (SelectNbCard.Value < 50)
|
|
|
|
|
{
|
|
|
|
|
SelectNbCard.Value = 40;
|
|
|
|
|
}
|
|
|
|
|
else if (SelectNbCard.Value < 70)
|
|
|
|
|
{
|
|
|
|
|
SelectNbCard.Value = 60;
|
|
|
|
|
}
|
|
|
|
|
else if (SelectNbCard.Value < 90)
|
|
|
|
|
{
|
|
|
|
|
SelectNbCard.Value = 80;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|