separate folders per functionality

This commit is contained in:
Vinzenz Schroeter 2024-04-10 19:25:45 +02:00
parent 7f00160780
commit 0ca6a91a7e
33 changed files with 60 additions and 113 deletions

View file

@ -1,5 +1,3 @@
using TanksServer.Models;
namespace TanksServer.ServicePointDisplay;
internal class DisplayBufferView(byte[] data)

View file

@ -1,6 +1,3 @@
using TanksServer.Helpers;
using TanksServer.Services;
namespace TanksServer.ServicePointDisplay;
internal sealed class PixelDisplayBufferView : DisplayBufferView

View file

@ -1,10 +1,9 @@
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
using Microsoft.Extensions.Logging;
using TanksServer.Servers;
using TanksServer.Services;
using TanksServer.TickSteps;
using TanksServer.GameLogic;
using TanksServer.Graphics;
using TanksServer.Interactivity;
namespace TanksServer.ServicePointDisplay;
@ -34,16 +33,19 @@ internal sealed class SendToServicePointDisplay : ITickStep, IDisposable
? new UdpClient(options.Value.Hostname, options.Value.Port)
: null;
_scoresBuffer = new(new(MapService.TilesPerRow, 0), 12, 20);
_scoresBuffer.Rows[0] = "== TANKS! ==";
_scoresBuffer.Rows[1] = "-- scores --";
_scoresBuffer.Rows[17] = "-- join --";
var localIp = GetLocalIp(options.Value.Hostname, options.Value.Port).Split('.');
Debug.Assert(localIp.Length == 4); // were talking legacy ip
_scoresBuffer.Rows[18] = string.Join('.', localIp[..2]);
_scoresBuffer.Rows[19] = string.Join('.', localIp[2..]);
_scoresBuffer = new TextDisplayBuffer(new TilePosition(MapService.TilesPerRow, 0), 12, 20)
{
Rows =
{
[0] = "== TANKS! ==",
[1] = "-- scores --",
[17] = "-- join --",
[18] = string.Join('.', localIp[..2]),
[19] = string.Join('.', localIp[2..])
}
};
}
private static string GetLocalIp(string host, int port)

View file

@ -1,5 +1,3 @@
using TanksServer.Models;
namespace TanksServer.ServicePointDisplay;
internal sealed class TextDisplayBuffer : DisplayBufferView