1
This commit is contained in:
parent
a8ff5bf545
commit
0fb392a77d
@ -114,6 +114,7 @@ type Player interface {
|
|||||||
FillMFTeamMember(*cs.MFTeamMember)
|
FillMFTeamMember(*cs.MFTeamMember)
|
||||||
GetSortIdx() int32
|
GetSortIdx() int32
|
||||||
SetSortIdx(int32)
|
SetSortIdx(int32)
|
||||||
|
GenNextCopy() Player
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -161,6 +161,25 @@ func (this *player) SetSortIdx(sortIdx int32) {
|
|||||||
this.sortIdx = sortIdx
|
this.sortIdx = sortIdx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *player) GenNextCopy() common.Player {
|
||||||
|
nextCopy := newPlayer()
|
||||||
|
//nextCopy.socket
|
||||||
|
nextCopy.accountId = this.accountId
|
||||||
|
nextCopy.sessionId = this.sessionId
|
||||||
|
nextCopy.zoneId = this.zoneId
|
||||||
|
nextCopy.nodeId = this.nodeId
|
||||||
|
nextCopy.name = this.name
|
||||||
|
nextCopy.avatarUrl = this.avatarUrl
|
||||||
|
nextCopy.headFrame = this.headFrame
|
||||||
|
nextCopy.state = 0
|
||||||
|
nextCopy.isReady = 0
|
||||||
|
nextCopy.permission = 0
|
||||||
|
nextCopy.hero = this.hero
|
||||||
|
nextCopy.team = nil
|
||||||
|
nextCopy.sortIdx = 0
|
||||||
|
return nextCopy
|
||||||
|
}
|
||||||
|
|
||||||
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
|
||||||
member_pb.AccountId = proto.String(this.accountId)
|
member_pb.AccountId = proto.String(this.accountId)
|
||||||
member_pb.Name = proto.String(this.name)
|
member_pb.Name = proto.String(this.name)
|
||||||
|
@ -30,12 +30,13 @@ type team struct {
|
|||||||
matchTick int64
|
matchTick int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) init(copyIdx int32, teamUuid string, owner common.Player, mapInfo* common.MapInfoRsp) {
|
func (this *team) init(copyIdx int32, zoneId int32, nodeId int32,
|
||||||
|
teamUuid string, owner common.Player, mapInfo* common.MapInfoRsp) {
|
||||||
this.sortIdx++
|
this.sortIdx++
|
||||||
this.teamUuid = teamUuid
|
this.teamUuid = teamUuid
|
||||||
this.copyIdx = copyIdx
|
this.copyIdx = copyIdx
|
||||||
this.zoneId = owner.GetZoneId()
|
this.zoneId = zoneId
|
||||||
this.nodeId = owner.GetNodeId()
|
this.nodeId = nodeId
|
||||||
this.mapInfo = mapInfo
|
this.mapInfo = mapInfo
|
||||||
this.owner = owner
|
this.owner = owner
|
||||||
this.owner.SetPermission(1)
|
this.owner.SetPermission(1)
|
||||||
@ -394,7 +395,8 @@ func (this *team) genNextCopyTeam() {
|
|||||||
nextMapInfo := &common.MapInfoRsp{}
|
nextMapInfo := &common.MapInfoRsp{}
|
||||||
*nextMapInfo = *this.mapInfo
|
*nextMapInfo = *this.mapInfo
|
||||||
nextTeam := newTeam()
|
nextTeam := newTeam()
|
||||||
nextTeam.init(nextCopyIdx, this.nextTeamUuid, this.owner, nextMapInfo)
|
nextTeam.init(nextCopyIdx, this.zoneId, this.nodeId,
|
||||||
|
this.nextTeamUuid, this.owner.GenNextCopy(), nextMapInfo)
|
||||||
_teamMgr.addTeam(nextTeam)
|
_teamMgr.addTeam(nextTeam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func (this *teamMgr) CreateTeam(hum common.Player, msg *cs.CMLogin, mapInfo* com
|
|||||||
var copyIdx int32 = 0
|
var copyIdx int32 = 0
|
||||||
teamUuid := this.genTeamUuid(copyIdx, hum.GetZoneId(), hum.GetNodeId())
|
teamUuid := this.genTeamUuid(copyIdx, hum.GetZoneId(), hum.GetNodeId())
|
||||||
team := newTeam()
|
team := newTeam()
|
||||||
team.init(copyIdx, teamUuid, hum, mapInfo)
|
team.init(copyIdx, hum.GetZoneId(), hum.GetNodeId(), teamUuid, hum, mapInfo)
|
||||||
this.teamUuidHash[team.teamUuid] = team
|
this.teamUuidHash[team.teamUuid] = team
|
||||||
this.addTeam(team)
|
this.addTeam(team)
|
||||||
return team
|
return team
|
||||||
|
Loading…
x
Reference in New Issue
Block a user