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

91 lines
2.0 KiB
Plaintext
Raw Normal View History

2024-08-23 15:49:34 +08:00
LuaDistributesChildrenBasic = {}
LuaDistributesChildrenBasic.sysID = 0
LuaDistributesChildrenBasic.cmdID = 0
function LuaDistributesChildrenBasic.ExtraPacket(memStream)
-- print('ExtraPacket:'..memStream.Length)
local binaryReader = CS.BinaryMessageHandle.GetLuaPacketReader(memStream)
local sysID = binaryReader:ReadByte()
local cmdID = binaryReader:ReadByte()
packet = LuaDistributesChildrenBasic.ReadPacket(binaryReader)
return packet
end
function LuaDistributesChildrenBasic.SendPacket(packet)
local message = CS.BinaryMessageHandle.CreateMessage(LuaDistributesChildrenBasic.sysID, LuaDistributesChildrenBasic.cmdID)
if(packet['name'] == nil) then
packet['name'] = ""
end
message:WriteString(packet['name'])
if(packet['gender'] == nil) then
packet['gender'] = 0
end
message:WriteInt(packet['gender'])
if(packet['power'] == nil) then
packet['power'] = 0
end
message:WriteInt(packet['power'])
if(packet['state'] == nil) then
packet['state'] = 0
end
message:WriteInt(packet['state'])
if(packet['embryoEndtime'] == nil) then
packet['embryoEndtime'] = 0
end
message:WriteInt(packet['embryoEndtime'])
if(packet['soarNum'] == nil) then
packet['soarNum'] = 0
end
message:WriteInt(packet['soarNum'])
if(packet['curLevel'] == nil) then
packet['curLevel'] = 0
end
message:WriteInt(packet['curLevel'])
if(packet['curExp'] == nil) then
packet['curExp'] = 0
end
message:WriteInt(packet['curExp'])
if(packet['intimacy'] == nil) then
packet['intimacy'] = 0
end
message:WriteInt(packet['intimacy'])
message:Send()
end
function LuaDistributesChildrenBasic.ReadPacket(binaryReader)
local packet = {}
packet['name'] = CS.BinaryMessageHandle.ReadString(binaryReader)
packet['gender'] = binaryReader:ReadInt32()
packet['power'] = binaryReader:ReadInt32()
packet['state'] = binaryReader:ReadInt32()
packet['embryoEndtime'] = binaryReader:ReadInt32()
packet['soarNum'] = binaryReader:ReadInt32()
packet['curLevel'] = binaryReader:ReadInt32()
packet['curExp'] = binaryReader:ReadInt32()
packet['intimacy'] = binaryReader:ReadInt32()
return packet
end