From 60f130ffc0e7be9377f9dbde20a9f7addb8e71c6 Mon Sep 17 00:00:00 2001 From: Alexander Raszka Date: Tue, 8 Oct 2024 17:31:34 +0200 Subject: [PATCH] Update scoreboard header --- .../Services/ScoreboardService.cs | 10 +++- .../Components/Header/HeaderContent.mt | 49 +++++++++++++++++-- .../Templates/Components/ScoreboardHeader.mt | 11 ++++- .../ScoreboardModule/Templates/Scoreboard.mt | 5 ++ 4 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/Modules/ScoreboardModule/Services/ScoreboardService.cs b/src/Modules/ScoreboardModule/Services/ScoreboardService.cs index 941f496fc..f66570308 100644 --- a/src/Modules/ScoreboardModule/Services/ScoreboardService.cs +++ b/src/Modules/ScoreboardModule/Services/ScoreboardService.cs @@ -1,4 +1,5 @@ using EvoSC.Common.Interfaces; +using EvoSC.Common.Interfaces.Services; using EvoSC.Common.Services.Attributes; using EvoSC.Common.Services.Models; using EvoSC.Manialinks.Interfaces; @@ -15,7 +16,8 @@ public class ScoreboardService( IServerClient server, IScoreboardNicknamesService nicknamesService, IScoreboardSettings settings, - IGameModeUiModuleService gameModeUiModuleService + IGameModeUiModuleService gameModeUiModuleService, + IMatchSettingsService matchSettingsService ) : IScoreboardService { @@ -31,10 +33,14 @@ private async Task GetDataAsync() { var currentNextMaxPlayers = await server.Remote.GetMaxPlayersAsync(); var currentNextMaxSpectators = await server.Remote.GetMaxSpectatorsAsync(); + var modeScriptSettings = await matchSettingsService.GetCurrentScriptSettingsAsync(); return new { - settings, MaxPlayers = currentNextMaxPlayers.CurrentValue + currentNextMaxSpectators.CurrentValue + settings, + MaxPlayers = currentNextMaxPlayers.CurrentValue + currentNextMaxSpectators.CurrentValue, + PointsLimit = (int)(modeScriptSettings?["S_PointsLimit"] ?? 0), + RoundsPerMap = (int)(modeScriptSettings?["S_RoundsPerMap"] ?? 0), }; } diff --git a/src/Modules/ScoreboardModule/Templates/Components/Header/HeaderContent.mt b/src/Modules/ScoreboardModule/Templates/Components/Header/HeaderContent.mt index 728922584..4415f8cc2 100644 --- a/src/Modules/ScoreboardModule/Templates/Components/Header/HeaderContent.mt +++ b/src/Modules/ScoreboardModule/Templates/Components/Header/HeaderContent.mt @@ -3,6 +3,9 @@ + + + @@ -10,20 +13,43 @@