From 0593649450aef2b0d1ec05d546fef5e18e43aca4 Mon Sep 17 00:00:00 2001 From: Lucas DUFLOT Date: Sat, 13 Apr 2024 09:48:50 +0200 Subject: [PATCH] Modification de Game.cs --- source/Trek-12/Models/Game/Game.cs | 27 ++++++++++++++++++++- source/Trek-12/Models/Game/Map.cs | 22 ++++++++--------- source/Trek-12/Models/Game/Player.cs | 30 ++++++++++++------------ source/Trek-12/Models/Game/RopesZones.cs | 14 +++++++++++ 4 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 source/Trek-12/Models/Game/RopesZones.cs diff --git a/source/Trek-12/Models/Game/Game.cs b/source/Trek-12/Models/Game/Game.cs index 606d263..fe00778 100644 --- a/source/Trek-12/Models/Game/Game.cs +++ b/source/Trek-12/Models/Game/Game.cs @@ -17,6 +17,8 @@ namespace Models.Game public int Turn { get; set; } + public Rules.Rules rules { get; set; } + public Game(Player player,Map map) { @@ -25,6 +27,7 @@ namespace Models.Game De1 = new De(); De2 = new De(1); Turn = 0; + rules = new Rules.Rules(); } public void ThrowDice() @@ -33,7 +36,7 @@ namespace Models.Game De2.Lancer(); } - public int ChooseOperation(Operation o) + public int ResultOperation(Operation o) { switch (o) { @@ -67,5 +70,27 @@ namespace Models.Game return 0; } } + + public void PlaceResult (Cell playerChoice,int result) + { + if (Turn == 1) + { + playerChoice.Value = result; + } + else + { + if(rules.NearCell(playerChoice,NameMap.Cells)) + { + playerChoice.Value = result; + } + } + return; + } + + public void AddRopeZone(Cell playerChoice,RopesZones list) + { + + } + } } diff --git a/source/Trek-12/Models/Game/Map.cs b/source/Trek-12/Models/Game/Map.cs index e51349d..7370f01 100644 --- a/source/Trek-12/Models/Game/Map.cs +++ b/source/Trek-12/Models/Game/Map.cs @@ -1,14 +1,14 @@ -namespace Models.Game; - -public class Map -{ +namespace Models.Game; + +public class Map +{ public List Cells { get; private set; } - public string Background { get; private set; } - - public Map(List cells, string background) - { - Cells = cells; - Background = background; - } + public string Background { get; private set; } + + public Map(List cells, string background) + { + Cells = cells; + Background = background; + } } \ No newline at end of file diff --git a/source/Trek-12/Models/Game/Player.cs b/source/Trek-12/Models/Game/Player.cs index 60d6a08..990d767 100644 --- a/source/Trek-12/Models/Game/Player.cs +++ b/source/Trek-12/Models/Game/Player.cs @@ -1,28 +1,28 @@ -namespace Models.Game; - -public class Player -{ +namespace Models.Game; + +public class Player +{ public string Pseudo { get; private set; } - public string ProfilePicture { get; private set; } - - public Player() - { - Pseudo = "Player"; - ProfilePicture = "DefaultProfilePicture"; + public string ProfilePicture { get; private set; } + + public Player() + { + Pseudo = "Player"; + ProfilePicture = "DefaultProfilePicture"; } - public Player(string pseudo, string profilePicture = "DefaultProfilePicture") - { - Pseudo = pseudo; - ProfilePicture = profilePicture; + public Player(string pseudo, string profilePicture = "DefaultProfilePicture") + { + Pseudo = pseudo; + ProfilePicture = profilePicture; } public Operation ChooseOperation() { - return Operation.LOWER + return Operation.LOWER; } } \ No newline at end of file diff --git a/source/Trek-12/Models/Game/RopesZones.cs b/source/Trek-12/Models/Game/RopesZones.cs new file mode 100644 index 0000000..1174b0b --- /dev/null +++ b/source/Trek-12/Models/Game/RopesZones.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Models.Game +{ + public class RopesZones + { + public List>? RopeZone { get; set; } + + } +}