diff --git a/server/matchserver/common/types.go b/server/matchserver/common/types.go index e1dd572a..0e0df053 100644 --- a/server/matchserver/common/types.go +++ b/server/matchserver/common/types.go @@ -17,7 +17,7 @@ type LoginRsp struct { UserInfo struct { Activated string `json:"activated"` RenameCount string `json:"rename_count"` - AccountID string `json:"account_id"` + AccountId string `json:"account_id"` Name string `json:"name"` HeadId string `json:"head_id"` HeroId string `json:"hero_id"` @@ -40,6 +40,7 @@ type Team interface { OnPlayerOnline(Player) IsCopy() bool SendUpdateNotify() + SendStateNotify() IsLeader(Player) bool Started() bool } diff --git a/server/matchserver/team/team.go b/server/matchserver/team/team.go index 97ecc552..e232ae9a 100644 --- a/server/matchserver/team/team.go +++ b/server/matchserver/team/team.go @@ -4,6 +4,7 @@ import ( "q5" "cs" "main/common" + "main/constant" "github.com/golang/protobuf/proto" ) @@ -17,7 +18,8 @@ type team struct { nodeId int32 mapId int32 owner common.Player - started bool + state int32 + stateNotifyMsg *cs.SMTeamStateNotify accountIdHash map[string]common.Player } @@ -26,6 +28,7 @@ func (this *team) init(teamUuid string, owner common.Player) { this.zoneId = owner.GetZoneId() this.nodeId = owner.GetNodeId() this.owner = owner + this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.teamUuid) owner.SetTeam(this) this.accountIdHash[owner.GetAccountId()] = owner } @@ -90,7 +93,7 @@ func (this *team) IsCopy() bool { } func (this *team) Started() bool { - return this.started + return this.state == constant.TEAM_STAET_STARTED } func (this *team) broadcastMsg(msg proto.Message) { @@ -114,8 +117,17 @@ func (this *team) SendUpdateNotify() { this.broadcastMsg(notifyMsg) } +func (this *team) SendStateNotify() { + notifyMsg := &cs.SMTeamStateNotify{} + notifyMsg.State = proto.Int32(this.state) + this.broadcastMsg(notifyMsg) +} + func newTeam() *team { t := new(team) + t.state = constant.TEAM_STAET_INIT + t.stateNotifyMsg = &cs.SMTeamStateNotify{} + t.stateNotifyMsg.JoinMsg = &cs.MFJoinMsg{} t.accountIdHash = map[string]common.Player{} return t }