Files
JJBB/Assets/Project/Script/LuaScripts/NetWork/Lua/Distributes/LuaDistributesRetDailyCopyInfo.txt

92 lines
2.1 KiB
Plaintext
Raw Normal View History

2024-08-23 15:49:34 +08:00
LuaDistributesRetDailyCopyInfo = {}
LuaDistributesRetDailyCopyInfo.sysID = 34
LuaDistributesRetDailyCopyInfo.cmdID = 3
function LuaDistributesRetDailyCopyInfo.ExtraPacket(memStream)
-- print('ExtraPacket:'..memStream.Length)
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
local sysID = binaryReader:ReadByte()
local cmdID = binaryReader:ReadByte()
packet = LuaDistributesRetDailyCopyInfo.ReadPacket(binaryReader)
return packet
end
function LuaDistributesRetDailyCopyInfo.SendPacket(packet)
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesRetDailyCopyInfo.sysID, LuaDistributesRetDailyCopyInfo.cmdID)
if(copyid == nil) then
copyid = {}
end
message:WriteInt(#packet['copyid'])
for k,v in ipairs(packet['copyid']) do
if(v == nil) then
v = 0
end
message:WriteInt(v)
end
if(remaintime == nil) then
remaintime = {}
end
message:WriteInt(#packet['remaintime'])
for k,v in ipairs(packet['remaintime']) do
if(v == nil) then
v = 0
end
message:WriteInt(v)
end
if(havebuytime == nil) then
havebuytime = {}
end
message:WriteInt(#packet['havebuytime'])
for k,v in ipairs(packet['havebuytime']) do
if(v == nil) then
v = 0
end
message:WriteInt(v)
end
if(beastrecord == nil) then
beastrecord = {}
end
message:WriteInt(#packet['beastrecord'])
for k,v in ipairs(packet['beastrecord']) do
if(v == nil) then
v = 0
end
message:WriteInt(v)
end
message:Send()
end
function LuaDistributesRetDailyCopyInfo.ReadPacket(binaryReader)
local packet = {}
packet['copyid'] = {}
local copyidCnt = binaryReader:ReadInt32()
for i=1,copyidCnt,1 do
packet['copyid'][i] = binaryReader:ReadInt32()
end
packet['remaintime'] = {}
local remaintimeCnt = binaryReader:ReadInt32()
for i=1,remaintimeCnt,1 do
packet['remaintime'][i] = binaryReader:ReadInt32()
end
packet['havebuytime'] = {}
local havebuytimeCnt = binaryReader:ReadInt32()
for i=1,havebuytimeCnt,1 do
packet['havebuytime'][i] = binaryReader:ReadInt32()
end
packet['beastrecord'] = {}
local beastrecordCnt = binaryReader:ReadInt32()
for i=1,beastrecordCnt,1 do
packet['beastrecord'][i] = binaryReader:ReadInt32()
end
return packet
end