Continuation de la vue jeton
continuous-integration/drone/push Build is failing Details

master
Céleste BARBOSA 11 months ago
parent f05a0f997d
commit 643a15c879

@ -59,7 +59,7 @@
BindableLayout.ItemsSource="{Binding [0]}"> BindableLayout.ItemsSource="{Binding [0]}">
<BindableLayout.ItemTemplate> <BindableLayout.ItemTemplate>
<DataTemplate> <DataTemplate>
<Label Text="{Binding Path=Couleur, Converter={StaticResource conv:CouleurVersCouleurMAUI}}"/>
</DataTemplate> </DataTemplate>
</BindableLayout.ItemTemplate> </BindableLayout.ItemTemplate>
</FlexLayout> </FlexLayout>

@ -24,7 +24,7 @@ internal class Tour
(IEnumerable<Jeton>, IEnumerable<Indicateur>)[] plateau = new (IEnumerable<Jeton>, IEnumerable<Indicateur>)[e.Grille.Count()]; (IEnumerable<Jeton>, IEnumerable<Indicateur>)[] plateau = new (IEnumerable<Jeton>, IEnumerable<Indicateur>)[e.Grille.Count()];
for (int i = 0; i < e.Grille.Count(); ++i) 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[i] = ([new Jeton(Couleur.ROUGE), new Jeton(Couleur.VERT), new Jeton(Couleur.BLEU), new Jeton(Couleur.JAUNE)], e.Indicateurs.ElementAt(i));
} }
Plateau = plateau; Plateau = plateau;
} }

@ -43,4 +43,8 @@
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource BordureClair}, Dark={StaticResource BordureSombre}}"/> <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource BordureClair}, Dark={StaticResource BordureSombre}}"/>
</Style> </Style>
<Style TargetType="Ellipse">
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource BordureClair}, Dark={StaticResource BordureSombre}}"/>
</Style>
</ResourceDictionary> </ResourceDictionary>

@ -1,13 +1,15 @@
using Microsoft.Maui.Controls.Shapes;
namespace MauiSpark.Vues; namespace MauiSpark.Vues;
public partial class JetonVue : ContentView public partial class JetonVue : ContentView
{ {
public static readonly BindableProperty CouleurPropriete = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChange); public static readonly BindableProperty CouleurProperty = BindableProperty.Create(nameof(Couleur), typeof(Color), typeof(JetonVue), default(Color), propertyChanged: QuandCouleurChangee);
public Color? Couleur public Color Couleur
{ {
get => (Color?)GetValue(CouleurPropriete); get => (Color)GetValue(CouleurProperty);
set => SetValue(CouleurPropriete, value); set => SetValue(CouleurProperty, Color.FromRgb(0, 255, 0));
} }
public JetonVue() public JetonVue()
@ -22,26 +24,8 @@ public partial class JetonVue : ContentView
Cercle.WidthRequest = Cercle.HeightRequest = taille; Cercle.WidthRequest = Cercle.HeightRequest = taille;
} }
private static void QuandCouleurChange(BindableObject bindable, object oldValue, object newValue) private static void QuandCouleurChangee(BindableObject bindable, object ancienneValeur, object nouvelleValeur)
{
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 ((JetonVue)bindable).Cercle.Fill = (Color) nouvelleValeur;
BackgroundColor = Colors.Transparent; // Ou toute autre couleur par défaut
}
else
{
BackgroundColor = Couleur;
}
} }
} }
Loading…
Cancel
Save