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

70 lines
1.6 KiB
Plaintext
Raw Normal View History

2024-08-23 15:49:34 +08:00
LuaDistributesLuckTaskState = {}
LuaDistributesLuckTaskState.sysID = 0
LuaDistributesLuckTaskState.cmdID = 0
function LuaDistributesLuckTaskState.ExtraPacket(memStream)
-- print('ExtraPacket:'..memStream.Length)
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
local sysID = binaryReader:ReadByte()
local cmdID = binaryReader:ReadByte()
packet = LuaDistributesLuckTaskState.ReadPacket(binaryReader)
return packet
end
function LuaDistributesLuckTaskState.SendPacket(packet)
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesLuckTaskState.sysID, LuaDistributesLuckTaskState.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'] = ""
end
message:WriteString(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'])
message:Send()
end
function LuaDistributesLuckTaskState.ReadPacket(binaryReader)
local packet = {}
packet['taskId'] = binaryReader:ReadInt32()
packet['state'] = binaryReader:ReadInt32()
packet['curValue'] = binaryReader:ReadInt32()
packet['taskType'] = CS.BinaryMessageHandle.ReadString(binaryReader)
packet['target'] = binaryReader:ReadInt32()
packet['taskDesc'] = CS.BinaryMessageHandle.ReadString(binaryReader)
return packet
end