From ba90357060f26bbd14549110ca7472a0636102f7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 11 Mar 2024 20:27:12 +0800 Subject: [PATCH] 1 --- server/matchserver/team/team.go | 26 ++++++++++++++++++++++++++ server/matchserver/team/teammgr.go | 16 +++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index 07d7ae43..1569fe5d 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -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 +} diff --git a/server/matchserver/team/teammgr.go b/server/matchserver/team/teammgr.go index 6ce568cb..6b911adb 100644 --- a/server/matchserver/team/teammgr.go +++ b/server/matchserver/team/teammgr.go @@ -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 +}