BattleHandler.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "battleHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------BattleHandler-------------------------------
  12. Pomelo.BattleHandler = {}
  13. local function throwPointRequestEncoder(msg)
  14. local input = battleHandler_pb.ThrowPointRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function throwPointRequestDecoder(stream)
  19. local res = battleHandler_pb.ThrowPointResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.BattleHandler.throwPointRequest(id,server_id,isQuit,type,count,cb,option)
  24. local msg = {}
  25. msg.id = id
  26. msg.server_id = server_id
  27. msg.isQuit = isQuit
  28. msg.type = type
  29. msg.count = count
  30. Socket.OnRequestStart("area.battleHandler.throwPointRequest", option)
  31. Socket.Request("area.battleHandler.throwPointRequest", msg, function(res)
  32. if(res.s2c_code == 200) then
  33. Pomelo.BattleHandler.lastThrowPointResponse = res
  34. Socket.OnRequestEnd("area.battleHandler.throwPointRequest", true)
  35. cb(nil,res)
  36. else
  37. local ex = {}
  38. if(res.s2c_code) then
  39. ex.Code = res.s2c_code
  40. ex.Message = res.s2c_msg
  41. else
  42. ex.Code = 501
  43. ex.Message = "[LuaXmdsNetClient] area.battleHandler.throwPointRequest decode error!!"
  44. end
  45. Socket.OnRequestEnd("area.battleHandler.throwPointRequest", false,ex.Code,ex.Message)
  46. cb(ex,nil)
  47. end
  48. end, throwPointRequestEncoder, throwPointRequestDecoder)
  49. end
  50. local function throwPointItemListPushDecoder(stream)
  51. local res = battleHandler_pb.ThrowPointItemListPush()
  52. res:ParseFromString(stream)
  53. return res
  54. end
  55. function Pomelo.BattleHandler.throwPointItemListPush(cb)
  56. Socket.On("area.battlePush.throwPointItemListPush", function(res)
  57. Pomelo.BattleHandler.lastThrowPointItemListPush = res
  58. cb(nil,res)
  59. end, throwPointItemListPushDecoder)
  60. end
  61. local function throwPointResultPushDecoder(stream)
  62. local res = battleHandler_pb.ThrowPointResultPush()
  63. res:ParseFromString(stream)
  64. return res
  65. end
  66. function Pomelo.BattleHandler.throwPointResultPush(cb)
  67. Socket.On("area.battlePush.throwPointResultPush", function(res)
  68. Pomelo.BattleHandler.lastThrowPointResultPush = res
  69. cb(nil,res)
  70. end, throwPointResultPushDecoder)
  71. end
  72. local function biddingInfoPushDecoder(stream)
  73. local res = battleHandler_pb.BiddingInfoPush()
  74. res:ParseFromString(stream)
  75. return res
  76. end
  77. function Pomelo.BattleHandler.biddingInfoPush(cb)
  78. Socket.On("area.battlePush.biddingInfoPush", function(res)
  79. Pomelo.BattleHandler.lastBiddingInfoPush = res
  80. cb(nil,res)
  81. end, biddingInfoPushDecoder)
  82. end
  83. local function fightLevelResultPushDecoder(stream)
  84. local res = battleHandler_pb.FightLevelResultPush()
  85. res:ParseFromString(stream)
  86. return res
  87. end
  88. function Pomelo.BattleHandler.fightLevelResultPush(cb)
  89. Socket.On("area.battlePush.fightLevelResultPush", function(res)
  90. Pomelo.BattleHandler.lastFightLevelResultPush = res
  91. cb(nil,res)
  92. end, fightLevelResultPushDecoder)
  93. end
  94. local function itemDropPushDecoder(stream)
  95. local res = battleHandler_pb.ItemDropPush()
  96. res:ParseFromString(stream)
  97. return res
  98. end
  99. function Pomelo.BattleHandler.itemDropPush(cb)
  100. Socket.On("area.battlePush.itemDropPush", function(res)
  101. Pomelo.BattleHandler.lastItemDropPush = res
  102. cb(nil,res)
  103. end, itemDropPushDecoder)
  104. end
  105. local function sceneNamePushDecoder(stream)
  106. local res = battleHandler_pb.SceneNamePush()
  107. res:ParseFromString(stream)
  108. return res
  109. end
  110. function Pomelo.BattleHandler.sceneNamePush(cb)
  111. Socket.On("area.battlePush.sceneNamePush", function(res)
  112. Pomelo.BattleHandler.lastSceneNamePush = res
  113. cb(nil,res)
  114. end, sceneNamePushDecoder)
  115. end
  116. local function resourceDungeonResultPushDecoder(stream)
  117. local res = battleHandler_pb.ResourceDungeonResultPush()
  118. res:ParseFromString(stream)
  119. return res
  120. end
  121. function Pomelo.BattleHandler.resourceDungeonResultPush(cb)
  122. Socket.On("area.battlePush.resourceDungeonResultPush", function(res)
  123. Pomelo.BattleHandler.lastResourceDungeonResultPush = res
  124. cb(nil,res)
  125. end, resourceDungeonResultPushDecoder)
  126. end
  127. --------------------------------Pomelo-------------------------------
  128. return Pomelo