diff --git a/Sources/Model/Dice/AbstractDie.cs b/Sources/Model/Dice/AbstractDie.cs index e9b6379..3d36f6c 100644 --- a/Sources/Model/Dice/AbstractDie.cs +++ b/Sources/Model/Dice/AbstractDie.cs @@ -9,14 +9,14 @@ namespace Model.Dice { public IEnumerable> ListFaces => listFaces; - private readonly List listFaces = new(); + private readonly List> listFaces = new(); - protected AbstractDie(params T[] faces) + protected AbstractDie(params AbstractDieFace[] faces) { listFaces.AddRange(faces); } - public T GetRandomFace() + public AbstractDieFace GetRandomFace() { int faceIndex = rnd.Next(0, ListFaces.Count()); return ListFaces.ElementAt(faceIndex); diff --git a/Sources/Model/Dice/ColorDie.cs b/Sources/Model/Dice/ColorDie.cs index b5f016b..d136db8 100644 --- a/Sources/Model/Dice/ColorDie.cs +++ b/Sources/Model/Dice/ColorDie.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; namespace Model.Dice { - public class ColorDie : AbstractDie + public class ColorDie : AbstractDie { public ColorDie(params ColorDieFace[] faces) : base(faces) { diff --git a/Sources/Model/Dice/DieManager.cs b/Sources/Model/Dice/DieManager.cs index b13fe37..704f200 100644 --- a/Sources/Model/Dice/DieManager.cs +++ b/Sources/Model/Dice/DieManager.cs @@ -5,30 +5,30 @@ using System.Linq; namespace Model.Dice { - public class DieManager : IManager,object>>>> + public class DieManager : IManager>>>> { - private readonly Dictionary,object>>> diceGroups = new(); + private readonly Dictionary>>> diceGroups = new(); - public KeyValuePair,object>>> Add(KeyValuePair,object>>> toAdd) + public KeyValuePair>>> Add(KeyValuePair>>> toAdd) { // on trim la clé d'abord diceGroups.Add(toAdd.Key.Trim(), toAdd.Value); return toAdd; } - public IEnumerable,object>>>> GetAll() + public IEnumerable>>>> GetAll() { return diceGroups.AsEnumerable(); } - public KeyValuePair,object>>> GetOneByName(string name) + public KeyValuePair>>> GetOneByName(string name) { // les groupes de dés nommés : // ils sont case-sensistive, mais "mon jeu" == "mon jeu " == " mon jeu" - return new KeyValuePair,object>>>(name, diceGroups[name]); + return new KeyValuePair>>>(name, diceGroups[name]); } - public void Remove(KeyValuePair,object>>> toRemove) + public void Remove(KeyValuePair>>> toRemove) { diceGroups.Remove(toRemove.Key); } @@ -43,7 +43,7 @@ namespace Model.Dice throw new NotImplementedException(); }*/ - public KeyValuePair,object>>> Update(KeyValuePair,object>>> before, KeyValuePair,object>>> after) + public KeyValuePair>>> Update(KeyValuePair>>> before, KeyValuePair>>> after) { // pas autorisé de changer les dés, juste le nom if (!before.Value.Equals(after.Value)) @@ -60,17 +60,17 @@ namespace Model.Dice return before; } - - IEnumerable, object>>>> IManager, object>>>>.GetAll() +/* + IEnumerable>>> IManager>>>>.GetAll() { throw new NotImplementedException(); } - KeyValuePair, object>>> IManager, object>>>>.GetOneByName(string name) + KeyValuePair>>> IManager>>>>.GetOneByName(string name) { throw new NotImplementedException(); } - +*/ } } diff --git a/Sources/Model/Dice/HomogeneousDice.cs b/Sources/Model/Dice/HomogeneousDice.cs index 4f6cdce..efe626e 100644 --- a/Sources/Model/Dice/HomogeneousDice.cs +++ b/Sources/Model/Dice/HomogeneousDice.cs @@ -7,9 +7,9 @@ using Model.Dice.Faces; namespace Model.Dice { - public class HomogeneousDice: AbstractDie,object> + public class HomogeneousDice: AbstractDie { - public HomogeneousDice(params AbstractDieFace[] faces) : base(faces) + public HomogeneousDice(params AbstractDieFace[] faces) : base(faces) { } diff --git a/Sources/Model/Dice/ImageDie.cs b/Sources/Model/Dice/ImageDie.cs index bf97ab4..3a17e44 100644 --- a/Sources/Model/Dice/ImageDie.cs +++ b/Sources/Model/Dice/ImageDie.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Model.Dice { - public class ImageDie : HomogeneousDice + public class ImageDie : HomogeneousDice { public ImageDie(params ImageDieFace[] faces) : base(faces) { diff --git a/Sources/Model/Dice/NumberDie.cs b/Sources/Model/Dice/NumberDie.cs index 6b2379e..556ee2d 100644 --- a/Sources/Model/Dice/NumberDie.cs +++ b/Sources/Model/Dice/NumberDie.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Model.Dice { - public class NumberDie : HomogeneousDice + public class NumberDie : HomogeneousDice { public NumberDie(params NumberDieFace[] faces) : base(faces) { diff --git a/Sources/Model/Games/Game.cs b/Sources/Model/Games/Game.cs index 303ae07..6b9a85b 100644 --- a/Sources/Model/Games/Game.cs +++ b/Sources/Model/Games/Game.cs @@ -57,8 +57,8 @@ namespace Model.Games /// /// the group of dice used for this game /// - public IEnumerable,object>> Dice => dice; - private readonly IEnumerable, object>> dice; + public IEnumerable>> Dice => dice; + private readonly IEnumerable>> dice; /// /// constructs a Game with its own history of Turns. @@ -68,7 +68,7 @@ namespace Model.Games /// the turns that have been done so far /// the game's player manager, doing CRUD on players and switching whose turn it is /// the group of dice used for this game - public Game(string name, IManager playerManager, IEnumerable, object>> dice, IEnumerable turns) + public Game(string name, IManager playerManager, IEnumerable>> dice, IEnumerable turns) { Name = name; PlayerManager = playerManager; @@ -83,7 +83,7 @@ namespace Model.Games /// the name of the game 😎 /// the game's player manager, doing CRUD on players and switching whose turn it is /// the group of dice used for this game - public Game(string name, IManager playerManager, IEnumerable, object>> dice) + public Game(string name, IManager playerManager, IEnumerable>> dice) : this(name, playerManager, dice, null) { } @@ -161,10 +161,10 @@ namespace Model.Games /// throws all the Dice in FavGroup and returns a list of their Faces /// /// list of AbstractDieFaces after a throw - private Dictionary, AbstractDieFace> ThrowAll() + private Dictionary>, AbstractDieFace> ThrowAll() { - Dictionary, AbstractDieFace> faces = new(); - foreach (AbstractDie die in dice) + Dictionary>, AbstractDieFace> faces = new(); + foreach (AbstractDie> die in dice) { faces.Add(die, die.GetRandomFace()); }