Début système de commentaire et de déconnexion
continuous-integration/drone/push Build is failing Details

pull/65/head
Rémi LAVERGNE 2 years ago
parent 65b1af018f
commit 48b3b8b40f

@ -11,5 +11,7 @@ public partial class AppShell : Shell
Routing.RegisterRoute(nameof(PageJeu), typeof(PageJeu)); Routing.RegisterRoute(nameof(PageJeu), typeof(PageJeu));
Routing.RegisterRoute(nameof(PageAdmin), typeof(PageAdmin)); Routing.RegisterRoute(nameof(PageAdmin), typeof(PageAdmin));
Routing.RegisterRoute(nameof(PageAcceuil), typeof(PageAcceuil));
} }
} }

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
@ -33,7 +34,7 @@ namespace GameAtlas.Models
[DataMember] [DataMember]
public string Image { get; private set; } public string Image { get; private set; }
[DataMember] [DataMember]
public List<(string, int, string)> ListeAvis { get; private set; } public ObservableCollection<(string,double,string)> ListeAvis { get; private set; }
[DataMember] [DataMember]
public int NbFavoris { get; private set; } public int NbFavoris { get; private set; }
[DataMember] [DataMember]
@ -52,11 +53,16 @@ namespace GameAtlas.Models
//Revendeurs = revendeurs; //Revendeurs = revendeurs;
Genres = genres; Genres = genres;
Image = image; Image = image;
ListeAvis = new List<(string, int, string)>(); ListeAvis = new ObservableCollection<(string, double, string)>();
NbFavoris = 0; NbFavoris = 0;
NbPossedes = 0; NbPossedes = 0;
} }
public void AjouterAvis(string pseudo, double note, string commentaire)
{
this.ListeAvis.Add((pseudo, note, commentaire));
}
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj == null || GetType() != obj.GetType()) if (obj == null || GetType() != obj.GetType())

@ -16,7 +16,6 @@ namespace GameAtlas.Models
public List<Utilisateur> Utilisateurs { get; private set; } public List<Utilisateur> Utilisateurs { get; private set; }
private ObservableCollection<Jeu> topRatedGames; private ObservableCollection<Jeu> topRatedGames;
public ObservableCollection<Jeu> TopRatedGames public ObservableCollection<Jeu> TopRatedGames
{ {
get get
@ -45,9 +44,6 @@ namespace GameAtlas.Models
} }
} }
private ObservableCollection<Jeu> listJeux; private ObservableCollection<Jeu> listJeux;
public ObservableCollection<Jeu> ListJeux public ObservableCollection<Jeu> ListJeux
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

