diff --git a/server/hallserver/listener/handlermgr.go b/server/hallserver/listener/handlermgr.go index 3d81da01..6a104baf 100644 --- a/server/hallserver/listener/handlermgr.go +++ b/server/hallserver/listener/handlermgr.go @@ -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) diff --git a/server/hallserver/room/roommgr.go b/server/hallserver/room/roommgr.go index 8bf2611e..8d45e1ec 100644 --- a/server/hallserver/room/roommgr.go +++ b/server/hallserver/room/roommgr.go @@ -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) }