FunctionOpenHandler.lua 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "functionOpenHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------FunctionOpenHandler-------------------------------
  12. Pomelo.FunctionOpenHandler = {}
  13. local function getFunctionListRequestEncoder(msg)
  14. local input = functionOpenHandler_pb.GetFunctionListRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function getFunctionListRequestDecoder(stream)
  19. local res = functionOpenHandler_pb.GetFunctionListResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.FunctionOpenHandler.getFunctionListRequest(cb,option)
  24. local input = nil
  25. Socket.OnRequestStart("area.functionOpenHandler.getFunctionListRequest", option)
  26. Socket.Request("area.functionOpenHandler.getFunctionListRequest", input, function(res)
  27. if(res.s2c_code == 200) then
  28. Pomelo.FunctionOpenHandler.lastGetFunctionListResponse = res
  29. Socket.OnRequestEnd("area.functionOpenHandler.getFunctionListRequest", 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.functionOpenHandler.getFunctionListRequest decode error!!"
  39. end
  40. Socket.OnRequestEnd("area.functionOpenHandler.getFunctionListRequest", false,ex.Code,ex.Message)
  41. cb(ex,nil)
  42. end
  43. end, getFunctionListRequestEncoder, getFunctionListRequestDecoder)
  44. end
  45. local function setFunctionPlayedRequestEncoder(msg)
  46. local input = functionOpenHandler_pb.SetFunctionPlayedRequest()
  47. protobuf.FromMessage(input,msg)
  48. return (input:SerializeToString())
  49. end
  50. local function setFunctionPlayedRequestDecoder(stream)
  51. local res = functionOpenHandler_pb.SetFunctionPlayedResponse()
  52. res:ParseFromString(stream)
  53. return res
  54. end
  55. function Pomelo.FunctionOpenHandler.setFunctionPlayedRequest(functionId,cb,option)
  56. local msg = {}
  57. msg.functionId = functionId
  58. Socket.OnRequestStart("area.functionOpenHandler.setFunctionPlayedRequest", option)
  59. Socket.Request("area.functionOpenHandler.setFunctionPlayedRequest", msg, function(res)
  60. if(res.s2c_code == 200) then
  61. Pomelo.FunctionOpenHandler.lastSetFunctionPlayedResponse = res
  62. Socket.OnRequestEnd("area.functionOpenHandler.setFunctionPlayedRequest", true)
  63. cb(nil,res)
  64. else
  65. local ex = {}
  66. if(res.s2c_code) then
  67. ex.Code = res.s2c_code
  68. ex.Message = res.s2c_msg
  69. else
  70. ex.Code = 501
  71. ex.Message = "[LuaXmdsNetClient] area.functionOpenHandler.setFunctionPlayedRequest decode error!!"
  72. end
  73. Socket.OnRequestEnd("area.functionOpenHandler.setFunctionPlayedRequest", false,ex.Code,ex.Message)
  74. cb(ex,nil)
  75. end
  76. end, setFunctionPlayedRequestEncoder, setFunctionPlayedRequestDecoder)
  77. end
  78. local function receiveFunctionAwardRequestEncoder(msg)
  79. local input = functionOpenHandler_pb.ReceiveFunctionAwardRequest()
  80. protobuf.FromMessage(input,msg)
  81. return (input:SerializeToString())
  82. end
  83. local function receiveFunctionAwardRequestDecoder(stream)
  84. local res = functionOpenHandler_pb.ReceiveFunctionAwardResponse()
  85. res:ParseFromString(stream)
  86. return res
  87. end
  88. function Pomelo.FunctionOpenHandler.receiveFunctionAwardRequest(guide_id,cb,option)
  89. local msg = {}
  90. msg.guide_id = guide_id
  91. Socket.OnRequestStart("area.functionOpenHandler.receiveFunctionAwardRequest", option)
  92. Socket.Request("area.functionOpenHandler.receiveFunctionAwardRequest", msg, function(res)
  93. if(res.s2c_code == 200) then
  94. Pomelo.FunctionOpenHandler.lastReceiveFunctionAwardResponse = res
  95. Socket.OnRequestEnd("area.functionOpenHandler.receiveFunctionAwardRequest", true)
  96. cb(nil,res)
  97. else
  98. local ex = {}
  99. if(res.s2c_code) then
  100. ex.Code = res.s2c_code
  101. ex.Message = res.s2c_msg
  102. else
  103. ex.Code = 501
  104. ex.Message = "[LuaXmdsNetClient] area.functionOpenHandler.receiveFunctionAwardRequest decode error!!"
  105. end
  106. Socket.OnRequestEnd("area.functionOpenHandler.receiveFunctionAwardRequest", false,ex.Code,ex.Message)
  107. cb(ex,nil)
  108. end
  109. end, receiveFunctionAwardRequestEncoder, receiveFunctionAwardRequestDecoder)
  110. end
  111. local function functionOpenListPushDecoder(stream)
  112. local res = functionOpenHandler_pb.FunctionOpenListPush()
  113. res:ParseFromString(stream)
  114. return res
  115. end
  116. function Pomelo.FunctionOpenHandler.functionOpenListPush(cb)
  117. Socket.On("area.functionOpenPush.functionOpenListPush", function(res)
  118. Pomelo.FunctionOpenHandler.lastFunctionOpenListPush = res
  119. cb(nil,res)
  120. end, functionOpenListPushDecoder)
  121. end
  122. local function functionAwardListPushDecoder(stream)
  123. local res = functionOpenHandler_pb.FunctionAwardListPush()
  124. res:ParseFromString(stream)
  125. return res
  126. end
  127. function Pomelo.FunctionOpenHandler.functionAwardListPush(cb)
  128. Socket.On("area.functionOpenPush.functionAwardListPush", function(res)
  129. Pomelo.FunctionOpenHandler.lastFunctionAwardListPush = res
  130. cb(nil,res)
  131. end, functionAwardListPushDecoder)
  132. end
  133. --------------------------------Pomelo-------------------------------
  134. return Pomelo