This commit is contained in:
aozhiwei 2023-09-15 16:30:11 +08:00
parent 9a6fdb07e6
commit 012d39bff2
2 changed files with 5 additions and 2 deletions

View File

@ -190,6 +190,7 @@ message SMCreateRoom
{ {
optional int32 errcode = 1; // 0 1: optional int32 errcode = 1; // 0 1:
optional string errmsg = 2; // optional string errmsg = 2; //
optional string room_id = 3; //
} }
// //

View File

@ -39,6 +39,7 @@ func (this *roomMgr) ProcessCMMsg(handler *cs.CsNetMsgHandler, hdr *f5.MsgHdr) {
case constant.ROOM_MGR_HANDLER_ID: case constant.ROOM_MGR_HANDLER_ID:
hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket()) hum := GetPlayerMgr().GetPlayerBySocket(hdr.GetSocket())
if hum != nil { if hum != nil {
hdr.Context = hum
cs.DispatchMsg(handler, hdr, this) cs.DispatchMsg(handler, hdr, this)
} }
case constant.ROOM_HANDLER_ID: case constant.ROOM_HANDLER_ID:
@ -63,6 +64,7 @@ func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
m.init(q5.ToString(this.genRoomId()), this.genRoomIdx(), msg.GetMapId(), hum, msg.GetPasswd()) m.init(q5.ToString(this.genRoomId()), this.genRoomIdx(), msg.GetMapId(), hum, msg.GetPasswd())
this.idHash[m.roomId] = m this.idHash[m.roomId] = m
rspMsg.RoomId = proto.String(m.roomId)
hum.SendMsg(rspMsg) hum.SendMsg(rspMsg)
} }
@ -119,11 +121,11 @@ func (this *roomMgr) CMSearchRoom(hdr *f5.MsgHdr, msg *cs.CMSearchRoom) {
hum.SendMsg(&rspMsg) hum.SendMsg(&rspMsg)
} }
func (this *roomMgr) genRoomId() int32 { func (this *roomMgr) genRoomId() int32 {
this.currRoomId++ this.currRoomId++
return this.currRoomId return this.currRoomId
} }
func (this *roomMgr) genRoomIdx() int64 { func (this *roomMgr) genRoomIdx() int64 {
return f5.GetApp().NewUuid() return f5.GetApp().NewUuid()
} }