66 lines
1.6 KiB
Plaintext
66 lines
1.6 KiB
Plaintext
|
LuaDistributesMatInfo = {}
|
||
|
|
||
|
LuaDistributesMatInfo.sysID = 0
|
||
|
LuaDistributesMatInfo.cmdID = 0
|
||
|
|
||
|
function LuaDistributesMatInfo.ExtraPacket(memStream)
|
||
|
-- print('ExtraPacket:'..memStream.Length)
|
||
|
|
||
|
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
|
||
|
local sysID = binaryReader:ReadByte()
|
||
|
local cmdID = binaryReader:ReadByte()
|
||
|
packet = LuaDistributesMatInfo.ReadPacket(binaryReader)
|
||
|
|
||
|
return packet
|
||
|
end
|
||
|
|
||
|
function LuaDistributesMatInfo.SendPacket(packet)
|
||
|
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesMatInfo.sysID, LuaDistributesMatInfo.cmdID)
|
||
|
if(packet['id'] == nil) then
|
||
|
packet['id'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['id'])
|
||
|
|
||
|
if(packet['facilityId'] == nil) then
|
||
|
packet['facilityId'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['facilityId'])
|
||
|
|
||
|
if(packet['activeNum'] == nil) then
|
||
|
packet['activeNum'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['activeNum'])
|
||
|
|
||
|
if(battleGenalsList == nil) then
|
||
|
battleGenalsList = {}
|
||
|
end
|
||
|
message:WriteInt(#packet['battleGenalsList'])
|
||
|
for k,v in ipairs(packet['battleGenalsList']) do
|
||
|
require "LuaDistributesMatGenl"
|
||
|
LuaDistributesMatGenl.WritePacket(v, binaryWriter)
|
||
|
|
||
|
end
|
||
|
|
||
|
|
||
|
message:Send()
|
||
|
end
|
||
|
|
||
|
function LuaDistributesMatInfo.ReadPacket(binaryReader)
|
||
|
|
||
|
local packet = {}
|
||
|
packet['id'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['facilityId'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['activeNum'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['battleGenalsList'] = {}
|
||
|
local battleGenalsListCnt = binaryReader:ReadInt32()
|
||
|
for i=1,battleGenalsListCnt,1 do
|
||
|
require "LuaDistributesMatGenl"
|
||
|
packet['battleGenalsList'][i] = LuaDistributesMatGenl.ReadPacket(binaryReader)
|
||
|
|
||
|
end
|
||
|
|
||
|
return packet
|
||
|
end
|