2024-01-19 14:45:18 +00:00
|
|
|
|
using Google.Protobuf;
|
|
|
|
|
using RPG.Network.Proto;
|
|
|
|
|
using RPG.Services.Gameserver.Session;
|
|
|
|
|
|
|
|
|
|
namespace RPG.Services.Gameserver.Modules;
|
|
|
|
|
internal abstract class BaseModule
|
|
|
|
|
{
|
2024-01-23 17:54:53 +00:00
|
|
|
|
protected ModuleManager ModuleManager { get; }
|
|
|
|
|
|
|
|
|
|
public BaseModule(ModuleManager moduleManager)
|
|
|
|
|
{
|
|
|
|
|
ModuleManager = moduleManager;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-19 14:45:18 +00:00
|
|
|
|
protected static void Send<TBody>(PlayerSession session, CmdType cmdType, TBody body) where TBody : IMessage<TBody>
|
|
|
|
|
{
|
|
|
|
|
session.SendToService(RPGServiceType.Gateserver, ServiceCommandType.ForwardGameMessage, new CmdForwardGameMessage
|
|
|
|
|
{
|
|
|
|
|
SessionId = session.SessionId,
|
|
|
|
|
CmdType = (ushort)cmdType,
|
|
|
|
|
Payload = body.ToByteString()
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-01-23 17:54:53 +00:00
|
|
|
|
|
|
|
|
|
public virtual Task OnLogin()
|
|
|
|
|
{
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
2024-01-19 14:45:18 +00:00
|
|
|
|
}
|