From a7231903c814908743673d33406e579fcb033af4 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Fri, 19 Apr 2024 13:41:53 +0200 Subject: [PATCH] show current map on big screen --- .../Interactivity/SendToServicePointDisplay.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/TanksServer/Interactivity/SendToServicePointDisplay.cs b/TanksServer/Interactivity/SendToServicePointDisplay.cs index 7773834..614619c 100644 --- a/TanksServer/Interactivity/SendToServicePointDisplay.cs +++ b/TanksServer/Interactivity/SendToServicePointDisplay.cs @@ -10,9 +10,10 @@ internal sealed class SendToServicePointDisplay : IFrameConsumer { private const int ScoresWidth = 12; private const int ScoresHeight = 20; - private const int ScoresPlayerRows = ScoresHeight - 5; + private const int ScoresPlayerRows = ScoresHeight - 6; private readonly IDisplayConnection _displayConnection; + private readonly MapService _mapService; private readonly ILogger _logger; private readonly PlayerServer _players; private readonly Cp437Grid _scoresBuffer; @@ -25,12 +26,14 @@ internal sealed class SendToServicePointDisplay : IFrameConsumer PlayerServer players, ILogger logger, IDisplayConnection displayConnection, - IOptions hostOptions + IOptions hostOptions, + MapService mapService ) { _players = players; _logger = logger; _displayConnection = displayConnection; + _mapService = mapService; _minFrameTime = TimeSpan.FromMilliseconds(hostOptions.Value.ServicePointDisplayMinFrameTimeMs); var localIp = _displayConnection.GetLocalIPv4().Split('.'); @@ -87,7 +90,9 @@ internal sealed class SendToServicePointDisplay : IFrameConsumer row++; } - for (; row < 17; row++) + for (; row < 16; row++) _scoresBuffer[row] = string.Empty; + + _scoresBuffer[16] = _mapService.Current.Name[..(Math.Min(ScoresWidth, _mapService.Current.Name.Length) - 1)]; } }