1
This commit is contained in:
parent
fb5d7f37cd
commit
3703cc0c28
@ -17,7 +17,7 @@ type LoginRsp struct {
|
|||||||
UserInfo struct {
|
UserInfo struct {
|
||||||
Activated string `json:"activated"`
|
Activated string `json:"activated"`
|
||||||
RenameCount string `json:"rename_count"`
|
RenameCount string `json:"rename_count"`
|
||||||
AccountID string `json:"account_id"`
|
AccountId string `json:"account_id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
HeadId string `json:"head_id"`
|
HeadId string `json:"head_id"`
|
||||||
HeroId string `json:"hero_id"`
|
HeroId string `json:"hero_id"`
|
||||||
@ -40,6 +40,7 @@ type Team interface {
|
|||||||
OnPlayerOnline(Player)
|
OnPlayerOnline(Player)
|
||||||
IsCopy() bool
|
IsCopy() bool
|
||||||
SendUpdateNotify()
|
SendUpdateNotify()
|
||||||
|
SendStateNotify()
|
||||||
IsLeader(Player) bool
|
IsLeader(Player) bool
|
||||||
Started() bool
|
Started() bool
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"q5"
|
"q5"
|
||||||
"cs"
|
"cs"
|
||||||
"main/common"
|
"main/common"
|
||||||
|
"main/constant"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -17,7 +18,8 @@ type team struct {
|
|||||||
nodeId int32
|
nodeId int32
|
||||||
mapId int32
|
mapId int32
|
||||||
owner common.Player
|
owner common.Player
|
||||||
started bool
|
state int32
|
||||||
|
stateNotifyMsg *cs.SMTeamStateNotify
|
||||||
accountIdHash map[string]common.Player
|
accountIdHash map[string]common.Player
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ func (this *team) init(teamUuid string, owner common.Player) {
|
|||||||
this.zoneId = owner.GetZoneId()
|
this.zoneId = owner.GetZoneId()
|
||||||
this.nodeId = owner.GetNodeId()
|
this.nodeId = owner.GetNodeId()
|
||||||
this.owner = owner
|
this.owner = owner
|
||||||
|
this.stateNotifyMsg.JoinMsg.TeamUuid = proto.String(this.teamUuid)
|
||||||
owner.SetTeam(this)
|
owner.SetTeam(this)
|
||||||
this.accountIdHash[owner.GetAccountId()] = owner
|
this.accountIdHash[owner.GetAccountId()] = owner
|
||||||
}
|
}
|
||||||
@ -90,7 +93,7 @@ func (this *team) IsCopy() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) Started() bool {
|
func (this *team) Started() bool {
|
||||||
return this.started
|
return this.state == constant.TEAM_STAET_STARTED
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *team) broadcastMsg(msg proto.Message) {
|
func (this *team) broadcastMsg(msg proto.Message) {
|
||||||
@ -114,8 +117,17 @@ func (this *team) SendUpdateNotify() {
|
|||||||
this.broadcastMsg(notifyMsg)
|
this.broadcastMsg(notifyMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *team) SendStateNotify() {
|
||||||
|
notifyMsg := &cs.SMTeamStateNotify{}
|
||||||
|
notifyMsg.State = proto.Int32(this.state)
|
||||||
|
this.broadcastMsg(notifyMsg)
|
||||||
|
}
|
||||||
|
|
||||||
func newTeam() *team {
|
func newTeam() *team {
|
||||||
t := new(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{}
|
t.accountIdHash = map[string]common.Player{}
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user