------------------------------------------------- -- 本文件由代码生成器自动生成, -- 千万不要修改本文件的任何代码, -- 修改的的任何代码都会被覆盖掉! ---------------------------------------------------- local Socket = require "Xmds.Pomelo.LuaGameSocket" require "base64" require "achievementHandler_pb" --------------------------------Pomelo------------------------------- Pomelo = Pomelo or {} --------------------------------AchievementHandler------------------------------- Pomelo.AchievementHandler = {} local function getAchievementsRequestEncoder(msg) local input = achievementHandler_pb.GetAchievementsRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function getAchievementsRequestDecoder(stream) local res = achievementHandler_pb.GetAchievementsResponse() res:ParseFromString(stream) return res end function Pomelo.AchievementHandler.getAchievementsRequest(cb,option) local input = nil Socket.OnRequestStart("achievement.achievementHandler.getAchievementsRequest", option) Socket.Request("achievement.achievementHandler.getAchievementsRequest", input, function(res) if(res.s2c_code == 200) then Pomelo.AchievementHandler.lastGetAchievementsResponse = res Socket.OnRequestEnd("achievement.achievementHandler.getAchievementsRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] achievement.achievementHandler.getAchievementsRequest decode error!!" end Socket.OnRequestEnd("achievement.achievementHandler.getAchievementsRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, getAchievementsRequestEncoder, getAchievementsRequestDecoder) end local function achievementGetAwardRequestEncoder(msg) local input = achievementHandler_pb.AchievementGetAwardRequest() protobuf.FromMessage(input,msg) return (input:SerializeToString()) end local function achievementGetAwardRequestDecoder(stream) local res = achievementHandler_pb.AchievementGetAwardResponse() res:ParseFromString(stream) return res end function Pomelo.AchievementHandler.achievementGetAwardRequest(c2s_id,cb,option) local msg = {} msg.c2s_id = c2s_id Socket.OnRequestStart("achievement.achievementHandler.achievementGetAwardRequest", option) Socket.Request("achievement.achievementHandler.achievementGetAwardRequest", msg, function(res) if(res.s2c_code == 200) then Pomelo.AchievementHandler.lastAchievementGetAwardResponse = res Socket.OnRequestEnd("achievement.achievementHandler.achievementGetAwardRequest", true) cb(nil,res) else local ex = {} if(res.s2c_code) then ex.Code = res.s2c_code ex.Message = res.s2c_msg else ex.Code = 501 ex.Message = "[LuaXmdsNetClient] achievement.achievementHandler.achievementGetAwardRequest decode error!!" end Socket.OnRequestEnd("achievement.achievementHandler.achievementGetAwardRequest", false,ex.Code,ex.Message) cb(ex,nil) end end, achievementGetAwardRequestEncoder, achievementGetAwardRequestDecoder) end local function updateAchievementPushDecoder(stream) local res = achievementHandler_pb.UpdateAchievementPush() res:ParseFromString(stream) return res end function Pomelo.AchievementHandler.updateAchievementPush(cb) Socket.On("achievement.achievementPush.updateAchievementPush", function(res) Pomelo.AchievementHandler.lastUpdateAchievementPush = res cb(nil,res) end, updateAchievementPushDecoder) end --------------------------------Pomelo------------------------------- return Pomelo