This commit is contained in:
aozhiwei 2024-03-19 19:17:05 +08:00
parent 3dd292a486
commit 2daa458610
3 changed files with 12 additions and 4 deletions

View File

@ -70,6 +70,7 @@ type Team interface {
OnPlayerOffline(Player)
OnPlayerOnline(Player)
IsCopy() bool
GetCopyIdx() int32
SendUpdateNotify()
SendStateNotify()
IsLeader(Player) bool

View File

@ -15,7 +15,7 @@ type team struct {
cs.MsgHandlerImpl
teamUuid string
nextTeamUuid string
isCopy bool
copyIdx int32
zoneId int32
nodeId int32
mapInfo* common.MapInfoRsp
@ -29,9 +29,11 @@ type team struct {
matchTick int64
}
func (this *team) init(teamUuid string, owner common.Player, msg *cs.CMLogin, mapInfo* common.MapInfoRsp) {
func (this *team) init(copyIdx int32, teamUuid string,
owner common.Player, msg *cs.CMLogin, mapInfo* common.MapInfoRsp) {
this.sortIdx++
this.teamUuid = teamUuid
this.copyIdx = copyIdx
this.zoneId = owner.GetZoneId()
this.nodeId = owner.GetNodeId()
this.mapInfo = mapInfo
@ -106,7 +108,11 @@ func (this *team) isFull() bool {
}
func (this *team) IsCopy() bool {
return this.isCopy
return this.copyIdx > 0
}
func (this *team) GetCopyIdx() int32 {
return this.copyIdx
}
func (this *team) Started() bool {
@ -364,6 +370,7 @@ func (this *team) genStartGameInfo() {
payload := sign + ":" + "normal_room|" + q5.EncodeJson(&startInfo)
this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.getMainTeam().GetTeamUuid())
this.stateNotifyMsg.JoinMsg.Payload = proto.String(payload)
this.stateNotifyMsg.NextTeamUuid = proto.String(this.nextTeamUuid)
}
func (this *team) broadcastMsg(msg proto.Message) {

View File

@ -25,7 +25,7 @@ func (this *teamMgr) UnInit() {
func (this *teamMgr) CreateTeam(hum common.Player, msg *cs.CMLogin, mapInfo* common.MapInfoRsp) common.Team {
teamUuid := this.genTeamUuid(hum.GetZoneId(), hum.GetNodeId())
team := newTeam()
team.init(teamUuid, hum, msg, mapInfo)
team.init(0, teamUuid, hum, msg, mapInfo)
this.teamUuidHash[team.teamUuid] = team
return team
}