LimitTimeActivityHandler.lua 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "limitTimeActivityHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------LimitTimeActivityHandler-------------------------------
  12. Pomelo.LimitTimeActivityHandler = {}
  13. local function getLimitTimeActivityInfoRequestEncoder(msg)
  14. local input = limitTimeActivityHandler_pb.GetLimitTimeActivityInfoRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function getLimitTimeActivityInfoRequestDecoder(stream)
  19. local res = limitTimeActivityHandler_pb.GetLimitTimeActivityInfoResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.LimitTimeActivityHandler.getLimitTimeActivityInfoRequest(cb,option)
  24. local input = nil
  25. Socket.OnRequestStart("area.limitTimeActivityHandler.getLimitTimeActivityInfoRequest", option)
  26. Socket.Request("area.limitTimeActivityHandler.getLimitTimeActivityInfoRequest", input, function(res)
  27. if(res.s2c_code == 200) then
  28. Pomelo.LimitTimeActivityHandler.lastGetLimitTimeActivityInfoResponse = res
  29. Socket.OnRequestEnd("area.limitTimeActivityHandler.getLimitTimeActivityInfoRequest", true)
  30. cb(nil,res)
  31. else
  32. local ex = {}
  33. if(res.s2c_code) then
  34. ex.Code = res.s2c_code
  35. ex.Message = res.s2c_msg
  36. else
  37. ex.Code = 501
  38. ex.Message = "[LuaXmdsNetClient] area.limitTimeActivityHandler.getLimitTimeActivityInfoRequest decode error!!"
  39. end
  40. Socket.OnRequestEnd("area.limitTimeActivityHandler.getLimitTimeActivityInfoRequest", false,ex.Code,ex.Message)
  41. cb(ex,nil)
  42. end
  43. end, getLimitTimeActivityInfoRequestEncoder, getLimitTimeActivityInfoRequestDecoder)
  44. end
  45. local function ltActivityInfoPushDecoder(stream)
  46. local res = limitTimeActivityHandler_pb.LTActivityInfoPush()
  47. res:ParseFromString(stream)
  48. return res
  49. end
  50. function Pomelo.LimitTimeActivityHandler.ltActivityInfoPush(cb)
  51. Socket.On("area.limitTimeActivityPush.ltActivityInfoPush", function(res)
  52. Pomelo.LimitTimeActivityHandler.lastLTActivityInfoPush = res
  53. cb(nil,res)
  54. end, ltActivityInfoPushDecoder)
  55. end
  56. --------------------------------Pomelo-------------------------------
  57. return Pomelo