show current map on big screen

This commit is contained in:
Vinzenz Schroeter 2024-04-19 13:41:53 +02:00
parent 3e6d9c0c77
commit a7231903c8

View file

@ -10,9 +10,10 @@ internal sealed class SendToServicePointDisplay : IFrameConsumer
{ {
private const int ScoresWidth = 12; private const int ScoresWidth = 12;
private const int ScoresHeight = 20; private const int ScoresHeight = 20;
private const int ScoresPlayerRows = ScoresHeight - 5; private const int ScoresPlayerRows = ScoresHeight - 6;
private readonly IDisplayConnection _displayConnection; private readonly IDisplayConnection _displayConnection;
private readonly MapService _mapService;
private readonly ILogger<SendToServicePointDisplay> _logger; private readonly ILogger<SendToServicePointDisplay> _logger;
private readonly PlayerServer _players; private readonly PlayerServer _players;
private readonly Cp437Grid _scoresBuffer; private readonly Cp437Grid _scoresBuffer;
@ -25,12 +26,14 @@ internal sealed class SendToServicePointDisplay : IFrameConsumer
PlayerServer players, PlayerServer players,
ILogger<SendToServicePointDisplay> logger, ILogger<SendToServicePointDisplay> logger,
IDisplayConnection displayConnection, IDisplayConnection displayConnection,
IOptions<HostConfiguration> hostOptions IOptions<HostConfiguration> hostOptions,
MapService mapService
) )
{ {
_players = players; _players = players;
_logger = logger; _logger = logger;
_displayConnection = displayConnection; _displayConnection = displayConnection;
_mapService = mapService;
_minFrameTime = TimeSpan.FromMilliseconds(hostOptions.Value.ServicePointDisplayMinFrameTimeMs); _minFrameTime = TimeSpan.FromMilliseconds(hostOptions.Value.ServicePointDisplayMinFrameTimeMs);
var localIp = _displayConnection.GetLocalIPv4().Split('.'); var localIp = _displayConnection.GetLocalIPv4().Split('.');
@ -87,7 +90,9 @@ internal sealed class SendToServicePointDisplay : IFrameConsumer
row++; row++;
} }
for (; row < 17; row++) for (; row < 16; row++)
_scoresBuffer[row] = string.Empty; _scoresBuffer[row] = string.Empty;
_scoresBuffer[16] = _mapService.Current.Name[..(Math.Min(ScoresWidth, _mapService.Current.Name.Length) - 1)];
} }
} }