diff --git a/GameAtlas/GameAtlas/AppShell.xaml b/GameAtlas/GameAtlas/AppShell.xaml
index b2ff4c2..381d174 100644
--- a/GameAtlas/GameAtlas/AppShell.xaml
+++ b/GameAtlas/GameAtlas/AppShell.xaml
@@ -35,6 +35,11 @@
+
diff --git a/GameAtlas/GameAtlas/Models/Manager.cs b/GameAtlas/GameAtlas/Models/Manager.cs
index 235409c..5f4bf7d 100644
--- a/GameAtlas/GameAtlas/Models/Manager.cs
+++ b/GameAtlas/GameAtlas/Models/Manager.cs
@@ -12,8 +12,20 @@ namespace GameAtlas.Models
public List ListJeux { get; private set; }
public List Admins { get; private set; }
public List Utilisateurs { get; private set; }
+
public IPersistanceManager Persistance { get; set; }
+ public Utilisateur ConnectedUser
+ {
+ get => connectedUser;
+ set
+ {
+ connectedUser = value;
+ //OnPropertyChanged();
+ }
+ }
+ private Utilisateur connectedUser;
+
public Manager(IPersistanceManager persistance)
{
diff --git a/GameAtlas/GameAtlas/Models/Popup.cs b/GameAtlas/GameAtlas/Models/Popup.cs
deleted file mode 100644
index b5f6ef7..0000000
--- a/GameAtlas/GameAtlas/Models/Popup.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-namespace GameAtlas.Models
-{
- public class Popup
- {
- public static Manager PopUpManager => (App.Current as App).MyManager;
-
- public static async Task CreatePopupAsync()
- {
- var tcs = new TaskCompletionSource();
-
- var popupPage = new ContentPage();
- popupPage.BackgroundColor = Color.FromRgba(255, 255, 255, 0);
- var popupLayout = new StackLayout
- {
- Padding = new Thickness(20),
- BackgroundColor = Color.FromRgba(255, 255, 255, 255)
- };
-
- var titleLabel = new Label
- {
- Text = "Informations sur le Jeu",
- FontSize = 18,
- FontAttributes = FontAttributes.Bold,
- HorizontalOptions = LayoutOptions.Center
- };
-
- popupLayout.Children.Add(titleLabel);
-
- var nomLabel = new Label
- {
- Text = "Nom :"
- };
-
- var nomEntry = new Entry();
- popupLayout.Children.Add(nomLabel);
- popupLayout.Children.Add(nomEntry);
-
- var sortieLabel = new Label
- {
- Text = "Date de Sortie :"
- };
-
- var sortieDatePicker = new DatePicker();
- popupLayout.Children.Add(sortieLabel);
- popupLayout.Children.Add(sortieDatePicker);
-
- var plateformesLabel = new Label
- {
- Text = "Plateformes :"
- };
-
- var plateformesEntry = new Entry();
- popupLayout.Children.Add(plateformesLabel);
- popupLayout.Children.Add(plateformesEntry);
-
-
- var developpeurLabel = new Label
- {
- Text = "Développeur :"
- };
-
- var developpeurEntry = new Entry();
- popupLayout.Children.Add(developpeurLabel);
- popupLayout.Children.Add(developpeurEntry);
-
- var editeurLabel = new Label
- {
- Text = "Éditeur :"
- };
-
- var editeurEntry = new Entry();
- popupLayout.Children.Add(editeurLabel);
- popupLayout.Children.Add(editeurEntry);
-
- var noteLabel = new Label
- {
- Text = "Note :"
- };
-
- var noteEntry = new Entry();
- popupLayout.Children.Add(noteLabel);
- popupLayout.Children.Add(noteEntry);
-
- var nbTelechargementLabel = new Label
- {
- Text = "Nombre de téléchargements :"
- };
-
- var nbTelechargementEntry = new Entry();
- popupLayout.Children.Add(nbTelechargementLabel);
- popupLayout.Children.Add(nbTelechargementEntry);
-
- var genresLabel = new Label
- {
- Text = "Genres :"
- };
-
- var genresEntry = new Entry();
- popupLayout.Children.Add(genresLabel);
- popupLayout.Children.Add(genresEntry);
-
- var imageLabel = new Label
- {
- Text = "Image :"
- };
-
- var imageEntry = new Entry();
- popupLayout.Children.Add(imageLabel);
- popupLayout.Children.Add(imageEntry);
-
- var saveButton = new Button
- {
- Text = "Enregistrer",
- HorizontalOptions = LayoutOptions.Center,
- Margin = new Thickness(0, 20, 0, 0)
- };
-
- saveButton.Clicked += (sender, args) =>
- {
- // Récupérer les valeurs des champs
- string nom = nomEntry.Text;
- DateTime sortie = sortieDatePicker.Date;
- string sortieString = sortie.ToString("dd/MM/yyyy");
- string plateformesText = plateformesEntry.Text;
- string developpeur = developpeurEntry.Text;
- string editeur = editeurEntry.Text;
- int note = int.Parse(noteEntry.Text);
- int nbTelechargement = int.Parse(nbTelechargementEntry.Text);
- string genresText = genresEntry.Text;
- string image = imageEntry.Text;
-
- // Séparer les plateformes par des espaces et les ajouter à une liste
- // List plateformesList = plateformesText.Split(' ').ToList();
-
- // Séparer les genres par des espaces et les ajouter à une liste
- // List genresList = genresText.Split(' ').ToList();
-
- Jeu jeu = new Jeu
- (
- nom,
- sortieString,
- //plateformesList,
- plateformesText,
- developpeur,
- editeur,
- note,
- nbTelechargement,
- //genresList,
- genresText,
- image
- );
-
- Popup.PopUpManager.AddJeux(jeu);
- Popup.PopUpManager.SauvegardeDonnees();
-
- // Fermer la popup et retourner les valeurs
- Application.Current.MainPage.Navigation.PopModalAsync();
- tcs.SetResult("");
- };
-
- popupLayout.Children.Add(saveButton);
-
- popupPage.Content = popupLayout;
-
- await Application.Current.MainPage.Navigation.PushModalAsync(popupPage);
-
- return await tcs.Task;
- }
- }
-}
diff --git a/GameAtlas/GameAtlas/Views/PageAdmin.xaml.cs b/GameAtlas/GameAtlas/Views/PageAdmin.xaml.cs
index 92adb80..16b852a 100644
--- a/GameAtlas/GameAtlas/Views/PageAdmin.xaml.cs
+++ b/GameAtlas/GameAtlas/Views/PageAdmin.xaml.cs
@@ -17,6 +17,14 @@ public partial class PageAdmin : ContentPage
private async void OnButtonClicked(object sender, EventArgs e)
{
- string result = await Popup.CreatePopupAsync();
+ string nom = await DisplayPromptAsync("Informations sur le Jeu", "Quel est le Titre ?", placeholder: "GTA VI");
+ string sortie = await DisplayPromptAsync("Informations sur le Jeu", "Date de Sortie", placeholder: "JJ/MM/AAAA");
+ string plateformes = await DisplayPromptAsync("Informations sur le Jeu", "Plateforme(s), un espace pour séparer", placeholder: "Ex: XOne PC PS5");
+ string developpeur = await DisplayPromptAsync("Informations sur le Jeu", "Développeur", placeholder: "Rockstar Games");
+ string editeur = await DisplayPromptAsync("Informations sur le Jeu", "Editeur", placeholder: "Take-Two Interactive");
+ string note = await DisplayPromptAsync("Informations sur le Jeu", "Note de 0 à 5", maxLength: 1, keyboard:Keyboard.Numeric, placeholder: "5");
+ string nbtelechargement = await DisplayPromptAsync("Informations sur le Jeu", "Nombre de Téléchargements (en milliers, ex: 630k)", keyboard: Keyboard.Numeric, placeholder: "630");
+ string genre = await DisplayPromptAsync("Informations sur le Jeu", "Genre(s), un espace pour séparer", placeholder: "Action Aventure");
+ string image = await DisplayPromptAsync("Informations sur le Jeu", "Image de couverture (préférez URL finissant par .png)", placeholder: "Take-Two Interactive");
}
}
\ No newline at end of file
diff --git a/GameAtlas/GameAtlas/Views/PageConnexion.xaml b/GameAtlas/GameAtlas/Views/PageConnexion.xaml
index 4a2286b..baf6968 100644
--- a/GameAtlas/GameAtlas/Views/PageConnexion.xaml
+++ b/GameAtlas/GameAtlas/Views/PageConnexion.xaml
@@ -45,15 +45,21 @@
Text="Mot de Passe oublié"
TextColor="#7392FF"
FontSize="13"
- FontFamily="PTSansNRegular"
- />
+ FontFamily="PTSansNRegular">
+
+
+
+
+ FontFamily="PTSansNBold">
+
+
+
+
diff --git a/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs b/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs
index 5d13115..1fae4f0 100644
--- a/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs
+++ b/GameAtlas/GameAtlas/Views/PageConnexion.xaml.cs
@@ -1,8 +1,14 @@
namespace GameAtlas.Views;
+
+using GameAtlas.Models;
+using System.Diagnostics;
using System.Text.RegularExpressions;
public partial class PageConnexion : ContentPage
{
+ public int compteur { get; set; } = 0;
+
+ public Manager ConnexionManager => (App.Current as App).MyManager;
public PageConnexion()
{
InitializeComponent();
@@ -21,7 +27,49 @@ public partial class PageConnexion : ContentPage
return;
}
+ Verification(username, password);
await Navigation.PushAsync(new PageAcceuil());
}
+
+ private async void OnInscrire_Tapped(object sender, EventArgs e)
+ {
+ await Navigation.PushAsync(new PageInscription());
+ }
+
+ private async void OnMotDePasseOublie_Tapped(object sender, EventArgs e)
+ {
+ await DisplayAlert("Oh non !", "Le mot de passe va te revenir à force", "Concentration");
+ await DisplayAlert("Oh non !", "Encore un petit effort !", "Concentration");
+
+ bool reponse = await DisplayAlert("Alors ?", "Tu l'as retrouvé ce mot de passe ?", "Oui", "Non");
+ if (!reponse)
+ {
+ await DisplayAlert("...", "Désolé on peut rien pour toi. La prochaine fois utilise un papier comme tout le monde.", "RIP");
+ }
+ else
+ {
+ await DisplayAlert("...", "C'est bien, la prochaine fois tu le notera.", "Ok");
+ }
+ }
+
+ public bool Verification(string username, string password)
+ {
+ foreach (Utilisateur user in ConnexionManager.Utilisateurs)
+ {
+ if (user.Pseudo == username)
+ {
+ Debug.WriteLine($"Pseudo \"{user.Pseudo}\" vérifié et valide");
+ if (user.Mdp == password)
+ {
+ Debug.WriteLine("Mot de Passe verifié et valide");
+ ConnexionManager.ConnectedUser = user;
+ return true;
+ }
+ }
+ }
+ Debug.WriteLine("La connection a echouée (pseudo ou mot de passe invalide)");
+ ConnexionManager.ConnectedUser = null;
+ return false;
+ }
}
\ No newline at end of file
diff --git a/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs b/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs
index 3127271..acef4df 100644
--- a/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs
+++ b/GameAtlas/GameAtlas/Views/PageJeu.xaml.cs
@@ -33,7 +33,10 @@ public partial class PageJeu : ContentPage
string action = await DisplayActionSheet("Choix de la liste:", "Annuler", null, "Mes Favoris", "Jeux Possédés", "Ma Wishlist");
Debug.WriteLine("Popup Action: " + action);
- //if (action == "")
+ if (action == "Mes Favoris")
+ {
+ JeuManager.ConnectedUser.ListeFavoris.Add(JeuModel);
+ }
}
diff --git a/GameAtlas/GameAtlas/Views/PageProfil.xaml b/GameAtlas/GameAtlas/Views/PageProfil.xaml
index 8a4e2b6..738fc73 100644
--- a/GameAtlas/GameAtlas/Views/PageProfil.xaml
+++ b/GameAtlas/GameAtlas/Views/PageProfil.xaml
@@ -32,7 +32,7 @@
-
+
@@ -66,7 +66,7 @@
-
+