Ajout de la liste de commentaire dans carte

master
Loris OBRY 2 years ago
parent 067a5ca9c5
commit 1d23609474

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection.Emit;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -25,7 +26,9 @@ namespace ConsoleApp
*/ */
Carte C = new Carte("Villageois", "Aucuns", "Doit voter inteligemment", null, "lien", "une carte peu apprécié mais necesaire"); Carte C = new Carte("Villageois", "Aucuns", "Doit voter inteligemment", null, "lien", "une carte peu apprécié mais necesaire");
Pack P = new Pack("Jeu de base", "C'est la premiere version du jeu", 5);
Console.WriteLine(C.Nom); Console.WriteLine(C.Nom);
Console.WriteLine(P.Nom);
} }
static void DisplayTab(string name, int[] tab) static void DisplayTab(string name, int[] tab)

@ -72,6 +72,7 @@ namespace Model
OnPropertyChanged(nameof(LienImage)); OnPropertyChanged(nameof(LienImage));
} }
} }
public IEnumerable<IContenu> ContenuList { get; set; }
private string lienImage; private string lienImage;
public Carte(string nom, string pouvoir, string strategie, int? note, string lienImage, string description) public Carte(string nom, string pouvoir, string strategie, int? note, string lienImage, string description)
{ {
@ -80,7 +81,8 @@ namespace Model
this.pouvoir = pouvoir; this.pouvoir = pouvoir;
this.strategie = strategie; this.strategie = strategie;
this.note = note; this.note = note;
this.lienImage = LienImage; this.lienImage = lienImage;
this.ContenuList = new List<IContenu>();
} }
} }
} }

@ -10,12 +10,10 @@ namespace Model
{ {
public string Texte { get; set; } public string Texte { get; set; }
public Utilisateur Proprietaire { get; set; } public Utilisateur Proprietaire { get; set; }
public IContenu ContenuCommente { get; set; } public Commentaire(string Texte, Utilisateur Proprietaire)
public Commentaire(string Texte, Utilisateur Proprietaire, IContenu ContenuCommente)
{ {
this.Texte = Texte; this.Texte = Texte;
this.Proprietaire = Proprietaire; this.Proprietaire = Proprietaire;
this.ContenuCommente = ContenuCommente;
} }
} }
} }

@ -0,0 +1,46 @@
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
{
public class Pack : IContenu, INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public string Nom { get; set; }
public string Description { get; set; }
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 Pack(string nom, string description, int? note)
{
Nom = nom;
Description = description;
Note = note;
}
}
}
Loading…
Cancel
Save