2024-02-07 21:41:39 +00:00
|
|
|
|
using GameServer.Network.Messages;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace GameServer.Network.Rpc;
|
|
|
|
|
internal class RpcSessionEndPoint : IRpcEndPoint
|
|
|
|
|
{
|
|
|
|
|
private readonly IServiceProvider _serviceProvider;
|
2024-02-09 09:44:42 +00:00
|
|
|
|
private PlayerSession? _session;
|
2024-02-07 21:41:39 +00:00
|
|
|
|
|
2024-02-09 09:44:42 +00:00
|
|
|
|
private PlayerSession Session => _session ??= _serviceProvider.GetRequiredService<PlayerSession>();
|
2024-02-07 21:41:39 +00:00
|
|
|
|
|
|
|
|
|
public RpcSessionEndPoint(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-09 09:44:42 +00:00
|
|
|
|
public Task SendRpcResult(ResponseMessage message) => Session.SendRpcRsp(message);
|
2024-02-07 21:41:39 +00:00
|
|
|
|
}
|