1
This commit is contained in:
parent
d2607bec10
commit
a6413c9ab2
@ -22,6 +22,7 @@ type Player interface {
|
|||||||
GetRoom() Room
|
GetRoom() Room
|
||||||
SetRoom(Room)
|
SetRoom(Room)
|
||||||
GetAccountId() string
|
GetAccountId() string
|
||||||
|
GetSessionId() string
|
||||||
GetName() string
|
GetName() string
|
||||||
GetAvatarUrl() string
|
GetAvatarUrl() string
|
||||||
GetHeroId() int32
|
GetHeroId() int32
|
||||||
|
@ -74,3 +74,7 @@ func (this *player) GetZoneId() int32 {
|
|||||||
func (this *player) GetNodeId() int32 {
|
func (this *player) GetNodeId() int32 {
|
||||||
return 0
|
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())
|
delete(this.socketHash, hdr.GetSocket())
|
||||||
hum.onOffline()
|
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
|
message CMCreateRoom
|
||||||
{
|
{
|
||||||
optional string passwd = 1; //密码,空:无密码
|
optional int32 map_id = 1; //地图id
|
||||||
|
optional string passwd = 2; //密码,空:无密码
|
||||||
}
|
}
|
||||||
|
|
||||||
message SMCreateRoom
|
message SMCreateRoom
|
||||||
|
@ -29,10 +29,13 @@ type room struct {
|
|||||||
startTimer *f5.TimerWp
|
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.roomId = roomId
|
||||||
this.roomIdx = roomIdx
|
this.roomIdx = roomIdx
|
||||||
this.entry.Init(this)
|
this.entry.Init(this)
|
||||||
|
this.config.mapId = mapId
|
||||||
|
this.config.zoneId = owner.GetZoneId()
|
||||||
|
this.config.nodeId = owner.GetNodeId()
|
||||||
this.config.passwd = passwd
|
this.config.passwd = passwd
|
||||||
this.owner = newMember(owner)
|
this.owner = newMember(owner)
|
||||||
this.members = map[string]*member{
|
this.members = map[string]*member{
|
||||||
|
@ -62,7 +62,7 @@ func (this *roomMgr) CMCreateRoom(hdr *f5.MsgHdr, msg *cs.CMCreateRoom) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
m := new(room)
|
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
|
this.idHash[m.roomId] = m
|
||||||
|
|
||||||
hum.SendMsg(rspMsg)
|
hum.SendMsg(rspMsg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user