Format code et ajout de l'interface repository #3
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@@ -0,0 +1,10 @@
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*.cs]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
charset = utf-8
|
||||
|
||||
[Src/HexagonalLib/**]
|
||||
generated_code = true
|
||||
@@ -1,18 +1,14 @@
|
||||
namespace Giants.Application;
|
||||
|
||||
using Giants.Core.Interfaces;
|
||||
using Giants.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Une application Giants permettant l'instanciations des services, utilisé pour une console
|
||||
/// ou autre archi sans injections de dependances
|
||||
/// /// </summary>
|
||||
/// </summary>
|
||||
public class GiantApplication
|
||||
{
|
||||
|
||||
/// <summary> Constructeur de base </summary>
|
||||
public GiantApplication()
|
||||
{
|
||||
IHexagonalGrid grid = new HexagonalGridImpl();
|
||||
}
|
||||
}
|
||||
31
Src/Giants.Application/Src/MatchRepositoryMock.cs
Normal file
31
Src/Giants.Application/Src/MatchRepositoryMock.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Giants.Core.Interfaces;
|
||||
using Giants.Core;
|
||||
using Giants.Infrastructure;
|
||||
|
||||
namespace Giants.Application;
|
||||
|
||||
/// <summary>
|
||||
/// Implementation temporaire du repository de match
|
||||
/// </summary>
|
||||
public class MatchRepositoryMock : IMatchRepository
|
||||
{
|
||||
private readonly IHexagonalGrid _gridLayout;
|
||||
|
||||
/// <summary>
|
||||
/// constructeur
|
||||
/// </summary>
|
||||
public MatchRepositoryMock()
|
||||
{
|
||||
_gridLayout = new HexagonalGridImpl();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Match? GetMatch(int matchId)
|
||||
{
|
||||
Match result = new Match(_gridLayout);
|
||||
|
||||
// Ajout des données statiques
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Giants.Core.Interfaces;
|
||||
|
||||
namespace Giants.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Il s'agit d'une instance d'une partie de Giants, c'est la racine de toutes les entitées de l'instance
|
||||
/// /// </summary>
|
||||
/// l'objectif de cette classe est de pouvoir etre copiée tres rapidement avec la plus petite utilisation mémoire
|
||||
/// Il faut également que la comparaison soit rapide et intelligente pour les besoins de l'IA
|
||||
/// </summary>
|
||||
public class Match
|
||||
{
|
||||
#region données statiques
|
||||
@@ -20,4 +23,18 @@ public class Match
|
||||
{
|
||||
_grid = grid;
|
||||
}
|
||||
|
||||
/// <summary> Permet de comparer des Match, cette methode est critique pour l'ia pour reduire son parcour d'arbre </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns> <summary>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,5 @@ namespace Giants.Core.Interfaces;
|
||||
/// </summary>
|
||||
public interface IHexagonalGrid
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
14
Src/Giants.Core/Src/Interfaces/IMatchRepository.cs
Normal file
14
Src/Giants.Core/Src/Interfaces/IMatchRepository.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Giants.Core.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Interface de tout fournisseur de match, ils sont responsable d'instancier les match a partir d'un ID ou d'en créer des nouveaux
|
||||
/// </summary>
|
||||
public interface IMatchRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Récupérer un match a patir de son ID,
|
||||
/// </summary>
|
||||
/// <param name="matchId">L'id unique du match a récupérer</param>
|
||||
/// <returns>le match s'il existe ou null dans le cas contraire</returns>
|
||||
Match? GetMatch(int matchId);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Giants.Core;
|
||||
namespace Giants.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Represente l'organisation d'un plateau, il ne contient aucune informations liées a une partie mais il permet
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<RootNamespace>HexagonalLib</RootNamespace>
|
||||
<TargetFrameworks>net472;net48;netcoreapp3.1</TargetFrameworks>
|
||||
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Title>HexagonalLib</Title>
|
||||
<Authors>Ivan Murashka</Authors>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Giants.Core.Tests;
|
||||
namespace Giants.Core.Tests;
|
||||
|
||||
using Giants.Application;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user