This commit is contained in:
aozhiwei 2023-09-16 10:22:53 +08:00
parent 5ecc1063ad
commit 140ee7a7f8

View File

@ -50,6 +50,10 @@ func (this *room) init(roomId string, roomIdx int64,
this.addTeam(newTeam(this, this.genTeamId(), msg.GetTeamUuid(), this.owner))
}
func (this *room) unInit() {
}
func (this *room) addMember(m *member) {
this.members[m.hum.GetAccountId()] = m
m.hum.SetRoom(this)
@ -179,6 +183,7 @@ func (this *room) CMLeaveRoom(hdr *f5.MsgHdr, msg *cs.CMLeaveRoom) {
q5.NewSlice(&notifyMsg.AccountIds, 0, 1)
q5.AppendSlice(&notifyMsg.AccountIds, m.hum.GetAccountId())
this.broadcastMsg(notifyMsg)
this.notifyRoomInfo()
}
}
@ -194,6 +199,7 @@ func (this *room) CMModifyRoom(hdr *f5.MsgHdr, msg *cs.CMModifyRoom) {
}
}
hum.SendMsg(&rspMsg)
this.notifyRoomInfo()
}
func (this *room) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
@ -229,6 +235,7 @@ func (this *room) CMKickoutTeam(hdr *f5.MsgHdr, msg *cs.CMKickoutTeam) {
notifyMsg := &cs.SMRoomKickoutNotify{}
this.broadcastMsg(notifyMsg)
t.unInit()
this.notifyRoomInfo()
}
}
@ -241,6 +248,7 @@ func (this *room) CMKickoutMember(hdr *f5.MsgHdr, msg *cs.CMKickoutMember) {
notifyMsg.AccountIds = append(notifyMsg.AccountIds, msg.GetTargetId())
this.broadcastMsg(notifyMsg)
this.removeMember(target.hum.GetAccountId())
this.notifyRoomInfo()
}
}
@ -426,6 +434,14 @@ func (this *room) removeMember(accountId string) {
}
}
func (this *room) notifyRoomInfo() {
notifyMsg := &cs.SMRoomChangeNotify{}
notifyMsg.Room = new(cs.MFRoom)
this.fillMFRoom(notifyMsg.Room)
this.broadcastMsg(notifyMsg)
}
func newRoom() *room {
r := new(room)
r.teamUuidHash = map[string]*team{}