66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
|
LuaDistributesPropsGroupInfo = {}
|
||
|
|
||
|
LuaDistributesPropsGroupInfo.sysID = 0
|
||
|
LuaDistributesPropsGroupInfo.cmdID = 0
|
||
|
|
||
|
function LuaDistributesPropsGroupInfo.ExtraPacket(memStream)
|
||
|
-- print('ExtraPacket:'..memStream.Length)
|
||
|
|
||
|
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
|
||
|
local sysID = binaryReader:ReadByte()
|
||
|
local cmdID = binaryReader:ReadByte()
|
||
|
packet = LuaDistributesPropsGroupInfo.ReadPacket(binaryReader)
|
||
|
|
||
|
return packet
|
||
|
end
|
||
|
|
||
|
function LuaDistributesPropsGroupInfo.SendPacket(packet)
|
||
|
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesPropsGroupInfo.sysID, LuaDistributesPropsGroupInfo.cmdID)
|
||
|
if(packet['groupId'] == nil) then
|
||
|
packet['groupId'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['groupId'])
|
||
|
|
||
|
if(propsDetailedInfo == nil) then
|
||
|
propsDetailedInfo = {}
|
||
|
end
|
||
|
message:WriteInt(#packet['propsDetailedInfo'])
|
||
|
for k,v in ipairs(packet['propsDetailedInfo']) do
|
||
|
require "LuaDistributesPropsDetailedInfo"
|
||
|
LuaDistributesPropsDetailedInfo.WritePacket(v, binaryWriter)
|
||
|
|
||
|
end
|
||
|
|
||
|
if(packet['maxNum'] == nil) then
|
||
|
packet['maxNum'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['maxNum'])
|
||
|
|
||
|
if(packet['selectedNum'] == nil) then
|
||
|
packet['selectedNum'] = 0
|
||
|
end
|
||
|
message:WriteInt(packet['selectedNum'])
|
||
|
|
||
|
|
||
|
message:Send()
|
||
|
end
|
||
|
|
||
|
function LuaDistributesPropsGroupInfo.ReadPacket(binaryReader)
|
||
|
|
||
|
local packet = {}
|
||
|
packet['groupId'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['propsDetailedInfo'] = {}
|
||
|
local propsDetailedInfoCnt = binaryReader:ReadInt32()
|
||
|
for i=1,propsDetailedInfoCnt,1 do
|
||
|
require "LuaDistributesPropsDetailedInfo"
|
||
|
packet['propsDetailedInfo'][i] = LuaDistributesPropsDetailedInfo.ReadPacket(binaryReader)
|
||
|
|
||
|
end
|
||
|
packet['maxNum'] = binaryReader:ReadInt32()
|
||
|
|
||
|
packet['selectedNum'] = binaryReader:ReadInt32()
|
||
|
|
||
|
|
||
|
return packet
|
||
|
end
|