1
This commit is contained in:
parent
3dd292a486
commit
2daa458610
@ -70,6 +70,7 @@ type Team interface {
|
|||||||
OnPlayerOffline(Player)
|
OnPlayerOffline(Player)
|
||||||
OnPlayerOnline(Player)
|
OnPlayerOnline(Player)
|
||||||
IsCopy() bool
|
IsCopy() bool
|
||||||
|
GetCopyIdx() int32
|
||||||
SendUpdateNotify()
|
SendUpdateNotify()
|
||||||
SendStateNotify()
|
SendStateNotify()
|
||||||
IsLeader(Player) bool
|
IsLeader(Player) bool
|
||||||
|
@ -15,7 +15,7 @@ type team struct {
|
|||||||
cs.MsgHandlerImpl
|
cs.MsgHandlerImpl
|
||||||
teamUuid string
|
teamUuid string
|
||||||
nextTeamUuid string
|
nextTeamUuid string
|
||||||
isCopy bool
|
copyIdx int32
|
||||||
zoneId int32
|
zoneId int32
|
||||||
nodeId int32
|
nodeId int32
|
||||||
mapInfo* common.MapInfoRsp
|
mapInfo* common.MapInfoRsp
|
||||||
@ -29,9 +29,11 @@ type team struct {
|
|||||||
matchTick int64
|
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.sortIdx++
|
||||||
this.teamUuid = teamUuid
|
this.teamUuid = teamUuid
|
||||||
|
this.copyIdx = copyIdx
|
||||||
this.zoneId = owner.GetZoneId()
|
this.zoneId = owner.GetZoneId()
|
||||||
this.nodeId = owner.GetNodeId()
|
this.nodeId = owner.GetNodeId()
|
||||||
this.mapInfo = mapInfo
|
this.mapInfo = mapInfo
|
||||||
@ -106,7 +108,11 @@ func (this *team) isFull() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) IsCopy() 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 {
|
func (this *team) Started() bool {
|
||||||
@ -364,6 +370,7 @@ func (this *team) genStartGameInfo() {
|
|||||||
payload := sign + ":" + "normal_room|" + q5.EncodeJson(&startInfo)
|
payload := sign + ":" + "normal_room|" + q5.EncodeJson(&startInfo)
|
||||||
this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.getMainTeam().GetTeamUuid())
|
this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.getMainTeam().GetTeamUuid())
|
||||||
this.stateNotifyMsg.JoinMsg.Payload = proto.String(payload)
|
this.stateNotifyMsg.JoinMsg.Payload = proto.String(payload)
|
||||||
|
this.stateNotifyMsg.NextTeamUuid = proto.String(this.nextTeamUuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) broadcastMsg(msg proto.Message) {
|
func (this *team) broadcastMsg(msg proto.Message) {
|
||||||
|
@ -25,7 +25,7 @@ func (this *teamMgr) UnInit() {
|
|||||||
func (this *teamMgr) CreateTeam(hum common.Player, msg *cs.CMLogin, mapInfo* common.MapInfoRsp) common.Team {
|
func (this *teamMgr) CreateTeam(hum common.Player, msg *cs.CMLogin, mapInfo* common.MapInfoRsp) common.Team {
|
||||||
teamUuid := this.genTeamUuid(hum.GetZoneId(), hum.GetNodeId())
|
teamUuid := this.genTeamUuid(hum.GetZoneId(), hum.GetNodeId())
|
||||||
team := newTeam()
|
team := newTeam()
|
||||||
team.init(teamUuid, hum, msg, mapInfo)
|
team.init(0, teamUuid, hum, msg, mapInfo)
|
||||||
this.teamUuidHash[team.teamUuid] = team
|
this.teamUuidHash[team.teamUuid] = team
|
||||||
return team
|
return team
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user