2021-04-08 21:36:08 -05:00
|
|
|
using System.Text.Json;
|
|
|
|
using System.Threading.Tasks;
|
2021-04-21 02:00:50 -05:00
|
|
|
using GameServiceWarden.InteractionAPI;
|
|
|
|
using GameServiceWarden.InteractionAPI.Module;
|
2021-04-19 01:34:45 -05:00
|
|
|
using GameServiceWarden.Core.Module;
|
2021-04-08 21:36:08 -05:00
|
|
|
|
|
|
|
namespace GameServiceWarden.Core.UI
|
|
|
|
{
|
|
|
|
public class IPCPresenter : IServiceManagerMonitor
|
|
|
|
{
|
|
|
|
private IPCMediator mediator;
|
|
|
|
|
2021-04-15 22:14:08 -05:00
|
|
|
public IPCPresenter(IPCMediator mediator)
|
|
|
|
{
|
|
|
|
this.mediator = mediator;
|
|
|
|
}
|
|
|
|
|
2021-04-21 01:14:05 -05:00
|
|
|
public void Present(ServiceManagerTotal state)
|
2021-04-08 21:36:08 -05:00
|
|
|
{
|
2021-04-21 01:14:05 -05:00
|
|
|
Task replyTask = mediator.ReplyAll(CommunicableType.View, JsonSerializer.SerializeToUtf8Bytes(state));
|
|
|
|
replyTask.Wait();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Present(ServiceManagerDelta delta)
|
|
|
|
{
|
|
|
|
Task replyTask = mediator.ReplyAll(CommunicableType.Delta, JsonSerializer.SerializeToUtf8Bytes(delta));
|
|
|
|
replyTask.Wait();
|
2021-04-08 21:36:08 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|