1
This commit is contained in:
parent
d2607bec10
commit
a6413c9ab2
@ -22,6 +22,7 @@ type Player interface {
|
||||
GetRoom() Room
|
||||
SetRoom(Room)
|
||||
GetAccountId() string
|
||||
GetSessionId() string
|
||||
GetName() string
|
||||
GetAvatarUrl() string
|
||||
GetHeroId() int32
|
||||
|
@ -74,3 +74,7 @@ func (this *player) GetZoneId() int32 {
|
||||
func (this *player) GetNodeId() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (this *player) GetSessionId() string {
|
||||
return this.sessionId
|
||||
}
|
||||
|
@ -238,3 +238,25 @@ func (this *playerMgr) SS_WSP_SocketDisconnect(hdr *f5.MsgHdr, msg *ss.SS_WSP_So
|
||||
delete(this.socketHash, hdr.GetSocket())
|
||||
hum.onOffline()
|
||||
}
|
||||
|
||||
func (this *playerMgr) CMReconnect(hdr *f5.MsgHdr, msg *cs.CMReconnect) {
|
||||
hum := this.internalGetPlayerByAccountId(msg.GetAccountId())
|
||||
rspMsg := &cs.SMReconnect{}
|
||||
if hum == nil {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("")
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
return
|
||||
}
|
||||
if hum.GetSessionId() != msg.GetSessionId() {
|
||||
rspMsg.Errcode = proto.Int32(1)
|
||||
rspMsg.Errmsg = proto.String("")
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
return
|
||||
}
|
||||
if hum.socket.IsValid() {
|
||||
delete(this.socketHash, hum.socket)
|
||||
}
|
||||
this.socketHash[hdr.GetSocket()] = hum
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
@ -181,7 +181,8 @@ message SMReconnect
|
||||
//创建房间
|
||||
message CMCreateRoom
|
||||
{
|
||||
optional string passwd = 1; //密码,空:无密码
|
||||
optional int32 map_id = 1; //地图id
|
||||
optional string passwd = 2; //密码,空:无密码
|
||||
}
|
||||
|
||||
message SMCreateRoom
|
||||
|
@ -29,10 +29,13 @@ type room struct {
|
||||
startTimer *f5.TimerWp
|
||||
}
|
||||
|
||||
func (this *room) init(roomId string, roomIdx int64, owner common.Player, passwd string) {
|
||||
func (this *room) init(roomId string, roomIdx int64, mapId int32, owner common.Player, passwd string) {
|
||||
this.roomId = roomId
|
||||
this.roomIdx = roomIdx
|
||||
this.entry.Init(this)
|
||||
this.config.mapId = mapId
|
||||
this.config.zoneId = owner.GetZoneId()
|
||||
this.config.nodeId = owner.GetNodeId()
|
||||
this.config.passwd = passwd
|
||||
this.owner = newMember(owner)
|
||||
this.members = map[string]*member{
|
||||
|
@ -62,7 +62,7 @@ func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
|
||||
return
|
||||
}
|
||||
m := new(room)
|
||||
m.init(q5.ToString(this.genRoomId()), this.genRoomIdx(), hum, msg.GetPasswd())
|
||||
m.init(q5.ToString(this.genRoomId()), this.genRoomIdx(), msg.GetMapId(), hum, msg.GetPasswd())
|
||||
this.idHash[m.roomId] = m
|
||||
|
||||
hum.SendMsg(rspMsg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user