Ne fonctionne pas j'arrete pour ce soir - Amélioration design
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
0f15fb0e16
commit
f05a0f997d
@ -1,45 +0,0 @@
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Pages.Accueil"
|
||||
|
||||
Title="Accueil">
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*"
|
||||
RowDefinitions="auto, *, *">
|
||||
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*,*"
|
||||
RowDefinitions="auto">
|
||||
|
||||
<ImageButton
|
||||
Style="{StaticResource AccueilBouton}"
|
||||
Source="pointinterrogation.png"
|
||||
HorizontalOptions="Start"
|
||||
Clicked="QuandReglesClique"
|
||||
/>
|
||||
|
||||
<ImageButton
|
||||
Grid.Column="1"
|
||||
Style="{StaticResource AccueilBouton}"
|
||||
Source="statistiques.png"
|
||||
HorizontalOptions="End"
|
||||
Clicked="QuandTableauClique"
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="MASTERMIND"
|
||||
FontSize="Header"
|
||||
HorizontalTextAlignment="Center"/>
|
||||
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Text="Jouer"
|
||||
Clicked="QuandJouerClique"/>
|
||||
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -1,27 +0,0 @@
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class Accueil : ContentPage
|
||||
{
|
||||
public Accueil()
|
||||
{
|
||||
NavigationPage.SetHasBackButton(this, false);
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void QuandJouerClique(Object? sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new Mode());
|
||||
}
|
||||
|
||||
private void QuandReglesClique (Object? sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new Regle());
|
||||
}
|
||||
|
||||
private void QuandTableauClique(Object? sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new TableauScore());
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Pages.AccueilPage"
|
||||
xmlns:vues="clr-namespace:MauiSpark.Vues"
|
||||
Title="Accueil">
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*"
|
||||
RowDefinitions="*, *">
|
||||
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*, *, *"
|
||||
RowDefinitions="*">
|
||||
|
||||
<vues:BoutonReglesVue HorizontalOptions="Start"/>
|
||||
|
||||
<vues:TitreVue Texte="mastermind" Grid.Column="1"/>
|
||||
|
||||
<vues:BoutonClassementVue Grid.Column="2" HorizontalOptions="End"/>
|
||||
</Grid>
|
||||
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
Text="Jouer"
|
||||
VerticalOptions="Center"
|
||||
Margin="0, 50"
|
||||
Clicked="QuandJouerClique"/>
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -0,0 +1,17 @@
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class AccueilPage : ContentPage
|
||||
{
|
||||
public AccueilPage()
|
||||
{
|
||||
NavigationPage.SetHasBackButton(this, false);
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void QuandJouerClique(Object? sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new ModePage());
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Pages.Mode"
|
||||
Title="Mode">
|
||||
<Grid ColumnDefinitions="*" RowDefinitions="*, *">
|
||||
<Label Text="Mode de jeu"/>
|
||||
<Button Grid.Row="1" Text="Règles classiques" Clicked="QuandReglesClassiques"/>
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Pages.ModePage"
|
||||
xmlns:vues="clr-namespace:MauiSpark.Vues"
|
||||
Title="ModePage">
|
||||
|
||||
<Grid
|
||||
ColumnDefinitions="*"
|
||||
RowDefinitions="*, *">
|
||||
|
||||
<vues:TitreVue Texte="mode de jeu"/>
|
||||
|
||||
<Button
|
||||
x:Name="ReglesClassiques"
|
||||
Grid.Row="1"
|
||||
Text="Règles classiques"
|
||||
Clicked="QuandReglesPresse"/>
|
||||
</Grid>
|
||||
</ContentPage>
|
@ -1,28 +1,32 @@
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Events;
|
||||
using CoreLibrary.Regles;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class Mode : ContentPage
|
||||
{
|
||||
public Mode()
|
||||
{
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void QuandReglesClassiques(Object? sender, EventArgs e)
|
||||
{
|
||||
Partie partie = new Partie(new ReglesClassiques());
|
||||
|
||||
partie.DemanderNom += new ConnexionPage().QuandDemanderNom;
|
||||
partie.NouveauTour += new Plateau().QuandNouveauTour;
|
||||
partie.PartieTerminee += new Victoire().QuandPartieTerminee;
|
||||
|
||||
MauiProgram.Manageur.NouvellePartie(partie);
|
||||
|
||||
partie.Jouer();
|
||||
}
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Regles;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
public partial class ModePage : ContentPage
|
||||
{
|
||||
public ModePage()
|
||||
{
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void QuandReglesPresse(Object sender, EventArgs e)
|
||||
{
|
||||
Partie partie;
|
||||
|
||||
if (sender.Equals(ReglesClassiques))
|
||||
partie = new Partie(new ReglesClassiques());
|
||||
else
|
||||
return;
|
||||
|
||||
partie.DemanderNom += new ConnexionPage().QuandDemanderNom;
|
||||
partie.NouveauTour += new PlateauPage().QuandNouveauTour;
|
||||
partie.PartieTerminee += new Victoire().QuandPartieTerminee;
|
||||
|
||||
MauiProgram.Manageur.NouvellePartie(partie);
|
||||
|
||||
partie.Jouer();
|
||||
}
|
||||
}
|
@ -1,117 +1,117 @@
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Core;
|
||||
using CoreLibrary.Events;
|
||||
using CoreLibrary.Exceptions;
|
||||
using CoreLibrary.Joueurs;
|
||||
using MauiSpark.Convertisseurs;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
internal class Tour
|
||||
{
|
||||
public IEnumerable<(IEnumerable<Jeton>, IEnumerable<Indicateur>)> Plateau { get; private init; }
|
||||
public Joueur Joueur { get; private init; }
|
||||
public string Numero { get; private init; }
|
||||
public Code Code { get; private init; }
|
||||
|
||||
public Tour(NouveauTourEventArgs e)
|
||||
{
|
||||
Numero = $"Tour {e.Tour}";
|
||||
Joueur = e.Joueur;
|
||||
Code = e.Code;
|
||||
|
||||
(IEnumerable<Jeton>, IEnumerable<Indicateur>)[] plateau = new (IEnumerable<Jeton>, IEnumerable<Indicateur>)[e.Grille.Count()];
|
||||
for (int i = 0; i < e.Grille.Count(); ++i)
|
||||
{
|
||||
plateau[i] = (e.Grille.ElementAt(i).Where(x => x.HasValue).Select(x => x!.Value), e.Indicateurs.ElementAt(i));
|
||||
}
|
||||
Plateau = plateau;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public partial class Plateau : ContentPage
|
||||
{
|
||||
private Code? code;
|
||||
private Joueur? joueur;
|
||||
|
||||
public Plateau()
|
||||
{
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public async void QuandNouveauTour(object? sender, NouveauTourEventArgs e)
|
||||
{
|
||||
if (Application.Current == null || Application.Current.MainPage == null)
|
||||
return;
|
||||
|
||||
if (((NavigationPage)Application.Current!.MainPage).CurrentPage != this)
|
||||
await Application.Current.MainPage.Navigation.PushAsync(this);
|
||||
|
||||
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse().Skip(1);
|
||||
|
||||
foreach (Page page in pages)
|
||||
{
|
||||
if (page is Accueil)
|
||||
break;
|
||||
|
||||
Application.Current.MainPage.Navigation.RemovePage(page);
|
||||
}
|
||||
|
||||
code = e.Code;
|
||||
joueur = e.Joueur;
|
||||
|
||||
BindingContext = new Tour(e);
|
||||
}
|
||||
|
||||
private void CouleurPresee(Object sender, EventArgs e)
|
||||
{
|
||||
Label label = (Label)sender;
|
||||
Couleur couleur = (Couleur)new CouleurVersCouleurMAUI().ConvertBack(label.TextColor, typeof(Couleur), null, CultureInfo.InvariantCulture);
|
||||
|
||||
try
|
||||
{
|
||||
if(code != null)
|
||||
code.AjouterJeton(new Jeton(couleur));
|
||||
}
|
||||
catch (CodeCompletException)
|
||||
{
|
||||
DisplayAlert("Attention", "La code est plein", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
private void SupprimerDernierJeton(Object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(code != null)
|
||||
code.SupprimerDernierJeton();
|
||||
}
|
||||
catch(CodeVideException)
|
||||
{
|
||||
DisplayAlert("Attention", "La code est vide", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
private void ValiderCode(Object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(joueur != null && code != null)
|
||||
joueur.Code(code);
|
||||
}
|
||||
catch (CodeIncompletException)
|
||||
{
|
||||
DisplayAlert("Attention", "La code n'est pas complet", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
private async void QuandReglesClique(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PushAsync(new Regle());
|
||||
}
|
||||
using CoreLibrary;
|
||||
using CoreLibrary.Core;
|
||||
using CoreLibrary.Events;
|
||||
using CoreLibrary.Exceptions;
|
||||
using CoreLibrary.Joueurs;
|
||||
using MauiSpark.Convertisseurs;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MauiSpark.Pages;
|
||||
|
||||
internal class Tour
|
||||
{
|
||||
public IEnumerable<(IEnumerable<Jeton>, IEnumerable<Indicateur>)> Plateau { get; private init; }
|
||||
public Joueur Joueur { get; private init; }
|
||||
public string Numero { get; private init; }
|
||||
public Code Code { get; private init; }
|
||||
|
||||
public Tour(NouveauTourEventArgs e)
|
||||
{
|
||||
Numero = $"Tour {e.Tour}";
|
||||
Joueur = e.Joueur;
|
||||
Code = e.Code;
|
||||
|
||||
(IEnumerable<Jeton>, IEnumerable<Indicateur>)[] plateau = new (IEnumerable<Jeton>, IEnumerable<Indicateur>)[e.Grille.Count()];
|
||||
for (int i = 0; i < e.Grille.Count(); ++i)
|
||||
{
|
||||
plateau[i] = (e.Grille.ElementAt(i).Where(x => x.HasValue).Select(x => x!.Value), e.Indicateurs.ElementAt(i));
|
||||
}
|
||||
Plateau = plateau;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public partial class PlateauPage : ContentPage
|
||||
{
|
||||
private Code? code;
|
||||
private Joueur? joueur;
|
||||
|
||||
public PlateauPage()
|
||||
{
|
||||
NavigationPage.SetHasNavigationBar(this, false);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public async void QuandNouveauTour(object? sender, NouveauTourEventArgs e)
|
||||
{
|
||||
if (Application.Current == null || Application.Current.MainPage == null)
|
||||
return;
|
||||
|
||||
if (((NavigationPage)Application.Current!.MainPage).CurrentPage != this)
|
||||
await Application.Current.MainPage.Navigation.PushAsync(this);
|
||||
|
||||
IEnumerable<Page> pages = Application.Current.MainPage.Navigation.NavigationStack.Reverse().Skip(1);
|
||||
|
||||
foreach (Page page in pages)
|
||||
{
|
||||
if (page is AccueilPage)
|
||||
break;
|
||||
|
||||
Application.Current.MainPage.Navigation.RemovePage(page);
|
||||
}
|
||||
|
||||
code = e.Code;
|
||||
joueur = e.Joueur;
|
||||
|
||||
BindingContext = new Tour(e);
|
||||
}
|
||||
|
||||
private void CouleurPresee(Object sender, EventArgs e)
|
||||
{
|
||||
Label label = (Label)sender;
|
||||
Couleur couleur = (Couleur)new CouleurVersCouleurMAUI().ConvertBack(label.TextColor, typeof(Couleur), null, CultureInfo.InvariantCulture);
|
||||
|
||||
try
|
||||
{
|
||||
if(code != null)
|
||||
code.AjouterJeton(new Jeton(couleur));
|
||||
}
|
||||
catch (CodeCompletException)
|
||||
{
|
||||
DisplayAlert("Attention", "La code est plein", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
private void SupprimerDernierJeton(Object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(code != null)
|
||||
code.SupprimerDernierJeton();
|
||||
}
|
||||
catch(CodeVideException)
|
||||
{
|
||||
DisplayAlert("Attention", "La code est vide", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
private void ValiderCode(Object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(joueur != null && code != null)
|
||||
joueur.Code(code);
|
||||
}
|
||||
catch (CodeIncompletException)
|
||||
{
|
||||
DisplayAlert("Attention", "La code n'est pas complet", "OK");
|
||||
}
|
||||
}
|
||||
|
||||
private async void QuandReglesClique(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PushAsync(new Regle());
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Vues.BoutonClassementVue"
|
||||
x:Name="boutonClassementVue">
|
||||
|
||||
<ImageButton
|
||||
Source="statistiques.png"
|
||||
Clicked="QuandClassementClique"/>
|
||||
</ContentView>
|
@ -0,0 +1,16 @@
|
||||
using MauiSpark.Pages;
|
||||
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class BoutonClassementVue : ContentView
|
||||
{
|
||||
public BoutonClassementVue()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void QuandClassementClique(Object? sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new TableauScore());
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Vues.BoutonReglesVue"
|
||||
x:Name="boutonReglesVue">
|
||||
|
||||
<ImageButton
|
||||
Source="pointinterrogation.png"
|
||||
Clicked="QuandReglesClique"/>
|
||||
</ContentView>
|
@ -0,0 +1,16 @@
|
||||
using MauiSpark.Pages;
|
||||
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class BoutonReglesVue : ContentView
|
||||
{
|
||||
public BoutonReglesVue()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void QuandReglesClique(Object? sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new Regle());
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Vues.JetonVue"
|
||||
x:Name="jetonVue">
|
||||
|
||||
<Grid
|
||||
x:Name="Grid"
|
||||
SizeChanged="QuandTailleChangee">
|
||||
|
||||
<Ellipse
|
||||
x:Name="Cercle"
|
||||
Fill="{Binding Couleur, Source={x:Reference jetonVue}}"/>
|
||||
</Grid>
|
||||
|
||||
</ContentView>
|
@ -0,0 +1,47 @@
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class JetonVue : ContentView
|
||||
{
|
||||
public static readonly BindableProperty CouleurPropriete = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChange);
|
||||
|
||||
public Color? Couleur
|
||||
{
|
||||
get => (Color?)GetValue(CouleurPropriete);
|
||||
set => SetValue(CouleurPropriete, value);
|
||||
}
|
||||
|
||||
public JetonVue()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = this;
|
||||
}
|
||||
|
||||
private void QuandTailleChangee(object sender, EventArgs e)
|
||||
{
|
||||
double taille = Math.Min(Grid.Width, Grid.Height) / 2;
|
||||
Cercle.WidthRequest = Cercle.HeightRequest = taille;
|
||||
}
|
||||
|
||||
private static void QuandCouleurChange(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var view = bindable as JetonVue;
|
||||
if (view != null)
|
||||
{
|
||||
view.UpdateCouleur();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateCouleur()
|
||||
{
|
||||
// Gérer la couleur null
|
||||
if (Couleur == null)
|
||||
{
|
||||
// Définir une couleur par défaut si null
|
||||
BackgroundColor = Colors.Transparent; // Ou toute autre couleur par défaut
|
||||
}
|
||||
else
|
||||
{
|
||||
BackgroundColor = Couleur;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="MauiSpark.Vues.TitreVue"
|
||||
x:Name="titreVue">
|
||||
|
||||
<Label
|
||||
FontSize="Header"
|
||||
Text="{Binding Texte, Source={x:Reference titreVue}}"
|
||||
HorizontalTextAlignment="Center"
|
||||
VerticalTextAlignment="Start"
|
||||
Margin="10, 50"/>
|
||||
</ContentView>
|
@ -0,0 +1,18 @@
|
||||
namespace MauiSpark.Vues;
|
||||
|
||||
public partial class TitreVue : ContentView
|
||||
{
|
||||
public static readonly BindableProperty TextePropriete = BindableProperty.Create(nameof(Texte), typeof(string), typeof(TitreVue), default(string));
|
||||
|
||||
public string Texte
|
||||
{
|
||||
get => (string)GetValue(TextePropriete);
|
||||
set => SetValue(TextePropriete, value.ToUpper());
|
||||
}
|
||||
|
||||
public TitreVue()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = this;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue