1
This commit is contained in:
parent
9a6fdb07e6
commit
012d39bff2
@ -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; //房间号
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取房间列表
|
//获取房间列表
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user