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.
70 lines
1.9 KiB
70 lines
1.9 KiB
using Qwirkle.Views;
|
|
using QwirkleClassLibrary;
|
|
using QwirkleClassLibrary.Games;
|
|
using Microsoft.Maui.Controls;
|
|
using Qwirkle.Pages;
|
|
using QwirkleClassLibrary.Persistences;
|
|
|
|
namespace Qwirkle
|
|
{
|
|
public partial class MainPage : ContentPage
|
|
{
|
|
|
|
public MainPage()
|
|
{
|
|
InitializeComponent();
|
|
BindingContext = this;
|
|
}
|
|
|
|
public void OnInfoClicked(object sender, EventArgs e)
|
|
{
|
|
DisplayAlert("Game notification", "Enter minimun 2 player and max 4 player !", "Ok ! Lets's go !");
|
|
|
|
Shell.Current.GoToAsync("SetPlayers");
|
|
}
|
|
|
|
public async void OnContinueClicked(object sender, EventArgs e)
|
|
{
|
|
IGamePersistence gameLoad = new GamePersistenceXml();
|
|
try
|
|
{
|
|
((App)Application.Current!).Game = gameLoad.LoadGame();
|
|
await Navigation.PushAsync(new Gameboard());
|
|
}
|
|
catch
|
|
{
|
|
await DisplayAlert("Error", "No game found", "Got it !");
|
|
await Navigation.PopAsync();
|
|
}
|
|
|
|
if (!((App)Application.Current!).Game.GameRunning)
|
|
{
|
|
await DisplayAlert("Error", "No game found", "Got it !");
|
|
await Navigation.PopAsync();
|
|
}
|
|
}
|
|
|
|
public void OnRulesClicked(object sender, EventArgs e)
|
|
{
|
|
Navigation.PushAsync(new Rules());
|
|
}
|
|
|
|
public void OnSettingsClicked(object sender, EventArgs e)
|
|
{
|
|
Navigation.PushAsync(new Settings());
|
|
}
|
|
|
|
public void OnCreditsClicked(object sender, EventArgs e)
|
|
{
|
|
Navigation.PushAsync(new Credits());
|
|
}
|
|
|
|
public void OnCLeaderboardClicked(object sender, EventArgs e)
|
|
{
|
|
Navigation.PushAsync(new Leaderboard());
|
|
}
|
|
|
|
}
|
|
|
|
}
|