FurinaImpact/FurinaImpact.Gameserver/Controllers/ControllerBase.cs
2023-12-09 06:45:08 +03:00

25 lines
655 B
C#

using FurinaImpact.Gameserver.Controllers.Result;
using FurinaImpact.Gameserver.Network;
using FurinaImpact.Protocol;
using Google.Protobuf;
namespace FurinaImpact.Gameserver.Controllers;
internal abstract class ControllerBase
{
public NetPacket? Packet { get; set; }
protected IResult Ok()
{
return new SinglePacketResult(null);
}
protected IResult Response<TMessage>(CmdType cmdType, TMessage message) where TMessage : IMessage
{
return new SinglePacketResult(new()
{
CmdType = cmdType,
Head = Memory<byte>.Empty,
Body = message.ToByteArray()
});
}
}