1
This commit is contained in:
parent
c8db883ac3
commit
3d2b4cea64
@ -27,6 +27,12 @@ func (this *member) init(room *room, hum common.Player) {
|
|||||||
|
|
||||||
func (this *member) unInit() {
|
func (this *member) unInit() {
|
||||||
this.teamEntry.DelInit()
|
this.teamEntry.DelInit()
|
||||||
|
delete(this.room.members, this.hum.GetAccountId())
|
||||||
|
if this.hum.GetRoom() == this.room {
|
||||||
|
this.hum.SetRoom(nil)
|
||||||
|
}
|
||||||
|
this.room = nil
|
||||||
|
this.team = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *member) fillMFMember(pb *cs.MFMember) {
|
func (this *member) fillMFMember(pb *cs.MFMember) {
|
||||||
|
@ -323,7 +323,7 @@ func (this *room) notifyGameStart() {
|
|||||||
ele := q5.NewSliceElement(&startInfo.TeamList)
|
ele := q5.NewSliceElement(&startInfo.TeamList)
|
||||||
ele.TeamUuid = t.teamUuid
|
ele.TeamUuid = t.teamUuid
|
||||||
q5.NewSlice(&ele.Members, 0, 4)
|
q5.NewSlice(&ele.Members, 0, 4)
|
||||||
t.members.ForEach_r(
|
t.members.ForEach(
|
||||||
func (data interface{}) bool {
|
func (data interface{}) bool {
|
||||||
m := data.(*member)
|
m := data.(*member)
|
||||||
if m.state == MEMBER_READY_STATE {
|
if m.state == MEMBER_READY_STATE {
|
||||||
@ -401,7 +401,10 @@ func (this *room) genTeamId() int32 {
|
|||||||
func (this *room) removeMember(accountId string) {
|
func (this *room) removeMember(accountId string) {
|
||||||
m := this.getMember(accountId)
|
m := this.getMember(accountId)
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
t := m.team
|
||||||
m.unInit()
|
m.unInit()
|
||||||
delete(this.members, accountId)
|
if t.getMemberNum() <= 0 {
|
||||||
|
t.unInit()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ func (this *roomMgr) CMSearchRoom(hdr *f5.MsgHdr, msg *cs.CMSearchRoom) {
|
|||||||
rspMsg := cs.SMSearchRoom{}
|
rspMsg := cs.SMSearchRoom{}
|
||||||
rspMsg.Rows = make([]*cs.MFRoom, constant.SEARCH_ROOM_PAGE_SIZE, constant.SEARCH_ROOM_PAGE_SIZE)
|
rspMsg.Rows = make([]*cs.MFRoom, constant.SEARCH_ROOM_PAGE_SIZE, constant.SEARCH_ROOM_PAGE_SIZE)
|
||||||
sinceId := msg.GetSinceId()
|
sinceId := msg.GetSinceId()
|
||||||
this.roomList.ForEach_r(
|
this.roomList.ForEach(
|
||||||
func (data interface{}) bool {
|
func (data interface{}) bool {
|
||||||
r := data.(room)
|
r := data.(room)
|
||||||
if r.roomIdx > sinceId && r.viewable() {
|
if r.roomIdx > sinceId && r.viewable() {
|
||||||
|
@ -19,7 +19,13 @@ func (this *team) init(room *room, teamId int32, teamUuid string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) unInit() {
|
func (this *team) unInit() {
|
||||||
|
this.members.ForEach(
|
||||||
|
func (data interface{}) bool {
|
||||||
|
m := data.(*member)
|
||||||
|
m.unInit()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
this.room = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) addMember(m *member) {
|
func (this *team) addMember(m *member) {
|
||||||
@ -30,13 +36,16 @@ func (this *team) addMember(m *member) {
|
|||||||
this.members.AddTail(&m.teamEntry)
|
this.members.AddTail(&m.teamEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *team) removeMember(m *member) {
|
||||||
|
}
|
||||||
|
|
||||||
func (this *team) getMemberNum() int32 {
|
func (this *team) getMemberNum() int32 {
|
||||||
return this.members.Size()
|
return this.members.Size()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) hasAlreadMember() bool {
|
func (this *team) hasAlreadMember() bool {
|
||||||
ok := false
|
ok := false
|
||||||
this.members.ForEach_r(
|
this.members.ForEach(
|
||||||
func (data interface{}) bool {
|
func (data interface{}) bool {
|
||||||
m := data.(*member)
|
m := data.(*member)
|
||||||
if m.state == MEMBER_READY_STATE {
|
if m.state == MEMBER_READY_STATE {
|
||||||
@ -50,7 +59,7 @@ func (this *team) hasAlreadMember() bool {
|
|||||||
|
|
||||||
func (this *team) getOwnerCandidate() *member {
|
func (this *team) getOwnerCandidate() *member {
|
||||||
var ownerCandidate *member
|
var ownerCandidate *member
|
||||||
this.members.ForEach_r(
|
this.members.ForEach(
|
||||||
func (data interface{}) bool {
|
func (data interface{}) bool {
|
||||||
m := data.(*member)
|
m := data.(*member)
|
||||||
if m.hum.IsOnline() {
|
if m.hum.IsOnline() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user