FurinaImpact/FurinaImpact.Gameserver/Controllers/ControllerBase.cs

26 lines
655 B
C#
Raw Normal View History

2023-12-09 03:45:08 +00:00
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()
});
}
}