package cs import ( "f5" proto "github.com/golang/protobuf/proto" ) type CsNetMsgHandler f5.NetMsgHandler[MsgHandler]; type MsgHandlerImpl struct { } var handlers [2000]*CsNetMsgHandler func GetNetMsgHandler(msgId uint16) *CsNetMsgHandler { handler := handlers[msgId] return handler } func DispatchMsg(handler *CsNetMsgHandler, hdr *f5.MsgHdr, msgHandler MsgHandler) { handler.Cb(hdr, msgHandler) } func RegHandlerId(msgId int, handlerId int) { handler := handlers[msgId] handler.HandlerId = handlerId } func ParsePb(msgId uint16, data []byte) interface{} { handler := handlers[msgId] if handler == nil { return nil } return handler.ParseCb(data) } type MsgHandler interface { CMPing(*f5.MsgHdr, *CMPing) CMLogin(*f5.MsgHdr, *CMLogin) CMReconnect(*f5.MsgHdr, *CMReconnect) CMLeaveTeam(*f5.MsgHdr, *CMLeaveTeam) CMDisbandTeam(*f5.MsgHdr, *CMDisbandTeam) CMKickOut(*f5.MsgHdr, *CMKickOut) CMHandoverLeader(*f5.MsgHdr, *CMHandoverLeader) CMStartGame(*f5.MsgHdr, *CMStartGame) CMCancel(*f5.MsgHdr, *CMCancel) CMSetReady(*f5.MsgHdr, *CMSetReady) CMSetSpecSkill(*f5.MsgHdr, *CMSetSpecSkill) CMChooseHero(*f5.MsgHdr, *CMChooseHero) CMChooseMap(*f5.MsgHdr, *CMChooseMap) CMRefreshUser(*f5.MsgHdr, *CMRefreshUser) CMGrantInvitePermission(*f5.MsgHdr, *CMGrantInvitePermission) } func (this *MsgHandlerImpl) CMPing(hdr *f5.MsgHdr, msg *CMPing) { } func (this *MsgHandlerImpl) CMLogin(hdr *f5.MsgHdr, msg *CMLogin) { } func (this *MsgHandlerImpl) CMReconnect(hdr *f5.MsgHdr, msg *CMReconnect) { } func (this *MsgHandlerImpl) CMLeaveTeam(hdr *f5.MsgHdr, msg *CMLeaveTeam) { } func (this *MsgHandlerImpl) CMDisbandTeam(hdr *f5.MsgHdr, msg *CMDisbandTeam) { } func (this *MsgHandlerImpl) CMKickOut(hdr *f5.MsgHdr, msg *CMKickOut) { } func (this *MsgHandlerImpl) CMHandoverLeader(hdr *f5.MsgHdr, msg *CMHandoverLeader) { } func (this *MsgHandlerImpl) CMStartGame(hdr *f5.MsgHdr, msg *CMStartGame) { } func (this *MsgHandlerImpl) CMCancel(hdr *f5.MsgHdr, msg *CMCancel) { } func (this *MsgHandlerImpl) CMSetReady(hdr *f5.MsgHdr, msg *CMSetReady) { } func (this *MsgHandlerImpl) CMSetSpecSkill(hdr *f5.MsgHdr, msg *CMSetSpecSkill) { } func (this *MsgHandlerImpl) CMChooseHero(hdr *f5.MsgHdr, msg *CMChooseHero) { } func (this *MsgHandlerImpl) CMChooseMap(hdr *f5.MsgHdr, msg *CMChooseMap) { } func (this *MsgHandlerImpl) CMRefreshUser(hdr *f5.MsgHdr, msg *CMRefreshUser) { } func (this *MsgHandlerImpl) CMGrantInvitePermission(hdr *f5.MsgHdr, msg *CMGrantInvitePermission) { } func (this *CMPing) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMPing) } func (this *SMPing) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMPing) } func (this *SMRpcError) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMRpcError) } func (this *CMLogin) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMLogin) } func (this *SMLogin) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMLogin) } func (this *CMReconnect) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMReconnect) } func (this *SMReconnect) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMReconnect) } func (this *CMLeaveTeam) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMLeaveTeam) } func (this *SMLeaveTeam) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMLeaveTeam) } func (this *CMDisbandTeam) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMDisbandTeam) } func (this *SMDisbandTeam) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMDisbandTeam) } func (this *CMKickOut) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMKickOut) } func (this *SMKickOut) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMKickOut) } func (this *CMHandoverLeader) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMHandoverLeader) } func (this *SMHandoverLeader) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMHandoverLeader) } func (this *CMStartGame) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMStartGame) } func (this *SMStartGame) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMStartGame) } func (this *CMCancel) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMCancel) } func (this *SMCancel) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMCancel) } func (this *CMSetReady) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMSetReady) } func (this *SMSetReady) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMSetReady) } func (this *CMSetSpecSkill) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMSetSpecSkill) } func (this *SMSetSpecSkill) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMSetSpecSkill) } func (this *CMChooseHero) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMChooseHero) } func (this *SMChooseHero) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMChooseHero) } func (this *CMChooseMap) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMChooseMap) } func (this *SMChooseMap) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMChooseMap) } func (this *CMRefreshUser) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMRefreshUser) } func (this *SMRefreshUser) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMRefreshUser) } func (this *CMGrantInvitePermission) GetNetMsgId() uint16 { return uint16(CMMessageIdE__CMGrantInvitePermission) } func (this *SMGrantInvitePermission) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMGrantInvitePermission) } func (this *SMTeamUpdateNotify) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMTeamUpdateNotify) } func (this *SMTeamStateNotify) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMTeamStateNotify) } func (this *SMTeamDisbandNotify) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMTeamDisbandNotify) } func (this *SMTeamKickoutNotify) GetNetMsgId() uint16 { return uint16(SMMessageIdE__SMTeamKickoutNotify) } func (this *SMLogin) Err(errCode int32, errMsg string) *SMLogin { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMReconnect) Err(errCode int32, errMsg string) *SMReconnect { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMLeaveTeam) Err(errCode int32, errMsg string) *SMLeaveTeam { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMDisbandTeam) Err(errCode int32, errMsg string) *SMDisbandTeam { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMKickOut) Err(errCode int32, errMsg string) *SMKickOut { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMHandoverLeader) Err(errCode int32, errMsg string) *SMHandoverLeader { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMStartGame) Err(errCode int32, errMsg string) *SMStartGame { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMCancel) Err(errCode int32, errMsg string) *SMCancel { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMSetReady) Err(errCode int32, errMsg string) *SMSetReady { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMSetSpecSkill) Err(errCode int32, errMsg string) *SMSetSpecSkill { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMChooseHero) Err(errCode int32, errMsg string) *SMChooseHero { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMChooseMap) Err(errCode int32, errMsg string) *SMChooseMap { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func (this *SMGrantInvitePermission) Err(errCode int32, errMsg string) *SMGrantInvitePermission { this.Errcode = proto.Int32(errCode) this.Errmsg = proto.String(errMsg) return this } func init() { handlers[int(CMMessageIdE__CMPing)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMPing), ParseCb: func (data []byte) interface{} { msg := &CMPing{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMPing(hdr, hdr.Msg.(*CMPing)) }, } handlers[int(CMMessageIdE__CMLogin)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMLogin), ParseCb: func (data []byte) interface{} { msg := &CMLogin{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMLogin(hdr, hdr.Msg.(*CMLogin)) }, } handlers[int(CMMessageIdE__CMReconnect)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMReconnect), ParseCb: func (data []byte) interface{} { msg := &CMReconnect{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMReconnect(hdr, hdr.Msg.(*CMReconnect)) }, } handlers[int(CMMessageIdE__CMLeaveTeam)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMLeaveTeam), ParseCb: func (data []byte) interface{} { msg := &CMLeaveTeam{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMLeaveTeam(hdr, hdr.Msg.(*CMLeaveTeam)) }, } handlers[int(CMMessageIdE__CMDisbandTeam)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMDisbandTeam), ParseCb: func (data []byte) interface{} { msg := &CMDisbandTeam{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMDisbandTeam(hdr, hdr.Msg.(*CMDisbandTeam)) }, } handlers[int(CMMessageIdE__CMKickOut)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMKickOut), ParseCb: func (data []byte) interface{} { msg := &CMKickOut{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMKickOut(hdr, hdr.Msg.(*CMKickOut)) }, } handlers[int(CMMessageIdE__CMHandoverLeader)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMHandoverLeader), ParseCb: func (data []byte) interface{} { msg := &CMHandoverLeader{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMHandoverLeader(hdr, hdr.Msg.(*CMHandoverLeader)) }, } handlers[int(CMMessageIdE__CMStartGame)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMStartGame), ParseCb: func (data []byte) interface{} { msg := &CMStartGame{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMStartGame(hdr, hdr.Msg.(*CMStartGame)) }, } handlers[int(CMMessageIdE__CMCancel)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMCancel), ParseCb: func (data []byte) interface{} { msg := &CMCancel{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMCancel(hdr, hdr.Msg.(*CMCancel)) }, } handlers[int(CMMessageIdE__CMSetReady)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMSetReady), ParseCb: func (data []byte) interface{} { msg := &CMSetReady{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMSetReady(hdr, hdr.Msg.(*CMSetReady)) }, } handlers[int(CMMessageIdE__CMSetSpecSkill)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMSetSpecSkill), ParseCb: func (data []byte) interface{} { msg := &CMSetSpecSkill{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMSetSpecSkill(hdr, hdr.Msg.(*CMSetSpecSkill)) }, } handlers[int(CMMessageIdE__CMChooseHero)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMChooseHero), ParseCb: func (data []byte) interface{} { msg := &CMChooseHero{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMChooseHero(hdr, hdr.Msg.(*CMChooseHero)) }, } handlers[int(CMMessageIdE__CMChooseMap)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMChooseMap), ParseCb: func (data []byte) interface{} { msg := &CMChooseMap{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMChooseMap(hdr, hdr.Msg.(*CMChooseMap)) }, } handlers[int(CMMessageIdE__CMRefreshUser)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMRefreshUser), ParseCb: func (data []byte) interface{} { msg := &CMRefreshUser{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMRefreshUser(hdr, hdr.Msg.(*CMRefreshUser)) }, } handlers[int(CMMessageIdE__CMGrantInvitePermission)] = &CsNetMsgHandler{ MsgId: int(CMMessageIdE__CMGrantInvitePermission), ParseCb: func (data []byte) interface{} { msg := &CMGrantInvitePermission{} proto.Unmarshal(data, msg) return msg }, Cb: func (hdr *f5.MsgHdr, handler MsgHandler) { handler.CMGrantInvitePermission(hdr, hdr.Msg.(*CMGrantInvitePermission)) }, } }