UndergroundPlaceHandler.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "undergroundPlaceHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------UndergroundPlaceHandler-------------------------------
  12. Pomelo.UndergroundPlaceHandler = {}
  13. local function bossRefrushTimeRequestEncoder(msg)
  14. local input = undergroundPlaceHandler_pb.BossRefrushTimeRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function bossRefrushTimeRequestDecoder(stream)
  19. local res = undergroundPlaceHandler_pb.BossRefrushTimeResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.UndergroundPlaceHandler.bossRefrushTimeRequest(mapID,cb,option)
  24. local msg = {}
  25. msg.mapID = mapID
  26. Socket.OnRequestStart("area.undergroundPlaceHandler.bossRefrushTimeRequest", option)
  27. Socket.Request("area.undergroundPlaceHandler.bossRefrushTimeRequest", msg, function(res)
  28. if(res.s2c_code == 200) then
  29. Pomelo.UndergroundPlaceHandler.lastBossRefrushTimeResponse = res
  30. Socket.OnRequestEnd("area.undergroundPlaceHandler.bossRefrushTimeRequest", 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.undergroundPlaceHandler.bossRefrushTimeRequest decode error!!"
  40. end
  41. Socket.OnRequestEnd("area.undergroundPlaceHandler.bossRefrushTimeRequest", false,ex.Code,ex.Message)
  42. cb(ex,nil)
  43. end
  44. end, bossRefrushTimeRequestEncoder, bossRefrushTimeRequestDecoder)
  45. end
  46. local function bossRefrushTimePushDecoder(stream)
  47. local res = undergroundPlaceHandler_pb.BossRefrushTimePush()
  48. res:ParseFromString(stream)
  49. return res
  50. end
  51. function Pomelo.UndergroundPlaceHandler.bossRefrushTimePush(cb)
  52. Socket.On("area.undergroundPlacePush.bossRefrushTimePush", function(res)
  53. Pomelo.UndergroundPlaceHandler.lastBossRefrushTimePush = res
  54. cb(nil,res)
  55. end, bossRefrushTimePushDecoder)
  56. end
  57. --------------------------------Pomelo-------------------------------
  58. return Pomelo