1
This commit is contained in:
parent
140ee7a7f8
commit
45ea4ae464
@ -30,6 +30,8 @@ func (this *HandlerMgr) Init() {
|
||||
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__CMCloseNotify), constant.ROOM_HANDLER_ID)
|
||||
|
||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMReportPingValue), constant.PLAYER_HANDLER_ID)
|
||||
}
|
||||
|
||||
func (this *HandlerMgr) UnInit() {
|
||||
|
@ -45,6 +45,7 @@ func (this *player) init(req *pendingLoginRequest, name string, avatarUrl string
|
||||
this.name = name
|
||||
this.avatarUrl = avatarUrl
|
||||
this.heroId = heroId
|
||||
this.internalSetPing(req.msg.GetPing())
|
||||
}
|
||||
|
||||
func (this *player) onOffline(){
|
||||
@ -97,3 +98,17 @@ func (this *player) GetNodeId() int32 {
|
||||
func (this *player) IsOnline() bool {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ enum CMMessageId_e
|
||||
_CMKickoutTeam = 113;
|
||||
_CMKickoutMember = 114;
|
||||
_CMCloseNotify = 115;
|
||||
_CMReportPingValue = 116;
|
||||
}
|
||||
|
||||
enum SMMessageId_e
|
||||
|
@ -152,6 +152,7 @@ message CMLogin
|
||||
optional string session_id = 20; //账号id
|
||||
optional int32 zone_id = 21; //国家Id
|
||||
optional int32 node_id = 22; //节点id
|
||||
optional int32 ping = 23; //节点id
|
||||
}
|
||||
|
||||
//登录回复
|
||||
@ -295,6 +296,12 @@ message CMCloseNotify
|
||||
optional int32 param = 1; //1:关闭SMRoomGameStartNotify
|
||||
}
|
||||
|
||||
//上报ping值
|
||||
message CMReportPingValue
|
||||
{
|
||||
optional int32 ping = 1;
|
||||
}
|
||||
|
||||
//房间成员信息变更通知
|
||||
message SMRoomMemberChangeNotify
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user