1
This commit is contained in:
parent
0f2e90257e
commit
de5e85fabe
@ -120,7 +120,8 @@ message MFMember
|
||||
message MFTeam
|
||||
{
|
||||
optional int32 team_id = 1; //队伍id
|
||||
repeated MFMember members = 2; //成员列表
|
||||
optional string team_uuid = 2; //队伍唯一id
|
||||
repeated MFMember members = 3; //成员列表
|
||||
}
|
||||
|
||||
//自己所在房间信息
|
||||
@ -270,7 +271,7 @@ message CMSetPrepare
|
||||
//踢队伍(房主才有权限)
|
||||
message CMKickoutTeam
|
||||
{
|
||||
optional int32 team_id = 1; //队伍id
|
||||
optional string team_uuid = 1; //队伍唯一id
|
||||
}
|
||||
|
||||
//踢成员
|
||||
|
@ -76,7 +76,7 @@ func (this *room) getMember(accountId string) *member {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *room) getTeam(teamUuid string) *team {
|
||||
func (this *room) getTeamByUuid(teamUuid string) *team {
|
||||
t, ok := this.teamUuidHash[teamUuid]
|
||||
if ok {
|
||||
return t
|
||||
@ -84,6 +84,14 @@ func (this *room) getTeam(teamUuid string) *team {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *room) getTeamById(teamId int32) *team {
|
||||
t, ok := this.teamIdHash[teamId]
|
||||
if ok {
|
||||
return t
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *room) getTeamNum() int32 {
|
||||
return int32(len(this.teamUuidHash))
|
||||
}
|
||||
@ -104,7 +112,7 @@ func (this *room) canJoin(member common.Player, passwd string) bool {
|
||||
if this.config.passwd != passwd {
|
||||
return false
|
||||
}
|
||||
t := this.getTeam(member.GetTeamUuid())
|
||||
t := this.getTeamByUuid(member.GetTeamUuid())
|
||||
if t != nil && t.getMemberNum() >= constant.ROOM_MAX_TEAM_MEMBER_NUM {
|
||||
return false
|
||||
}
|
||||
@ -117,7 +125,7 @@ func (this *room) join(hum common.Player, passwd string) bool {
|
||||
}
|
||||
m := newMember(this, hum)
|
||||
this.members[hum.GetAccountId()] = m
|
||||
t := this.getTeam(hum.GetTeamUuid())
|
||||
t := this.getTeamByUuid(hum.GetTeamUuid())
|
||||
if t == nil {
|
||||
t = newTeam(this, this.genTeamId(), m)
|
||||
this.teamUuidHash[hum.GetTeamUuid()] = t
|
||||
@ -204,7 +212,7 @@ func (this *room) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
||||
func (this *room) CMSetPrepare(hdr *f5.MsgHdr, msg *cs.CMSetPrepare) {
|
||||
hum := hdr.Context.(common.Player)
|
||||
m := this.getMember(hum.GetAccountId())
|
||||
if m != nil {
|
||||
if m != nil && m != this.owner {
|
||||
m.state = MEMBER_READY_STATE
|
||||
notifyMsg := &cs.SMRoomMemberChangeNotify{}
|
||||
notifyMsg.Member = new(cs.MFMember)
|
||||
@ -216,7 +224,8 @@ func (this *room) CMSetPrepare(hdr *f5.MsgHdr, msg *cs.CMSetPrepare) {
|
||||
func (this *room) CMKickoutTeam(hdr *f5.MsgHdr, msg *cs.CMKickoutTeam) {
|
||||
hum := hdr.Context.(common.Player)
|
||||
m := this.getMember(hum.GetAccountId())
|
||||
if m != nil {
|
||||
t := this.getTeamByUuid(msg.GetTeamUuid())
|
||||
if m == this.owner && t != nil {
|
||||
notifyMsg := &cs.SMRoomKickoutNotify{}
|
||||
this.broadcastMsg(notifyMsg)
|
||||
}
|
||||
@ -225,7 +234,7 @@ func (this *room) CMKickoutTeam(hdr *f5.MsgHdr, msg *cs.CMKickoutTeam) {
|
||||
func (this *room) CMKickoutMember(hdr *f5.MsgHdr, msg *cs.CMKickoutMember) {
|
||||
hum := hdr.Context.(common.Player)
|
||||
m := this.getMember(hum.GetAccountId())
|
||||
if m != nil {
|
||||
if m == this.owner {
|
||||
notifyMsg := &cs.SMRoomKickoutNotify{}
|
||||
this.broadcastMsg(notifyMsg)
|
||||
}
|
||||
|
@ -36,9 +36,6 @@ func (this *team) addMember(m *member) {
|
||||
this.members.AddTail(&m.teamEntry)
|
||||
}
|
||||
|
||||
func (this *team) removeMember(m *member) {
|
||||
}
|
||||
|
||||
func (this *team) getMemberNum() int32 {
|
||||
return this.members.Size()
|
||||
}
|
||||
|
2
third_party/q5
vendored
2
third_party/q5
vendored
@ -1 +1 @@
|
||||
Subproject commit f0ba360bdc5a4045c3ef54fcb84a198e09fbe254
|
||||
Subproject commit 867867b5d62818c6dc1474fb9dba487075038e45
|
Loading…
x
Reference in New Issue
Block a user