Files
JJBB/Assets/Project/Script/LuaScripts/NetWork/Lua/Distributes/LuaDistributesMillionTaskState.txt
2024-08-23 15:49:34 +08:00

84 lines
1.9 KiB
Plaintext

LuaDistributesMillionTaskState = {}
LuaDistributesMillionTaskState.sysID = 0
LuaDistributesMillionTaskState.cmdID = 0
function LuaDistributesMillionTaskState.ExtraPacket(memStream)
-- print('ExtraPacket:'..memStream.Length)
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
local sysID = binaryReader:ReadByte()
local cmdID = binaryReader:ReadByte()
packet = LuaDistributesMillionTaskState.ReadPacket(binaryReader)
return packet
end
function LuaDistributesMillionTaskState.SendPacket(packet)
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesMillionTaskState.sysID, LuaDistributesMillionTaskState.cmdID)
if(packet['taskId'] == nil) then
packet['taskId'] = 0
end
message:WriteInt(packet['taskId'])
if(packet['state'] == nil) then
packet['state'] = 0
end
message:WriteInt(packet['state'])
if(packet['curValue'] == nil) then
packet['curValue'] = 0
end
message:WriteInt(packet['curValue'])
if(packet['taskType'] == nil) then
packet['taskType'] = 0
end
message:WriteInt(packet['taskType'])
if(packet['target'] == nil) then
packet['target'] = 0
end
message:WriteInt(packet['target'])
if(packet['taskDesc'] == nil) then
packet['taskDesc'] = ""
end
message:WriteString(packet['taskDesc'])
if(packet['param'] == nil) then
packet['param'] = 0
end
message:WriteInt(packet['param'])
if(packet['itemType'] == nil) then
packet['itemType'] = 0
end
message:WriteInt(packet['itemType'])
message:Send()
end
function LuaDistributesMillionTaskState.ReadPacket(binaryReader)
local packet = {}
packet['taskId'] = binaryReader:ReadInt32()
packet['state'] = binaryReader:ReadInt32()
packet['curValue'] = binaryReader:ReadInt32()
packet['taskType'] = binaryReader:ReadInt32()
packet['target'] = binaryReader:ReadInt32()
packet['taskDesc'] = CS.BinaryMessageHandle.ReadString(binaryReader)
packet['param'] = binaryReader:ReadInt32()
packet['itemType'] = binaryReader:ReadInt32()
return packet
end