NLDClient-yudde/ProjectNLD/Assets/Editor/Tools/Proto/MSGTemplateCS.txt

64 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//////////////////////////////////////////////////////////////////////////
//
// 文件:/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)
{
}
}
}