This commit is contained in:
aozhiwei 2024-03-11 20:27:12 +08:00
parent 68b0188257
commit ba90357060
2 changed files with 41 additions and 1 deletions

View File

@ -2,10 +2,12 @@ package team
import (
"cs"
"main/common"
)
type team struct {
cs.MsgHandlerImpl
teamUuid string
zoneId int32
nodeId int32
}
@ -17,3 +19,27 @@ func (this *team) GetZoneId() int32 {
func (this *team) GetNodeId() int32 {
return this.nodeId
}
func (this *team) GetTeamUuid() string {
return this.teamUuid
}
func (this *team) CanJoin(accountId string) bool {
return false
}
func (this *team) GetMemberByAccountId(accountId string) common.Player {
return nil
}
func (this *team) OnPlayerOffline(hum common.Player) {
}
func (this *team) OnPlayerOnline(hum common.Player) {
}
func (this *team) Join(hum common.Player) bool {
return false
}

View File

@ -5,15 +5,18 @@ import (
"f5"
"cs"
"main/common"
"mt"
)
type teamMgr struct {
cs.MsgHandlerImpl
curIdx int64
teamUuidHash map[string]*team
}
func (this *teamMgr) Init() {
this.teamUuidHash = make(map[string]*team)
this.curIdx = f5.GetApp().GetNowSeconds()
}
func (this *teamMgr) UnInit() {
@ -24,7 +27,18 @@ func (this *teamMgr) CreateTeam(hum common.Player, msg *cs.CMLogin) {
}
func (this *teamMgr) genTeamUuid(zoneId int32, nodeId int32) string {
this.curIdx++
teamUuid := q5.ToString(zoneId) + "_" + q5.ToString(nodeId) + "_" +
q5.Md5Str(q5.ToString(f5.GetApp().NewUuid()))
q5.Md5Str(q5.ToString(f5.GetApp().NewUuid()) + q5.ToString(f5.GetApp().GetPid()) +
q5.ToString(this.curIdx) +
mt.Table.MatchCluster.GetIp() + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)")
return teamUuid
}
func (this *teamMgr) GetTeamByUuid(teamUuid string) common.Team {
team, ok := this.teamUuidHash[teamUuid]
if ok {
return team
}
return nil
}