1
This commit is contained in:
parent
e80f32c70b
commit
612c46eea8
@ -50,6 +50,7 @@ type Player interface {
|
|||||||
GetSessionId() string
|
GetSessionId() string
|
||||||
SendMsg(proto.Message)
|
SendMsg(proto.Message)
|
||||||
IsOnline() bool
|
IsOnline() bool
|
||||||
|
IsBattling() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -51,6 +51,7 @@ type MsgHandler interface {
|
|||||||
CMRemoveBlacklist(*f5.MsgHdr, *CMRemoveBlacklist)
|
CMRemoveBlacklist(*f5.MsgHdr, *CMRemoveBlacklist)
|
||||||
CMInviteFriendMsg(*f5.MsgHdr, *CMInviteFriendMsg)
|
CMInviteFriendMsg(*f5.MsgHdr, *CMInviteFriendMsg)
|
||||||
CMRecommendList(*f5.MsgHdr, *CMRecommendList)
|
CMRecommendList(*f5.MsgHdr, *CMRecommendList)
|
||||||
|
CMSetStatus(*f5.MsgHdr, *CMSetStatus)
|
||||||
CMSendChatMsg(*f5.MsgHdr, *CMSendChatMsg)
|
CMSendChatMsg(*f5.MsgHdr, *CMSendChatMsg)
|
||||||
CMReadMsgAndOpenChatNotify(*f5.MsgHdr, *CMReadMsgAndOpenChatNotify)
|
CMReadMsgAndOpenChatNotify(*f5.MsgHdr, *CMReadMsgAndOpenChatNotify)
|
||||||
CMSetCurrPrivateChatTarget(*f5.MsgHdr, *CMSetCurrPrivateChatTarget)
|
CMSetCurrPrivateChatTarget(*f5.MsgHdr, *CMSetCurrPrivateChatTarget)
|
||||||
@ -124,6 +125,9 @@ func (this *MsgHandlerImpl) CMInviteFriendMsg(hdr *f5.MsgHdr, msg *CMInviteFrien
|
|||||||
func (this *MsgHandlerImpl) CMRecommendList(hdr *f5.MsgHdr, msg *CMRecommendList) {
|
func (this *MsgHandlerImpl) CMRecommendList(hdr *f5.MsgHdr, msg *CMRecommendList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MsgHandlerImpl) CMSetStatus(hdr *f5.MsgHdr, msg *CMSetStatus) {
|
||||||
|
}
|
||||||
|
|
||||||
func (this *MsgHandlerImpl) CMSendChatMsg(hdr *f5.MsgHdr, msg *CMSendChatMsg) {
|
func (this *MsgHandlerImpl) CMSendChatMsg(hdr *f5.MsgHdr, msg *CMSendChatMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +329,14 @@ func (this *SMRecommendList) GetNetMsgId() uint16 {
|
|||||||
return uint16(SMMessageIdE__SMRecommendList)
|
return uint16(SMMessageIdE__SMRecommendList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *CMSetStatus) GetNetMsgId() uint16 {
|
||||||
|
return uint16(CMMessageIdE__CMSetStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SMSetStatus) GetNetMsgId() uint16 {
|
||||||
|
return uint16(SMMessageIdE__SMSetStatus)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *CMSendChatMsg) GetNetMsgId() uint16 {
|
func (this *CMSendChatMsg) GetNetMsgId() uint16 {
|
||||||
return uint16(CMMessageIdE__CMSendChatMsg)
|
return uint16(CMMessageIdE__CMSendChatMsg)
|
||||||
}
|
}
|
||||||
@ -931,6 +943,18 @@ func init() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlers[int(CMMessageIdE__CMSetStatus)] = &CsNetMsgHandler{
|
||||||
|
MsgId: int(CMMessageIdE__CMSetStatus),
|
||||||
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
msg := &CMSetStatus{}
|
||||||
|
proto.Unmarshal(data, msg)
|
||||||
|
return msg
|
||||||
|
},
|
||||||
|
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||||
|
handler.CMSetStatus(hdr, hdr.Msg.(*CMSetStatus))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
handlers[int(CMMessageIdE__CMSendChatMsg)] = &CsNetMsgHandler{
|
handlers[int(CMMessageIdE__CMSendChatMsg)] = &CsNetMsgHandler{
|
||||||
MsgId: int(CMMessageIdE__CMSendChatMsg),
|
MsgId: int(CMMessageIdE__CMSendChatMsg),
|
||||||
ParseCb: func (data []byte) interface{} {
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
@ -30,6 +30,7 @@ func (this *HandlerMgr) Init() {
|
|||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMRemoveBlacklist), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMRemoveBlacklist), constant.PLAYER_HANDLER_ID)
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMInviteFriendMsg), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMInviteFriendMsg), constant.PLAYER_HANDLER_ID)
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMRecommendList), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMRecommendList), constant.PLAYER_HANDLER_ID)
|
||||||
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMSetStatus), constant.PLAYER_HANDLER_ID)
|
||||||
|
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMGuildInfo), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMGuildInfo), constant.PLAYER_HANDLER_ID)
|
||||||
cs.RegHandlerId(int(cs.CMMessageIdE__CMRecommendGuildList), constant.PLAYER_HANDLER_ID)
|
cs.RegHandlerId(int(cs.CMMessageIdE__CMRecommendGuildList), constant.PLAYER_HANDLER_ID)
|
||||||
|
@ -15,6 +15,7 @@ type player struct {
|
|||||||
socket f5.WspCliConn
|
socket f5.WspCliConn
|
||||||
accountId string
|
accountId string
|
||||||
sessionId string
|
sessionId string
|
||||||
|
battling bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) init(req *pendingLoginRequest, rspObj *common.LoginRsp){
|
func (this *player) init(req *pendingLoginRequest, rspObj *common.LoginRsp){
|
||||||
@ -35,6 +36,10 @@ func (this *player) IsOnline() bool {
|
|||||||
return this.socket.IsValid()
|
return this.socket.IsValid()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) IsBattling() bool {
|
||||||
|
return this.battling
|
||||||
|
}
|
||||||
|
|
||||||
func (this *player) SendMsg(rspMsg proto.Message) {
|
func (this *player) SendMsg(rspMsg proto.Message) {
|
||||||
GetWspListener().SendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg)
|
GetWspListener().SendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg)
|
||||||
}
|
}
|
||||||
@ -339,6 +344,12 @@ func (this *player) CMRecommendList(hdr *f5.MsgHdr, msg *cs.CMRecommendList) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) CMSetStatus(hdr *f5.MsgHdr, msg *cs.CMSetStatus) {
|
||||||
|
rspMsg := new(cs.SMSetStatus)
|
||||||
|
this.battling = msg.GetBattling() > 0
|
||||||
|
this.SendMsg(rspMsg)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *player) CMSendChatMsg(hdr *f5.MsgHdr, msg *cs.CMSendChatMsg) {
|
func (this *player) CMSendChatMsg(hdr *f5.MsgHdr, msg *cs.CMSendChatMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ enum CMMessageId_e
|
|||||||
_CMBlacklist = 116;
|
_CMBlacklist = 116;
|
||||||
_CMInviteFriendMsg = 117;
|
_CMInviteFriendMsg = 117;
|
||||||
_CMRecommendList = 118;
|
_CMRecommendList = 118;
|
||||||
|
_CMSetStatus = 119;
|
||||||
|
|
||||||
// 聊天相关
|
// 聊天相关
|
||||||
_CMSetCurrPrivateChatTarget = 200;
|
_CMSetCurrPrivateChatTarget = 200;
|
||||||
@ -75,6 +76,7 @@ enum SMMessageId_e
|
|||||||
_SMBlacklist = 116;
|
_SMBlacklist = 116;
|
||||||
_SMInviteFriendMsg = 117;
|
_SMInviteFriendMsg = 117;
|
||||||
_SMRecommendList = 118;
|
_SMRecommendList = 118;
|
||||||
|
_SMSetStatus = 119;
|
||||||
|
|
||||||
// 公会相关
|
// 公会相关
|
||||||
_SMGuildInfo = 120;
|
_SMGuildInfo = 120;
|
||||||
|
@ -373,6 +373,16 @@ message SMRecommendList
|
|||||||
optional int32 type = 4;
|
optional int32 type = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置状态
|
||||||
|
message CMSetStatus
|
||||||
|
{
|
||||||
|
optional int32 battling = 1; //是否战斗中
|
||||||
|
}
|
||||||
|
|
||||||
|
message SMSetStatus
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// --- 聊天 ---
|
// --- 聊天 ---
|
||||||
// 发送聊天消息
|
// 发送聊天消息
|
||||||
message CMSendChatMsg
|
message CMSendChatMsg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user