separate tick steps

This commit is contained in:
Vinzenz Schroeter 2024-04-07 19:52:16 +02:00
commit a9aaf899a2

View file

@ -1,28 +0,0 @@
using System.Net.Sockets;
using Microsoft.Extensions.Options;
namespace TanksServer.Services;
internal sealed class ServicePointDisplay(
IOptions<ServicePointDisplayConfiguration> options,
PixelDrawer drawer
) : ITickStep, IDisposable
{
private readonly UdpClient _udpClient = new(options.Value.Hostname, options.Value.Port);
public Task TickAsync()
{
return _udpClient.SendAsync(drawer.LastFrame.Data).AsTask();
}
public void Dispose()
{
_udpClient.Dispose();
}
}
internal sealed class ServicePointDisplayConfiguration
{
public string Hostname { get; set; } = string.Empty;
public int Port { get; set; }
}