2023-08-22 19:08:45 +08:00
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//
|
|
|
|
|
|
// 文件:/Code/Scripts/Gameplay/Net/Messages/MSG__MSG_NAME_.cs
|
|
|
|
|
|
// 作者:NLD Tools
|
|
|
|
|
|
// 时间:_MSG_DATE_
|
|
|
|
|
|
// 描述:_MSG_DESC_
|
|
|
|
|
|
// 说明:
|
|
|
|
|
|
//
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
using NLDMID;
|
|
|
|
|
|
using NLDPB;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gameplay.Net
|
|
|
|
|
|
{
|
|
|
|
|
|
public sealed class MSG__MSG_NAME_ : IMessage
|
|
|
|
|
|
{
|
2026-03-18 19:21:45 +08:00
|
|
|
|
public MSGID ID { get { return MSGID._MSG_ID_NAME_; } }
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
private _MSG_NAME_ m_PB;
|
|
|
|
|
|
public _MSG_NAME_ mPB
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_PB == null)
|
|
|
|
|
|
m_PB = new _MSG_NAME_();
|
|
|
|
|
|
|
|
|
|
|
|
return m_PB;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-18 19:21:45 +08:00
|
|
|
|
public byte[] Export()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
// 写入PB数据
|
|
|
|
|
|
byte[] bytes = new byte[mPB.CalculateSize()];
|
|
|
|
|
|
mPB.WriteTo(new Google.Protobuf.CodedOutputStream(bytes));
|
|
|
|
|
|
return bytes;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-18 19:21:45 +08:00
|
|
|
|
public void Import(byte[] data, int offset, int length)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
m_PB = _MSG_NAME_.Parser.ParseFrom(data, offset, length);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-18 19:21:45 +08:00
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_PB == null) {
|
|
|
|
|
|
return $"message {ID} is null";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return m_PB.ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
// 消息处理接口
|
2026-03-18 19:21:45 +08:00
|
|
|
|
public void Execute(NetClient client)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|