This commit is contained in:
aozhiwei 2023-09-16 10:41:46 +08:00
parent 140ee7a7f8
commit 45ea4ae464
4 changed files with 25 additions and 0 deletions

View File

@ -30,6 +30,8 @@ func (this *HandlerMgr) Init() {
cs.RegHandlerId(int(cs.CMMessageIdE__CMKickoutTeam), constant.ROOM_HANDLER_ID) cs.RegHandlerId(int(cs.CMMessageIdE__CMKickoutTeam), constant.ROOM_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMKickoutMember), constant.ROOM_HANDLER_ID) cs.RegHandlerId(int(cs.CMMessageIdE__CMKickoutMember), constant.ROOM_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMCloseNotify), constant.ROOM_HANDLER_ID) cs.RegHandlerId(int(cs.CMMessageIdE__CMCloseNotify), constant.ROOM_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMReportPingValue), constant.PLAYER_HANDLER_ID)
} }
func (this *HandlerMgr) UnInit() { func (this *HandlerMgr) UnInit() {

View File

@ -45,6 +45,7 @@ func (this *player) init(req *pendingLoginRequest, name string, avatarUrl string
this.name = name this.name = name
this.avatarUrl = avatarUrl this.avatarUrl = avatarUrl
this.heroId = heroId this.heroId = heroId
this.internalSetPing(req.msg.GetPing())
} }
func (this *player) onOffline(){ func (this *player) onOffline(){
@ -97,3 +98,17 @@ func (this *player) GetNodeId() int32 {
func (this *player) IsOnline() bool { func (this *player) IsOnline() bool {
return this.socket.IsValid() return this.socket.IsValid()
} }
func (this *player) CMReportPingValue(hdr *f5.MsgHdr, msg *cs.CMReportPingValue) {
this.internalSetPing(msg.GetPing())
}
func (this *player) internalSetPing(ping int32) {
if ping < 30 {
this.ping = 30
} else if ping > 1000 {
this.ping = 1000
} else {
this.ping = ping
}
}

View File

@ -19,6 +19,7 @@ enum CMMessageId_e
_CMKickoutTeam = 113; _CMKickoutTeam = 113;
_CMKickoutMember = 114; _CMKickoutMember = 114;
_CMCloseNotify = 115; _CMCloseNotify = 115;
_CMReportPingValue = 116;
} }
enum SMMessageId_e enum SMMessageId_e

View File

@ -152,6 +152,7 @@ message CMLogin
optional string session_id = 20; //id optional string session_id = 20; //id
optional int32 zone_id = 21; //Id optional int32 zone_id = 21; //Id
optional int32 node_id = 22; //id optional int32 node_id = 22; //id
optional int32 ping = 23; //id
} }
// //
@ -295,6 +296,12 @@ message CMCloseNotify
optional int32 param = 1; //1SMRoomGameStartNotify optional int32 param = 1; //1SMRoomGameStartNotify
} }
//ping值
message CMReportPingValue
{
optional int32 ping = 1;
}
// //
message SMRoomMemberChangeNotify message SMRoomMemberChangeNotify
{ {