diff --git a/src/LittleTown.Api/LittleTown.Api.csproj.user b/src/LittleTown.Api/LittleTown.Api.csproj.user new file mode 100644 index 0000000..9ff5820 --- /dev/null +++ b/src/LittleTown.Api/LittleTown.Api.csproj.user @@ -0,0 +1,6 @@ + + + + https + + \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor new file mode 100644 index 0000000..4f2fe10 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor @@ -0,0 +1,68 @@ +
+
+ @foreach (var row in MatchViewModel.Rows) + { +
+ @foreach (var cell in row) + { + @cell + } +
+ } +
+ +
+ diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor.cs new file mode 100644 index 0000000..3e0b5e2 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor.cs @@ -0,0 +1,11 @@ +using LittleTown.Blazor.Client.ViewModels; +using Microsoft.AspNetCore.Components; + +namespace LittleTown.Blazor.Client.Components +{ + public partial class MatchBoard + { + [Parameter, EditorRequired] + public MatchViewModel MatchViewModel { get; init; } + } +} \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor.css b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor.css new file mode 100644 index 0000000..d0b2683 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Components/MatchBoard.razor.css @@ -0,0 +1,110 @@ +.board { + display: flex; + flex-direction: column; + width: 100%; + height: 100%; +} +.terrain { + width: 100%; + background-color: red; + box-sizing: border-box; +} + +.terrain-row { + display: grid; + grid-auto-flow: column; + grid-auto-columns: 1fr; /* toutes les cellules même largeur */ +} + +.terrain-cell { + aspect-ratio: 1 / 1; /* largeur = hauteur */ + display: flex; + align-items: center; + justify-content: center; + border: 1px solid black; +} +.footer { + width: 100%; + background-color: gray; + display: flex; + flex-direction: column; + +} + +.topScore { + flex: 1; + display: flex; + flex-direction: row; +} + +.bottomScore { + flex: 1; + display: flex; + flex-direction: row; +} + +.centerFooter{ + flex:5; + display: flex; + flex-direction:row; +} +.scoreItem { + flex: 1; + border: 1px solid; + aspect-ratio: 1 / 1; +} +.leftScore { + flex:1; + display:flex; + flex-direction:column; +} + +.rightScore { + flex: 1; + display: flex; + flex-direction: column; +} + +.infos { + flex:23; + display: flex; + flex-wrap:wrap; +} + +.building { + height: 100%; + aspect-ratio: 1 / 1; + flex: 0 0 auto; + background: lightblue; + border: 1px solid black; +} + +.turns { + flex: 1; + display: flex; + flex-direction: row; +} + +.turn { + flex: 1; +} + +.infos-row{ + height:50%; + width:100%; + background-color:blue; + display:flex; + flex-direction:row; +} + +.construction { + flex:1; +} + +.fields { + height: 100%; + aspect-ratio: 1 / 1; /* largeur = hauteur */ + flex: 0 0 auto; + background: lightblue; + border: 1px solid black; +} \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/LittleTown.Blazor.Client.csproj b/src/LittleTown.Blazor/LittleTown.Blazor.Client/LittleTown.Blazor.Client.csproj index 395d0ea..718a8a4 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor.Client/LittleTown.Blazor.Client.csproj +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/LittleTown.Blazor.Client.csproj @@ -13,4 +13,9 @@ + + + + + diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor new file mode 100644 index 0000000..748cb9c --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor @@ -0,0 +1,8 @@ +@page "/match" +@rendermode InteractiveAuto + +Match +
+ +
+ diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor.cs new file mode 100644 index 0000000..2a85ea7 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor.cs @@ -0,0 +1,16 @@ +using LittleTown.Blazor.Client.Services; +using LittleTown.Blazor.Client.ViewModels; +using Microsoft.AspNetCore.Components; + +namespace LittleTown.Blazor.Client.Pages; + +public partial class Match(IMatchService matchServices) +{ + public MatchViewModel MatchViewModel { get; private set; } + + public override Task SetParametersAsync(ParameterView parameters) + { + MatchViewModel = new MatchViewModel(matchServices.GetMatch()); + return base.SetParametersAsync(parameters); + } +} diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor.css b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor.css new file mode 100644 index 0000000..807e113 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Pages/Match.razor.css @@ -0,0 +1,4 @@ +.board { + width: 100%; + height: 50vh; +} diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Program.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Program.cs index 519269f..4ff4b5b 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Program.cs +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Program.cs @@ -1,5 +1,12 @@ +using LittleTown.Blazor.Client.Services; +using LittleTown.Core.Ports; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; var builder = WebAssemblyHostBuilder.CreateDefault(args); +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); + +builder.Services.AddScoped(); +builder.Services.AddScoped(); + await builder.Build().RunAsync(); diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/IMatchService.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/IMatchService.cs new file mode 100644 index 0000000..cb45412 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/IMatchService.cs @@ -0,0 +1,13 @@ +using LittleTown.Core; + +namespace LittleTown.Blazor.Client.Services +{ + public interface IMatchService + { + /// + /// Temporaire, recupere l'instance d'un match par défaut + /// + /// + Match GetMatch(); + } +} diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/MatchService.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/MatchService.cs new file mode 100644 index 0000000..159adad --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/MatchService.cs @@ -0,0 +1,26 @@ +using LittleTown.Core; +using LittleTown.Core.Ports; + +namespace LittleTown.Blazor.Client.Services +{ + public class MatchService : IMatchService + { + private readonly IStaticDataGetter _staticDataGetter; + private Match? _currentMatch; + + public MatchService(IStaticDataGetter staticDataGetter) + { + _staticDataGetter = staticDataGetter; + } + + /// > + public Match GetMatch() + { + if (null == _currentMatch) + { + _currentMatch = new Match(_staticDataGetter); + } + return _currentMatch; + } + } +} diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/WasmStaticDataGetter.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/WasmStaticDataGetter.cs new file mode 100644 index 0000000..9f113a4 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/Services/WasmStaticDataGetter.cs @@ -0,0 +1,65 @@ +using System.Net.Http.Json; +using System.Text.Json; +using LittleTown.Core; +using LittleTown.Core.Ports; + +namespace LittleTown.Blazor.Client.Services; + +/// +/// Implementation du getter de données static pour WebAssembly via HttpClient +/// +public class WasmStaticDataGetter : IStaticDataGetter +{ + private readonly HttpClient _httpClient; + private string _boardData = ""; + private string _buildingData = ""; + private string _objectivesData = ""; + private bool _isInitialized = false; + + public WasmStaticDataGetter(HttpClient httpClient) + { + _httpClient = httpClient; + } + + private async Task InitializeAsync() + { + if (_isInitialized) return; + + _boardData = await _httpClient.GetStringAsync("data/Board1.json"); + _buildingData = await _httpClient.GetStringAsync("data/Buildings.json"); + _objectivesData = await _httpClient.GetStringAsync("data/Objectives.json"); + + _isInitialized = true; + } + + /// + public Board GetBoard(int version) + { + // Synchronous wrapper - not ideal but matches interface + InitializeAsync().GetAwaiter().GetResult(); + + Board board = JsonSerializer.Deserialize(_boardData) + ?? throw new JsonException("Cannot deserialize Board"); + return board; + } + + /// + public ICollection GetBuildings() + { + InitializeAsync().GetAwaiter().GetResult(); + + List buildings = JsonSerializer.Deserialize>(_buildingData) + ?? throw new JsonException("Cannot deserialize Buildings"); + return buildings; + } + + /// + public ICollection GetObjectives() + { + InitializeAsync().GetAwaiter().GetResult(); + + List objectives = JsonSerializer.Deserialize>(_objectivesData) + ?? throw new JsonException("Cannot deserialize Objectives"); + return objectives; + } +} diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/ViewModels/MatchViewModel.cs b/src/LittleTown.Blazor/LittleTown.Blazor.Client/ViewModels/MatchViewModel.cs new file mode 100644 index 0000000..bca9254 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/ViewModels/MatchViewModel.cs @@ -0,0 +1,19 @@ +using LittleTown.Core; + +namespace LittleTown.Blazor.Client.ViewModels; + +public class MatchViewModel(Match match) +{ + public List> Rows + { + get + { + List> rows = new List>(); + for(int i = 0; i < 6; i++) + { + rows.Add(Enumerable.Range(i * 6, 9).ToList()); + } + return rows; + } + } +} \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/_Imports.razor b/src/LittleTown.Blazor/LittleTown.Blazor.Client/_Imports.razor index 4ab9008..8a36732 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor.Client/_Imports.razor +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/_Imports.razor @@ -1,4 +1,4 @@ -@using System.Net.Http +@using System.Net.Http @using System.Net.Http.Json @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @@ -7,3 +7,5 @@ @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop @using LittleTown.Blazor.Client +@using LittleTown.Blazor.Client.Components +@using LittleTown.StaticDataAcces; diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Board1.json b/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Board1.json new file mode 100644 index 0000000..169a768 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Board1.json @@ -0,0 +1,276 @@ +{ + "Width": 9, + "Height": 6, + "Tiles": [ + { + "ResourceType": "None", + "PosX": 0, + "PosY": 0 + }, + { + "ResourceType": "Wood", + "PosX": 1, + "PosY": 0 + }, + { + "ResourceType": "Wood", + "PosX": 2, + "PosY": 0 + }, + { + "ResourceType": "None", + "PosX": 3, + "PosY": 0 + }, + { + "ResourceType": "Fish", + "PosX": 4, + "PosY": 0 + }, + { + "ResourceType": "Fish", + "PosX": 5, + "PosY": 0 + }, + { + "ResourceType": "None", + "PosX": 6, + "PosY": 0 + }, + { + "ResourceType": "None", + "PosX": 7, + "PosY": 0 + }, + { + "ResourceType": "Wood", + "PosX": 8, + "PosY": 0 + }, + { + "ResourceType": "None", + "PosX": 0, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 1, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 2, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 3, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 4, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 5, + "PosY": 1 + }, + { + "ResourceType": "Wood", + "PosX": 6, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 7, + "PosY": 1 + }, + { + "ResourceType": "None", + "PosX": 8, + "PosY": 1 + }, + { + "ResourceType": "Wood", + "PosX": 0, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 1, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 2, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 3, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 4, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 5, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 6, + "PosY": 2 + }, + { + "ResourceType": "None", + "PosX": 7, + "PosY": 2 + }, + { + "ResourceType": "Fish", + "PosX": 8, + "PosY": 2 + }, + { + "ResourceType": "Fish", + "PosX": 0, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 1, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 2, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 3, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 4, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 5, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 6, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 7, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 8, + "PosY": 3 + }, + { + "ResourceType": "None", + "PosX": 0, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 1, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 2, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 3, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 4, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 5, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 6, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 7, + "PosY": 4 + }, + { + "ResourceType": "None", + "PosX": 8, + "PosY": 4 + }, + { + "ResourceType": "Rock", + "PosX": 0, + "PosY": 5 + }, + { + "ResourceType": "None", + "PosX": 1, + "PosY": 5 + }, + { + "ResourceType": "Wood", + "PosX": 2, + "PosY": 5 + }, + { + "ResourceType": "Rock", + "PosX": 3, + "PosY": 5 + }, + { + "ResourceType": "None", + "PosX": 4, + "PosY": 5 + }, + { + "ResourceType": "Fish", + "PosX": 5, + "PosY": 5 + }, + { + "ResourceType": "None", + "PosX": 6, + "PosY": 5 + }, + { + "ResourceType": "Rock", + "PosX": 7, + "PosY": 5 + }, + { + "ResourceType": "Rock", + "PosX": 8, + "PosY": 5 + } + ] +} \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Buildings.json b/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Buildings.json new file mode 100644 index 0000000..cf7dd73 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Buildings.json @@ -0,0 +1,183 @@ +[ + { + "Name": "Atelier", + "Price": { + "Rock": 2 + }, + "BeginnerBuilding": true + }, + { + "Name": "Bar", + "Price": { + "Rock": 2, + "Cereal": 2 + }, + "BeginnerBuilding": false + }, + { + "Name": "Boulangerie", + "Price": { + "Wood": 2 + }, + "BeginnerBuilding": true + }, + { + "Name": "Brasserie", + "Price": { + "Wood": 2 + }, + "BeginnerBuilding": false + }, + { + "Name": "Carriere", + "Price": { + "Wood": 3 + }, + "BeginnerBuilding": true + }, + { + "Name": "Champsdeble", + "Price": { + "Wood": 1 + }, + "BeginnerBuilding": false + }, + { + "Name": "Charpentier", + "Price": { + "Wood": 2 + }, + "BeginnerBuilding": false + }, + { + "Name": "Epicerie", + "Price": { + "Wood": 2 + }, + "BeginnerBuilding": true + }, + { + "Name": "Entrepot", + "Price": { + "Rock": 4 + }, + "BeginnerBuilding": true + }, + { + "Name": "Eglise", + "Price": { + "Rock": 4 + }, + "BeginnerBuilding": true + }, + { + "Name": "Foire", + "Price": { + "Wood": 4 + }, + "BeginnerBuilding": false + }, + { + "Name": "Fontaine", + "Price": { + "Rock": 2 + }, + "BeginnerBuilding": false + }, + { + "Name": "Grenier", + "Price": { + "Wood": 4 + }, + "BeginnerBuilding": true + }, + { + "Name": "Librairie", + "Price": { + "Rock": 4 + }, + "BeginnerBuilding": false + }, + { + "Name": "minedor", + "Price": { + "Wood": 1, + "Rock": 1 + }, + "BeginnerBuilding": true + }, + { + "Name": "poissonnier", + "Price": { + "Wood": 1, + "Rock": 1 + }, + "BeginnerBuilding": false + }, + { + "Name": "Ponton", + "Price": { + "Wood": 3 + }, + "BeginnerBuilding": false + }, + { + "Name": "Preteursurgage", + "Price": { + "Wood": 3 + }, + "BeginnerBuilding": true + }, + { + "Name": "puits", + "Price": { + "Wood": 1, + "Rock": 1 + }, + "BeginnerBuilding": true + }, + { + "Name": "Restaurant", + "Price": { + "Wood": 2, + "Rock": 2 + }, + "BeginnerBuilding": false + }, + { + "Name": "Statue", + "Price": { + "Rock": 4 + }, + "BeginnerBuilding": true + }, + { + "Name": "Cathedrale", + "Price": { + "Rock": 6 + }, + "BeginnerBuilding": false + }, + { + "Name": "Residence", + "Price": { + "Piece": 6 + }, + "BeginnerBuilding": false + }, + { + "Name": "Chateau", + "Price": { + "Rock": 6 + }, + "BeginnerBuilding": true + }, + { + "Name": "Tourdegarde", + "Price": { + "Wood": 3, + "Rock": 3 + }, + "BeginnerBuilding": false + } +] \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Objectives.json b/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Objectives.json new file mode 100644 index 0000000..ed666ae --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor.Client/wwwroot/data/Objectives.json @@ -0,0 +1,92 @@ +[ + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 2 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + }, + { + "Description": "desc", + "Formula": "formula", + "Points": 3 + } +] \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor/Components/App.razor b/src/LittleTown.Blazor/LittleTown.Blazor/Components/App.razor index 3c60050..1dca10f 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor/Components/App.razor +++ b/src/LittleTown.Blazor/LittleTown.Blazor/Components/App.razor @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ + diff --git a/src/LittleTown.Blazor/LittleTown.Blazor/Components/Layout/NavMenu.razor b/src/LittleTown.Blazor/LittleTown.Blazor/Components/Layout/NavMenu.razor index 575db83..f7fb51b 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor/Components/Layout/NavMenu.razor +++ b/src/LittleTown.Blazor/LittleTown.Blazor/Components/Layout/NavMenu.razor @@ -19,5 +19,10 @@ Counter + \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj b/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj index 936fa75..03296df 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj +++ b/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj @@ -12,4 +12,9 @@ + + + + + diff --git a/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj.user b/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj.user new file mode 100644 index 0000000..9ff5820 --- /dev/null +++ b/src/LittleTown.Blazor/LittleTown.Blazor/LittleTown.Blazor.csproj.user @@ -0,0 +1,6 @@ + + + + https + + \ No newline at end of file diff --git a/src/LittleTown.Blazor/LittleTown.Blazor/Program.cs b/src/LittleTown.Blazor/LittleTown.Blazor/Program.cs index 5b44698..b94ea23 100644 --- a/src/LittleTown.Blazor/LittleTown.Blazor/Program.cs +++ b/src/LittleTown.Blazor/LittleTown.Blazor/Program.cs @@ -1,5 +1,7 @@ -using LittleTown.Blazor.Client.Pages; +using LittleTown.Blazor.Client.Services; using LittleTown.Blazor.Components; +using LittleTown.Core.Ports; +using LittleTown.StaticDataAcces; var builder = WebApplication.CreateBuilder(args); @@ -8,6 +10,9 @@ builder.Services.AddRazorComponents() .AddInteractiveServerComponents() .AddInteractiveWebAssemblyComponents(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); + var app = builder.Build(); // Configure the HTTP request pipeline. @@ -32,4 +37,4 @@ app.MapRazorComponents() .AddInteractiveWebAssemblyRenderMode() .AddAdditionalAssemblies(typeof(LittleTown.Blazor.Client._Imports).Assembly); -app.Run(); +await app.RunAsync(); diff --git a/src/LittleTown.StaticDataAccess/StaticDataGetter.cs b/src/LittleTown.StaticDataAccess/StaticDataGetter.cs index d985b56..9dad04f 100644 --- a/src/LittleTown.StaticDataAccess/StaticDataGetter.cs +++ b/src/LittleTown.StaticDataAccess/StaticDataGetter.cs @@ -29,9 +29,9 @@ public class StaticDataGetter : IStaticDataGetter /// Constructeur avec les chemins par défaut, à utiliser pour les tests seulement public StaticDataGetter() { - string boardPath = Path.Combine(Environment.CurrentDirectory, "../../../../LittleTown.StaticDataAccess/Data/Board1.json"); - string buildingPath = Path.Combine(Environment.CurrentDirectory, "../../../../LittleTown.StaticDataAccess/Data/Buildings.json"); - string objectivesPath = Path.Combine(Environment.CurrentDirectory, "../../../../LittleTown.StaticDataAccess/Data/Objectives.json"); + string boardPath = Path.Combine(Environment.CurrentDirectory, "../../../src/LittleTown.StaticDataAccess/Data/Board1.json"); + string buildingPath = Path.Combine(Environment.CurrentDirectory, "../../../src/LittleTown.StaticDataAccess/Data/Buildings.json"); + string objectivesPath = Path.Combine(Environment.CurrentDirectory, "../../../src/LittleTown.StaticDataAccess/Data/Objectives.json"); ReadFiles(boardPath, buildingPath, objectivesPath); } diff --git a/src/LittleTown.sln b/src/LittleTown.sln index 8f260b3..e5918a7 100644 --- a/src/LittleTown.sln +++ b/src/LittleTown.sln @@ -14,8 +14,14 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LittleTown.Blazor", "LittleTown.Blazor", "{5142DF7A-0B25-DAC6-14FF-F9CE4E6A354A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LittleTown.Blazor", "LittleTown.Blazor\LittleTown.Blazor\LittleTown.Blazor.csproj", "{12579937-5A8E-44F9-AC45-B742B311102E}" + ProjectSection(ProjectDependencies) = postProject + {FA0DE9D0-F788-4734-BDA3-F89F71D757BA} = {FA0DE9D0-F788-4734-BDA3-F89F71D757BA} + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LittleTown.Blazor.Client", "LittleTown.Blazor\LittleTown.Blazor.Client\LittleTown.Blazor.Client.csproj", "{83375A45-793A-462B-BAB8-AD432FA49350}" + ProjectSection(ProjectDependencies) = postProject + {FA0DE9D0-F788-4734-BDA3-F89F71D757BA} = {FA0DE9D0-F788-4734-BDA3-F89F71D757BA} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution