123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- -------------------------------------------------
- -- 本文件由代码生成器自动生成,
- -- 千万不要修改本文件的任何代码,
- -- 修改的的任何代码都会被覆盖掉!
- ----------------------------------------------------
- local Socket = require "Xmds.Pomelo.LuaGameSocket"
- require "base64"
- require "roleHandler_pb"
- --------------------------------Pomelo-------------------------------
- Pomelo = Pomelo or {}
- --------------------------------RoleHandler-------------------------------
- Pomelo.RoleHandler = {}
- local function createPlayerRequestEncoder(msg)
- local input = roleHandler_pb.CreatePlayerRequest()
- protobuf.FromMessage(input,msg)
- return (input:SerializeToString())
- end
- local function createPlayerRequestDecoder(stream)
- local res = roleHandler_pb.CreatePlayerResponse()
- res:ParseFromString(stream)
- return res
- end
- function Pomelo.RoleHandler.createPlayerRequest(c2s_pro,c2s_name,c2s_sex,cb,option)
- local msg = {}
- msg.c2s_pro = c2s_pro
- msg.c2s_name = c2s_name
- msg.c2s_sex = c2s_sex
- Socket.OnRequestStart("connector.roleHandler.createPlayerRequest", option)
- Socket.Request("connector.roleHandler.createPlayerRequest", msg, function(res)
- if(res.s2c_code == 200) then
- Pomelo.RoleHandler.lastCreatePlayerResponse = res
- Socket.OnRequestEnd("connector.roleHandler.createPlayerRequest", 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] connector.roleHandler.createPlayerRequest decode error!!"
- end
- Socket.OnRequestEnd("connector.roleHandler.createPlayerRequest", false,ex.Code,ex.Message)
- cb(ex,nil)
- end
- end, createPlayerRequestEncoder, createPlayerRequestDecoder)
- end
- local function changePlayerNameRequestEncoder(msg)
- local input = roleHandler_pb.ChangePlayerNameRequest()
- protobuf.FromMessage(input,msg)
- return (input:SerializeToString())
- end
- local function changePlayerNameRequestDecoder(stream)
- local res = roleHandler_pb.ChangePlayerNameResponse()
- res:ParseFromString(stream)
- return res
- end
- function Pomelo.RoleHandler.changePlayerNameRequest(c2s_name,pos,cb,option)
- local msg = {}
- msg.c2s_name = c2s_name
- msg.pos = pos
- Socket.OnRequestStart("connector.roleHandler.changePlayerNameRequest", option)
- Socket.Request("connector.roleHandler.changePlayerNameRequest", msg, function(res)
- if(res.s2c_code == 200) then
- Pomelo.RoleHandler.lastChangePlayerNameResponse = res
- Socket.OnRequestEnd("connector.roleHandler.changePlayerNameRequest", 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] connector.roleHandler.changePlayerNameRequest decode error!!"
- end
- Socket.OnRequestEnd("connector.roleHandler.changePlayerNameRequest", false,ex.Code,ex.Message)
- cb(ex,nil)
- end
- end, changePlayerNameRequestEncoder, changePlayerNameRequestDecoder)
- end
- local function deletePlayerRequestEncoder(msg)
- local input = roleHandler_pb.DeletePlayerRequest()
- protobuf.FromMessage(input,msg)
- return (input:SerializeToString())
- end
- local function deletePlayerRequestDecoder(stream)
- local res = roleHandler_pb.DeletePlayerResponse()
- res:ParseFromString(stream)
- return res
- end
- function Pomelo.RoleHandler.deletePlayerRequest(c2s_playerId,cb,option)
- local msg = {}
- msg.c2s_playerId = c2s_playerId
- Socket.OnRequestStart("connector.roleHandler.deletePlayerRequest", option)
- Socket.Request("connector.roleHandler.deletePlayerRequest", msg, function(res)
- if(res.s2c_code == 200) then
- Pomelo.RoleHandler.lastDeletePlayerResponse = res
- Socket.OnRequestEnd("connector.roleHandler.deletePlayerRequest", 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] connector.roleHandler.deletePlayerRequest decode error!!"
- end
- Socket.OnRequestEnd("connector.roleHandler.deletePlayerRequest", false,ex.Code,ex.Message)
- cb(ex,nil)
- end
- end, deletePlayerRequestEncoder, deletePlayerRequestDecoder)
- end
- local function getRandomNameRequestEncoder(msg)
- local input = roleHandler_pb.GetRandomNameRequest()
- protobuf.FromMessage(input,msg)
- return (input:SerializeToString())
- end
- local function getRandomNameRequestDecoder(stream)
- local res = roleHandler_pb.GetRandomNameResponse()
- res:ParseFromString(stream)
- return res
- end
- function Pomelo.RoleHandler.getRandomNameRequest(c2s_sex,cb,option)
- local msg = {}
- msg.c2s_sex = c2s_sex
- Socket.OnRequestStart("connector.roleHandler.getRandomNameRequest", option)
- Socket.Request("connector.roleHandler.getRandomNameRequest", msg, function(res)
- if(res.s2c_code == 200) then
- Pomelo.RoleHandler.lastGetRandomNameResponse = res
- Socket.OnRequestEnd("connector.roleHandler.getRandomNameRequest", 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] connector.roleHandler.getRandomNameRequest decode error!!"
- end
- Socket.OnRequestEnd("connector.roleHandler.getRandomNameRequest", false,ex.Code,ex.Message)
- cb(ex,nil)
- end
- end, getRandomNameRequestEncoder, getRandomNameRequestDecoder)
- end
- --------------------------------Pomelo-------------------------------
- return Pomelo
|