From a2c3cc48b049a7706c0b0347e5475ee090856822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Sat, 18 May 2024 15:38:01 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9C=20Ajout=20de=20la=20documentat?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Trek-12/Models/Game/Game.cs | 35 ++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/source/Trek-12/Models/Game/Game.cs b/source/Trek-12/Models/Game/Game.cs index 82d1b0e..251a08a 100644 --- a/source/Trek-12/Models/Game/Game.cs +++ b/source/Trek-12/Models/Game/Game.cs @@ -9,6 +9,10 @@ using Models.Rules; namespace Models.Game { + /// + /// The Game class represents a game session in the application. + /// It contains all the necessary properties and methods to manage a game, including the game loop, dice rolling, and use of the game rules. + /// public class Game { private bool _isRunning; @@ -28,6 +32,11 @@ namespace Models.Game public event EventHandler GameEnded; + /// + /// Initializes a new instance of the class. + /// + /// The player who play the game. + /// The map to be used in the game. public Game(Player player, Map map) { _isRunning = false; @@ -39,6 +48,9 @@ namespace Models.Game GameRules = new Rules.Rules(); } + /// + /// Rolls all the dice. + /// public void RollAllDice() { Dice1.Roll(); @@ -80,6 +92,12 @@ namespace Models.Game } } + /// + /// Places the result of a dice operation into a chosen cell on the game board. + /// The result can be placed in the chosen cell if it's the first turn or if the chosen cell is valid according to the game rules. + /// + /// The cell chosen by the player to place the result. + /// The result of the dice operation to be placed in the cell. public void PlaceResult(Cell playerChoice, int result) { if (Turn == 1 || GameRules.NearCellIsValid(playerChoice, UsedMap.Boards)) @@ -92,9 +110,9 @@ namespace Models.Game { int index =0; - foreach (var cells in adjacentes) - { - // La cellule choisi peut creer/s'ajouter a un chemin de corde + foreach (var cells in adjacentes) + { + // La cellule choisi peut creer/s'ajouter a un chemin de corde if (cells.Value - playerChoice.Value == 1 || cells.Value - playerChoice.Value == -1) { // Le cas si il n'existe aucun chemin de corde @@ -127,7 +145,7 @@ namespace Models.Game // Ajouter au chemin // {playerChoice.Value} existe dans le chemin de corde pas possible - } + } } } @@ -142,18 +160,21 @@ namespace Models.Game GameLoop(); } - + /// + /// The main game loop that runs while the game is active. + /// private async void GameLoop() { while (_isRunning) { - + /* if (CheckGameEnd()) //TODO Règle pour check si fin de jeu { _isRunning = false; //TODO Code pour comptabiliser les points - GameEnded?.Invoke(this, new GameEndedEventArgs(//player)); + //GameEnded?.Invoke(this, new GameEndedEventArgs(player)); } + */ await Task.Delay(1000); // 1 seconde } From 742ad67a2d9993767000900f9beeb6a9578f30d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Sat, 18 May 2024 15:46:13 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Correction=20d'une?= =?UTF-8?q?=20petite=20incoh=C3=A9rence=20du=20doc=20deployer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 22f1c76..bae151c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -61,11 +61,11 @@ steps: image: hub.codefirst.iut.uca.fr/maxime.batista/codefirst-docdeployer:latest failure: ignore commands: - - /entrypoint.sh -l documentation/doxygen -t doxygen + - /entrypoint.sh -l doxygen -t doxygen when: branch: - master - dev event: - push - depends_on: [ build-Models, tests ] + depends_on: [ tests ]