HookSetHandler.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "hookSetHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------HookSetHandler-------------------------------
  12. Pomelo.HookSetHandler = {}
  13. local function changeHookSetRequestEncoder(msg)
  14. local input = hookSetHandler_pb.ChangeHookSetRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function changeHookSetRequestDecoder(stream)
  19. local res = hookSetHandler_pb.ChangeHookSetResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.HookSetHandler.changeHookSetRequest(c2s_hookSetData,cb,option)
  24. local msg = {}
  25. msg.c2s_hookSetData = c2s_hookSetData
  26. Socket.OnRequestStart("area.hookSetHandler.changeHookSetRequest", option)
  27. Socket.Request("area.hookSetHandler.changeHookSetRequest", msg, function(res)
  28. if(res.s2c_code == 200) then
  29. Pomelo.HookSetHandler.lastChangeHookSetResponse = res
  30. Socket.OnRequestEnd("area.hookSetHandler.changeHookSetRequest", true)
  31. cb(nil,res)
  32. else
  33. local ex = {}
  34. if(res.s2c_code) then
  35. ex.Code = res.s2c_code
  36. ex.Message = res.s2c_msg
  37. else
  38. ex.Code = 501
  39. ex.Message = "[LuaXmdsNetClient] area.hookSetHandler.changeHookSetRequest decode error!!"
  40. end
  41. Socket.OnRequestEnd("area.hookSetHandler.changeHookSetRequest", false,ex.Code,ex.Message)
  42. cb(ex,nil)
  43. end
  44. end, changeHookSetRequestEncoder, changeHookSetRequestDecoder)
  45. end
  46. --------------------------------Pomelo-------------------------------
  47. return Pomelo