separate tick steps
This commit is contained in:
parent
898a9cedc1
commit
a9aaf899a2
1 changed files with 238 additions and 193 deletions
21
TanksServer/TickSteps/SendToServicePointDisplay.cs
Normal file
21
TanksServer/TickSteps/SendToServicePointDisplay.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using System.Net.Sockets;
|
||||
|
||||
namespace TanksServer.TickSteps;
|
||||
|
||||
internal sealed class SendToServicePointDisplay(
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in a new issue