This commit is contained in:
aozhiwei 2023-09-16 11:18:34 +08:00
parent 44a78dd2db
commit f7df50f3ab
2 changed files with 17 additions and 7 deletions

View File

@ -21,6 +21,7 @@ func (this *HandlerMgr) Init() {
cs.RegHandlerId(int(cs.CMMessageIdE__CMCreateRoom), constant.ROOM_MGR_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMJoinRoom), constant.ROOM_MGR_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMSearchRoom), constant.ROOM_MGR_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMGetCurrentRoom), constant.ROOM_MGR_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMDisbandRoom), constant.ROOM_HANDLER_ID)
cs.RegHandlerId(int(cs.CMMessageIdE__CMLeaveRoom), constant.ROOM_HANDLER_ID)

View File

@ -34,6 +34,15 @@ func (this *roomMgr) getRoom(roomId string) *room {
return nil
}
func (this *roomMgr) genRoomId() int32 {
this.currRoomId++
return this.currRoomId
}
func (this *roomMgr) genRoomIdx() int64 {
return f5.GetApp().NewUuid()
}
func (this *roomMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
switch handler.HandlerId {
case constant.ROOM_MGR_HANDLER_ID:
@ -126,11 +135,11 @@ func (this *roomMgr) CMSearchRoom(hdr *f5.MsgHdr, msg *cs.CMSearchRoom) {
hum.SendMsg(&rspMsg)
}
func (this *roomMgr) genRoomId() int32 {
this.currRoomId++
return this.currRoomId
}
func (this *roomMgr) genRoomIdx() int64 {
return f5.GetApp().NewUuid()
func (this *roomMgr) CMGetCurrentRoom(hdr *f5.MsgHdr, msg *cs.CMGetCurrentRoom) {
hum := hdr.Context.(common.Player)
rspMsg := &cs.SMGetCurrentRoom{}
if hum.GetRoom() != nil && hum.GetRoom().GetRoomState() == ROOM_INIT_STATE {
return
}
hum.SendMsg(rspMsg)
}