@ -61,64 +61,64 @@ public partial class PageAdmin : ContentPage
} }
break; break;
case 2: case 2:
sortie = await DisplayPromptAsync("Informations sur le Jeu [2/10]", "Date de Sortie", accept: "Suivant", cancel: "Annuler", placeholder: "JJ/MM/AAAA"); resume = await DisplayPromptAsync("Informations sur le Jeu [2/10]", "Résumé du jeu", accept: "Terminer", cancel: "Annuler", placeholder: "Résumé du jeu");
if (string.IsNullOrEmpty(sortie)) if (string.IsNullOrEmpty(resume))
{ {
annuler = true; annuler = true;
} }
break; break;
case 3: case 3:
plateformes = await DisplayPromptAsync("Informations sur le Jeu [3/10]", "Plateforme(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Ex: XOne PC PS5"); sortie = await DisplayPromptAsync("Informations sur le Jeu [3/10]", "Date de Sortie", accept: "Suivant", cancel: "Annuler", placeholder: "JJ/MM/AAAA");
if (string.IsNullOrEmpty(plateformes)) if (string.IsNullOrEmpty(sortie))
{ {
annuler = true; annuler = true;
} }
break; break;
case 4: case 4:
developpeur = await DisplayPromptAsync("Informations sur le Jeu [4/10]", "Développeur", accept: "Suivant", cancel: "Annuler", placeholder: "Rockstar Games"); plateformes = await DisplayPromptAsync("Informations sur le Jeu [4/10]", "Plateforme(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Ex: XOne PC PS5");
if (string.IsNullOrEmpty(developpeur)) if (string.IsNullOrEmpty(plateformes))
{ {
annuler = true; annuler = true;
} }
break; break;
case 5: case 5:
editeur = await DisplayPromptAsync("Informations sur le Jeu [5/10]", "Editeur", accept: "Suivant", cancel: "Annuler", placeholder: "Take-Two Interactive"); developpeur = await DisplayPromptAsync("Informations sur le Jeu [5/10]", "Développeur", accept: "Suivant", cancel: "Annuler", placeholder: "Rockstar Games");
if (string.IsNullOrEmpty(editeur)) if (string.IsNullOrEmpty(developpeur))
{ {
annuler = true; annuler = true;
} }
break; break;
case 6: case 6:
note = await DisplayPromptAsync("Informations sur le Jeu [6/10]", "Note de 0 à 5", accept: "Suivant", cancel: "Annuler", maxLength: 1, placeholder: "5"); editeur = await DisplayPromptAsync("Informations sur le Jeu [6/10]", "Editeur", accept: "Suivant", cancel: "Annuler", placeholder: "Take-Two Interactive");
if (string.IsNullOrEmpty(note)) if (string.IsNullOrEmpty(editeur))
{ {
annuler = true; annuler = true;
} }
break; break;
case 7: case 7:
nbTelechargement = await DisplayPromptAsync("Informations sur le Jeu [7/10]", "Nombre de Téléchargements (en milliers, ex: 630k)", accept: "Suivant", cancel: "Annuler", placeholder: "630"); note = await DisplayPromptAsync("Informations sur le Jeu [7/10]", "Note de 0 à 10", accept: "Suivant", cancel: "Annuler", maxLength: 3, placeholder: "4,5");
if (string.IsNullOrEmpty(nbTelechargement)) if (string.IsNullOrEmpty(note))
{ {
annuler = true; annuler = true;
} }
break; break;
case 8: case 8:
genre = await DisplayPromptAsync("Informations sur le Jeu [8/10]", "Genre(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Action Aventure"); nbTelechargement = await DisplayPromptAsync("Informations sur le Jeu [8/10]", "Nombre de Téléchargements (en milliers, ex: 630k)", accept: "Suivant", cancel: "Annuler", placeholder: "630");
if (string.IsNullOrEmpty(genre)) if (string.IsNullOrEmpty(nbTelechargement))
{ {
annuler = true; annuler = true;
} }
break; break;
case 9: case 9:
image = await DisplayPromptAsync("Informations sur le Jeu [9/10]", "Image de couverture (préférez URL finissant par .png)", accept: "Terminer", cancel: "Annuler", placeholder: "http://example.com/monimage.png"); genre = await DisplayPromptAsync("Informations sur le Jeu [9/10]", "Genre(s), un espace pour séparer", accept: "Suivant", cancel: "Annuler", placeholder: "Action Aventure");
if (string.IsNullOrEmpty(image)) if (string.IsNullOrEmpty(genre))
{ {
annuler = true; annuler = true;
} }
break; break;
case 10: case 10:
resume = await DisplayPromptAsync("Informations sur le Jeu [10/10]", "Résumé du jeu", accept: "Terminer", cancel: "Annuler", placeholder: "Résumé du jeu"); image = await DisplayPromptAsync("Informations sur le Jeu [10/10]", "Image de couverture (préférez URL finissant par .png)", accept: "Terminer", cancel: "Annuler", placeholder: "http://example.com/monimage.png");
if (string.IsNullOrEmpty(resume)) if (string.IsNullOrEmpty(image))
{ {
annuler = true; annuler = true;
} }
@ -130,7 +130,7 @@ public partial class PageAdmin : ContentPage
if (!annuler) if (!annuler)
{ {
Jeu adminJeu = new Jeu(nom, sortie, plateformes, developpeur, editeur, Convert.ToDouble(note), Convert.ToInt32(nbTelechargement), genre, image); Jeu adminJeu = new Jeu(nom, resume, sortie, plateformes, developpeur, editeur, Convert.ToDouble(note), Convert.ToInt32(nbTelechargement), genre, image);
AdminManager.AddJeux(adminJeu); AdminManager.AddJeux(adminJeu);
AdminManager.SauvegardeDonnees(); AdminManager.SauvegardeDonnees();
AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeux)); AdminManager.OnPropertyChanged(nameof(AdminManager.ListJeux));

