You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sae201_qwirkle/Qwirkle/QwirkleViews/Pages/SetPlayers.xaml.cs

65 lines
1.7 KiB

using Qwirkle.Views;
using QwirkleClassLibrary.Games;
namespace Qwirkle.Pages;
public partial class SetPlayers : ContentPage
{
private Game game = ((App)App.Current!).Game;
public SetPlayers()
{
InitializeComponent();
BindingContext = this;
}
public EntryPlayer Entry1 { get; set; }
= new EntryPlayer
{
TextOn = "Player 1",
TextHolder = "Entry tag of player 1"
};
public EntryPlayer Entry2 { get; set; }
= new EntryPlayer
{
TextOn = "Player 2",
TextHolder = "Entry tag of player 2"
};
public EntryPlayer Entry3 { get; set; }
= new EntryPlayer
{
TextOn = "Player 3",
TextHolder = "Entry tag of player 3"
};
public EntryPlayer Entry4 { get; set; }
= new EntryPlayer
{
TextOn = "Player 4",
TextHolder = "Entry tag of player 4"
};
void OnButtonContinueClick(object sender, EventArgs e)
{
game.PlayerAddNotified += Game_PlayerAddNotified;
string entry1 = Entry1.TextIn!;
string entry2 = Entry2.TextIn!;
string entry3 = Entry3.TextIn!;
string entry4 = Entry4.TextIn!;
DisplayAlert("Game notification", entry1 + "\n" + entry2 + "\n" + entry3 + "\n" + entry4, "Ok ! Lets's go !");
game.AddPlayerInGame(entry1);
game.AddPlayerInGame(entry2);
game.AddPlayerInGame(entry3);
game.AddPlayerInGame(entry4);
}
private void Game_PlayerAddNotified(object? sender, QwirkleClassLibrary.Events.AddPlayerNotifiedEventArgs args)
{
DisplayAlert("Game notification", args.ReturnedNotified, "Ok ! Lets's go !");
}
}