mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-22 16:24:31 +00:00
58 lines
1.2 KiB
C#
58 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using CsProtocol.Buffer;
|
|
|
|
namespace CsProtocol
|
|
{
|
|
// @author jaysunxiao
|
|
// @version 3.0
|
|
public class ObjectB : IPacket
|
|
{
|
|
public bool flag;
|
|
|
|
public static ObjectB ValueOf(bool flag)
|
|
{
|
|
var packet = new ObjectB();
|
|
packet.flag = flag;
|
|
return packet;
|
|
}
|
|
|
|
|
|
public short ProtocolId()
|
|
{
|
|
return 103;
|
|
}
|
|
}
|
|
|
|
|
|
public class ObjectBRegistration : IProtocolRegistration
|
|
{
|
|
public short ProtocolId()
|
|
{
|
|
return 103;
|
|
}
|
|
|
|
public void Write(ByteBuffer buffer, IPacket packet)
|
|
{
|
|
if (buffer.WritePacketFlag(packet))
|
|
{
|
|
return;
|
|
}
|
|
ObjectB message = (ObjectB) packet;
|
|
buffer.WriteBool(message.flag);
|
|
}
|
|
|
|
public IPacket Read(ByteBuffer buffer)
|
|
{
|
|
if (!buffer.ReadBool())
|
|
{
|
|
return null;
|
|
}
|
|
ObjectB packet = new ObjectB();
|
|
bool result0 = buffer.ReadBool();
|
|
packet.flag = result0;
|
|
return packet;
|
|
}
|
|
}
|
|
}
|