@ -149,17 +149,9 @@
<Label Text="{Binding JeuModel.Resume}" FontFamily="PTSansNRegular" FontSize="10" TextColor="{StaticResource Gray500}" VerticalOptions="Center"/> <Label Text="{Binding JeuModel.Resume}" FontFamily="PTSansNRegular" FontSize="10" TextColor="{StaticResource Gray500}" VerticalOptions="Center"/>
<Button Text="+ Ajouter un commentaire" FontFamily="PTSansCBold" FontSize="13" TextColor="{StaticResource Black}" Clicked="OnAddCommentClicked"/>
<VerticalStackLayout Spacing="10" Margin="0,15,0,0"> <VerticalStackLayout Spacing="10" Margin="0,15,0,0">
<Button Text="+ Ajouter un commentaire" FontFamily="PTSansCBold" FontSize="13" TextColor="{StaticResource Black}" Clicked="OnAddCommentTapped"/> <BindableLayout.ItemTemplate ItemsSource="{Binding JeuModel.ListeAvis}">
<BindableLayout.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>XONE</x:String>
<x:String>PS5</x:String>
<x:String>PC</x:String>
<x:String>SWITCH</x:String>
</x:Array>
</BindableLayout.ItemsSource>
<BindableLayout.ItemTemplate>
<DataTemplate> <DataTemplate>
<Frame CornerRadius="5" BackgroundColor="{StaticResource Tertiary}" Padding="15"> <Frame CornerRadius="5" BackgroundColor="{StaticResource Tertiary}" Padding="15">
<Grid ColumnDefinitions="30,*" RowDefinitions="30,auto" ColumnSpacing="10" RowSpacing="10"> <Grid ColumnDefinitions="30,*" RowDefinitions="30,auto" ColumnSpacing="10" RowSpacing="10">
@ -178,14 +170,14 @@
</Frame> </Frame>
<VerticalStackLayout Grid.Column="1" VerticalOptions="Center" Spacing="3"> <VerticalStackLayout Grid.Column="1" VerticalOptions="Center" Spacing="3">
<Label Text="Pseudonyme" FontSize="14" FontFamily="AladinRegular" TextColor="{StaticResource Black}"/> <Label Text="{Binding Item1}" FontSize="14" FontFamily="AladinRegular" TextColor="{StaticResource Black}"/>
<HorizontalStackLayout Spacing="3"> <HorizontalStackLayout Spacing="3">
<Image Source="starrating" HeightRequest="10" VerticalOptions="Center" Margin="0,-2,0,0"/> <Image Source="starrating" HeightRequest="10" VerticalOptions="Center" Margin="0,-2,0,0"/>
<Label Text="5" FontSize="10" FontFamily="RobotoRegular" TextColor="{StaticResource Gray600}" VerticalOptions="Center"/> <Label Text="{Binding Item2}" FontSize="10" FontFamily="RobotoRegular" TextColor="{StaticResource Gray600}" VerticalOptions="Center"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</VerticalStackLayout> </VerticalStackLayout>
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="Hogwarts Legacy est un jeu de rôle d'action et d'aventure solo basé sur l'univers de Harry Potter, dans lequel le joueur incarne un nouveau venu dans le château enchanté tant apprécié des fans des livres et de la franchise cinématographique." FontFamily="PTSansNRegular" FontSize="10" TextColor="{StaticResource Gray500}" VerticalOptions="Center"/> <Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Item3}" FontFamily="PTSansNRegular" FontSize="10" TextColor="{StaticResource Gray500}" VerticalOptions="Center"/>
</Grid> </Grid>
</Frame> </Frame>

@ -96,6 +96,21 @@ public partial class PageJeu : ContentPage
} }
} }
async void OnAddCommentClicked(object sender, EventArgs args)
{
if (JeuManager.ConnectedUser != null)
{
string commentaire = await DisplayPromptAsync("⭐ Votre Avis", "Ecrivez votre commentaire:\n(250 caractères maximum)", maxLength: 250, accept: "Suivant", cancel: "Annuler");
string note = await DisplayPromptAsync("✒️ La Note", "De 0 à 10", maxLength: 3, accept: "Envoyer", cancel: "Annuler");
JeuModel.AjouterAvis(JeuManager.ConnectedUser.Pseudo, Convert.ToDouble(note), commentaire);
}
else
{
Alert();
}
}
async void Back_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e) async void Back_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
{ {
await Navigation.PopAsync(); await Navigation.PopAsync();

@ -43,6 +43,12 @@
</Label> </Label>
</VerticalStackLayout> </VerticalStackLayout>
<Image Source="logout.png">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnDisconnect_Tapped"/>
</Image.GestureRecognizers>
</Image>
<Grid Grid.Row="0" Grid.Column="2" RowDefinitions="50" ColumnDefinitions="50" HorizontalOptions="Start"> <Grid Grid.Row="0" Grid.Column="2" RowDefinitions="50" ColumnDefinitions="50" HorizontalOptions="Start">
<Frame IsVisible="{Binding ConnectedUser.EstAdmin}" WidthRequest="50" HeightRequest="50" CornerRadius="25" VerticalOptions="Start" IsClippedToBounds="True" BackgroundColor="{StaticResource Tertiary}"> <Frame IsVisible="{Binding ConnectedUser.EstAdmin}" WidthRequest="50" HeightRequest="50" CornerRadius="25" VerticalOptions="Start" IsClippedToBounds="True" BackgroundColor="{StaticResource Tertiary}">
<Image Source="shieldperson" HeightRequest="40"/> <Image Source="shieldperson" HeightRequest="40"/>

@ -39,4 +39,10 @@ public partial class PageProfil : ContentPage
{ {
await Shell.Current.GoToAsync(nameof(PageAdmin)); await Shell.Current.GoToAsync(nameof(PageAdmin));
} }
async void OnDisconnect_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
{
await Shell.Current.GoToAsync(nameof(PageAcceuil));
ProfilManager.ConnectedUser = null;
}
} }
Loading…
Cancel
Save