64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
//////////////////////////////////////////////////////////////////////////
|
||
//
|
||
// 文件:/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
|
||
{
|
||
public MSGID ID { get { return MSGID._MSG_ID_NAME_; } }
|
||
|
||
private _MSG_NAME_ m_PB;
|
||
public _MSG_NAME_ mPB
|
||
{
|
||
get
|
||
{
|
||
if (m_PB == null)
|
||
m_PB = new _MSG_NAME_();
|
||
|
||
return m_PB;
|
||
}
|
||
}
|
||
|
||
public byte[] Export()
|
||
{
|
||
// 写入PB数据
|
||
byte[] bytes = new byte[mPB.CalculateSize()];
|
||
mPB.WriteTo(new Google.Protobuf.CodedOutputStream(bytes));
|
||
return bytes;
|
||
}
|
||
|
||
public void Import(byte[] data, int offset, int length)
|
||
{
|
||
m_PB = _MSG_NAME_.Parser.ParseFrom(data, offset, length);
|
||
}
|
||
|
||
public override string ToString()
|
||
{
|
||
if (m_PB == null) {
|
||
return $"message {ID} is null";
|
||
} else {
|
||
return m_PB.ToString();
|
||
}
|
||
}
|
||
|
||
// 消息处理接口
|
||
public void Execute(NetClient client)
|
||
{
|
||
|
||
|
||
|
||
}
|
||
}
|
||
}
|