Modification de la classe Game

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 2e45059bda
commit 6e710a6fb1

@ -8,30 +8,70 @@ namespace Stim
{ {
internal class Game internal class Game
{ {
public string Name { get; set; } public string Name
public string Description { get; set; } {
public int Annee; get { return name; }
public string[] Tags = new string[3]; private set
public List<Review> reviews; {
if (value == "") return;
name = value;
}
}
private string name;
public Game(string name, string description, int annee, string[] tags) public string Description
{
get { return description; }
private set
{
if (value == "") return;
description = value;
}
}
private string description;
public int Year
{
get { return year; }
private set
{
if (value < 1950 || value > 2023) return ;
year = value;
}
}
private int year;
public string[] Tags;
private List<Review> Reviews;
public Game(string name, string description, int year, string[] tags)
{ {
Name = name; Name = name;
Description = description; Description = description;
Annee = annee; Year = year;
Tags = tags; Tags = tags;
reviews = new List<Review>(); Reviews = new List<Review>();
} }
public float GetAvgRate() public float GetAvgRate()
{ {
float sum = 0; float sum = 0;
foreach (Review review in reviews) foreach (Review review in Reviews)
{ {
sum += review.Rate; sum += review.Rate;
} }
return sum/reviews.Count; return sum/Reviews.Count;
}
public void AddReview(Review review)
{
Reviews.Add(review);
}
public void RemoveReview(Review review)
{
Reviews.Add(review);
} }
} }
} }

Loading…
Cancel
Save