|
|
@ -13,23 +13,23 @@ namespace Model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Die> listDice = new List<Die>(); //encapsulation des collections voir les videos partie 2
|
|
|
|
|
|
|
|
public ReadOnlyCollection<Die> ListDice { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReadOnlyCollection<NumberDie> ListDice { get; set; }
|
|
|
|
public Game(string name, List<Die> listDice)
|
|
|
|
private List<NumberDie> listDice = new List<NumberDie>(); //encapsulation des collections voir les videos partie 2
|
|
|
|
|
|
|
|
public Game(string name, List<NumberDie> listDice)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Name = name;
|
|
|
|
Name = name;
|
|
|
|
|
|
|
|
this.listDice.AddRange(listDice);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListDice=new ReadOnlyCollection<NumberDie>(this.listDice);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Game(string name, params Die[] numberDie1)
|
|
|
|
|
|
|
|
|
|
|
|
public Game(string name, params NumberDie[] listDice)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Name = name;
|
|
|
|
Name = name;
|
|
|
|
AddDice(numberDie1);
|
|
|
|
this.listDice.AddRange(listDice);
|
|
|
|
|
|
|
|
ListDice = new ReadOnlyCollection<NumberDie>(this.listDice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
public string Name
|
|
|
@ -51,7 +51,7 @@ namespace Model
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool AddDice(Die die)
|
|
|
|
public bool AddDice(NumberDie die)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (listDice.Contains(die))
|
|
|
|
if (listDice.Contains(die))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -61,18 +61,21 @@ namespace Model
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddDice(params Die[] die)
|
|
|
|
public IEnumerable<NumberDie> AddDices(params NumberDie[] die)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int i = 0; i < die.Length; i++)
|
|
|
|
List<NumberDie> result = new();
|
|
|
|
|
|
|
|
foreach(var i in die)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AddDice(die[i]);
|
|
|
|
if (AddDice(i))
|
|
|
|
}
|
|
|
|
{
|
|
|
|
|
|
|
|
result.Add(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<Die> GetDices()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return listDice;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|