42 lines
1013 B
Plaintext
42 lines
1013 B
Plaintext
|
LuaDistributesTestStuct = {}
|
||
|
|
||
|
LuaDistributesTestStuct.sysID = 0
|
||
|
LuaDistributesTestStuct.cmdID = 0
|
||
|
|
||
|
function LuaDistributesTestStuct.ExtraPacket(memStream)
|
||
|
-- print('ExtraPacket:'..memStream.Length)
|
||
|
|
||
|
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
|
||
|
local sysID = binaryReader:ReadByte()
|
||
|
local cmdID = binaryReader:ReadByte()
|
||
|
packet = LuaDistributesTestStuct.ReadPacket(binaryReader)
|
||
|
|
||
|
return packet
|
||
|
end
|
||
|
|
||
|
function LuaDistributesTestStuct.SendPacket(packet)
|
||
|
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesTestStuct.sysID, LuaDistributesTestStuct.cmdID)
|
||
|
if(packet['veinID'] == nil) then
|
||
|
packet['veinID'] = 0
|
||
|
end
|
||
|
message:WriteByte(packet['veinID'])
|
||
|
|
||
|
if(packet['propList'] == nil) then
|
||
|
packet['propList'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['propList'])
|
||
|
|
||
|
|
||
|
message:Send()
|
||
|
end
|
||
|
|
||
|
function LuaDistributesTestStuct.ReadPacket(binaryReader)
|
||
|
|
||
|
local packet = {}
|
||
|
packet['veinID'] = binaryReader:ReadByte()
|
||
|
|
||
|
packet['propList'] = binaryReader:ReadInt32()
|
||
|
|
||
|
|
||
|
return packet
|
||
|
end
|