diff --git a/Sources/ConsoleApp/FileName.cs b/Sources/ConsoleApp/FileName.cs index 154ab78..680c8f0 100644 --- a/Sources/ConsoleApp/FileName.cs +++ b/Sources/ConsoleApp/FileName.cs @@ -1,7 +1,8 @@ -using Model; +using Model.Classes; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection.Emit; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; @@ -21,7 +22,16 @@ namespace ConsoleApp Carte loup_garou = new Carte("Loup-Garou", "Il peut se reveiller chaque nuit pour voter avec les autres de son clan qui ils vont manger", "Il doit se faire passer pour un role du village, voter pour un de ses compagnons pour gagner la confiance peut etre un moyen", 4, "loup-garou", "Le loup-garou est un rôle très appréciable à jouer"); +<<<<<<< HEAD Carte voyante = new Carte("Voyante", "La voyante est capable de voir le role d'un joueur, et ce, chaque nuit", "Elle ne doit pas se faire découvrir, surtout en debut de partie, donner des indices subtiles sans braquer tout les soupçons des loup-garou vers vous est l'objectif", 4, "villageois", "Une carte tres interessante et difficile a la fois, ce role emmene souvent à faire des sacrifices"); +======= + Utilisateur Kylian = new("Kyky", "12345", null); + Carte C = new("Villageois", "Aucuns", "Doit voter inteligemment", null, "lien", "une carte peu apprécié mais necesaire"); + C.commentaires.Add(new Commentaire("Cette carte est la base du jeu, cool pour les debutants", Kylian )); + Pack P = new Pack("Jeu de base", "C'est la premiere version du jeu", 5); + Console.WriteLine(P.Nom); + Console.WriteLine(C.commentaires[0]); +>>>>>>> 0a7ee831209150d57559f3fd788a747cf8001bf5 string relativePath = "..\\..\\..\\Persistance"; diff --git a/Sources/MauiApp1/MainPage.xaml.cs b/Sources/MauiApp1/MainPage.xaml.cs index f1a8dc4..b732139 100644 --- a/Sources/MauiApp1/MainPage.xaml.cs +++ b/Sources/MauiApp1/MainPage.xaml.cs @@ -1,4 +1,4 @@ -using Model; +using Model.Classes; using System.Diagnostics; namespace MauiApp1; diff --git a/Sources/Model/Classes/Camp.cs b/Sources/Model/Classes/Camp.cs new file mode 100644 index 0000000..246f4c8 --- /dev/null +++ b/Sources/Model/Classes/Camp.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Classes +{ + public class Camp + { + public string Nom { get; set; } + public string Description { get; set; } + public string LienImage { get; set; } + public List Cartes { get; set; } + public Camp(string Nom, string Description, string LienImage) + { + this.Nom = Nom; + this.Description = Description; + this.LienImage = LienImage; + Cartes = new List(); + } + } +} diff --git a/Sources/Model/Carte.cs b/Sources/Model/Classes/Carte.cs similarity index 83% rename from Sources/Model/Carte.cs rename to Sources/Model/Classes/Carte.cs index eb29c17..515e51c 100644 --- a/Sources/Model/Carte.cs +++ b/Sources/Model/Classes/Carte.cs @@ -9,13 +9,13 @@ using System.Runtime.CompilerServices; using System.Net.Http.Headers; using System.Runtime.Serialization; -namespace Model +namespace Model.Classes { [DataContract(Name = "carte")] public class Carte : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; - void OnPropertyChanged([CallerMemberName] string ?propertyName = null) + void OnPropertyChanged([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } @@ -32,10 +32,11 @@ namespace Model [DataMember] public string Description { get => description; - set { + set + { description = value; OnPropertyChanged(nameof(Description)); - } + } } private string description; [DataMember] @@ -88,10 +89,20 @@ namespace Model OnPropertyChanged(nameof(LienImage)); } } + public List commentaires; + public List Commentaires + { + get => commentaires; + set + { + commentaires = value; + OnPropertyChanged(nameof(Commentaires)); + } + } private string lienImage; public Carte(string nom, string pouvoir, string strategie, int? note, string lienImage, string description) { - this.nom = nom; + Nom = nom; this.description = description; this.pouvoir = pouvoir; this.strategie = strategie; @@ -113,6 +124,7 @@ namespace Model public bool Equals(Carte other) { return (this.nom == other.nom); + commentaires = new List(); } } } diff --git a/Sources/Model/Classes/Commentaire.cs b/Sources/Model/Classes/Commentaire.cs new file mode 100644 index 0000000..6ae2d3a --- /dev/null +++ b/Sources/Model/Classes/Commentaire.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Classes +{ + public class Commentaire + { + public string Texte { get; set; } + public Utilisateur Proprietaire { get; set; } + public Commentaire(string Texte, Utilisateur Proprietaire) + { + this.Texte = Texte; + this.Proprietaire = Proprietaire; + } + } +} diff --git a/Sources/Model/Classes/IContenu.cs b/Sources/Model/Classes/IContenu.cs new file mode 100644 index 0000000..02ae49a --- /dev/null +++ b/Sources/Model/Classes/IContenu.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Model.Classes +{ + public interface IContenu + { + public string Nom { get; set; } + public string Description { get; set; } + public int? Note { get; set; } + } +} diff --git a/Sources/Model/IDataManager.cs b/Sources/Model/Classes/IDataManager.cs similarity index 90% rename from Sources/Model/IDataManager.cs rename to Sources/Model/Classes/IDataManager.cs index 36847a2..77cd68b 100644 --- a/Sources/Model/IDataManager.cs +++ b/Sources/Model/Classes/IDataManager.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Model +namespace Model.Classes { public interface IDataManager { diff --git a/Sources/Model/Manager.cs b/Sources/Model/Classes/Manager.cs similarity index 90% rename from Sources/Model/Manager.cs rename to Sources/Model/Classes/Manager.cs index b5b8311..104634e 100644 --- a/Sources/Model/Manager.cs +++ b/Sources/Model/Classes/Manager.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using System.Collections.ObjectModel; using System.Data; -namespace Model +namespace Model.Classes { public class Manager : IDataManager { @@ -16,7 +16,7 @@ namespace Model private IDataManager DataMgr { get; set; } public Manager(IDataManager dataManager) { - DataMgr = dataManager; + DataMgr = dataManager; Cartes = new(cartes); } public bool AddCarte(Carte carte) @@ -26,7 +26,7 @@ namespace Model if (cartes.Contains(carte)) return false; cartes.Add(carte); - DataMgr.AddCarte(carte); + DataMgr.AddCarte(carte); return true; } diff --git a/Sources/Model/Classes/Pack.cs b/Sources/Model/Classes/Pack.cs new file mode 100644 index 0000000..d6da655 --- /dev/null +++ b/Sources/Model/Classes/Pack.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Model.Classes +{ + public class Pack : IContenu, INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + void OnPropertyChanged([CallerMemberName] string? propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + public string nom; + public string Nom + { + get => nom; + set + { + nom = value; + OnPropertyChanged(nameof(Nom)); + } + } + public string description; + public string Description + { + get => description; + set + { + nom = value; + OnPropertyChanged(nameof(Description)); + } + } + private int? note; + public int? Note + { + get + { + return note; + } + set + { + if (value < 0 || value > 10) + { + throw new ArgumentOutOfRangeException(nameof(value), "La valeur de la note doit être comprise entre 0 et 10."); + } + note = value; + OnPropertyChanged(nameof(Note)); + } + } + public List commentaires; + public List Commentaires + { + get => commentaires; + set + { + commentaires = value; + OnPropertyChanged(nameof(Commentaires)); + } + } + public Pack(string nom, string description, int? note) + { + this.nom = nom; + this.description = description; + this.note = note; + commentaires = new List(); + } + } +} diff --git a/Sources/Model/Utilisateur.cs b/Sources/Model/Classes/Utilisateur.cs similarity index 94% rename from Sources/Model/Utilisateur.cs rename to Sources/Model/Classes/Utilisateur.cs index b9d602e..7947e38 100644 --- a/Sources/Model/Utilisateur.cs +++ b/Sources/Model/Classes/Utilisateur.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using System.ComponentModel; using System.Runtime.CompilerServices; -namespace Model +namespace Model.Classes { public class Utilisateur : INotifyPropertyChanged {