1
This commit is contained in:
parent
3703cc0c28
commit
50358cea8d
@ -43,6 +43,8 @@ type Team interface {
|
||||
SendStateNotify()
|
||||
IsLeader(Player) bool
|
||||
Started() bool
|
||||
CanStartGame(Player) bool
|
||||
StartGame()
|
||||
}
|
||||
|
||||
type TeamMgr interface {
|
||||
|
@ -17,9 +17,9 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
TEAM_STAET_INIT = 0
|
||||
TEAM_STAET_STARTED = 1
|
||||
TEAM_STAET_MATCHING = 2
|
||||
TEAM_STATE_INIT = 0
|
||||
TEAM_STATE_STARTED = 1
|
||||
TEAM_STATE_MATCHING = 2
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -186,7 +186,9 @@ func (this *player) CMHandoverLeader(hdr *f5.MsgHdr, msg *cs.CMHandoverLeader) {
|
||||
func (this *player) CMStartGame(hdr *f5.MsgHdr, msg *cs.CMStartGame) {
|
||||
rspMsg := &cs.SMStartGame{}
|
||||
if !this.GetTeam().Started() {
|
||||
|
||||
if this.GetTeam().CanStartGame(this) {
|
||||
this.GetTeam().StartGame()
|
||||
}
|
||||
}
|
||||
this.SendMsg(rspMsg)
|
||||
}
|
||||
|
@ -93,7 +93,18 @@ func (this *team) IsCopy() bool {
|
||||
}
|
||||
|
||||
func (this *team) Started() bool {
|
||||
return this.state == constant.TEAM_STAET_STARTED
|
||||
return this.state == constant.TEAM_STATE_STARTED
|
||||
}
|
||||
|
||||
func (this *team) CanStartGame(hum common.Player) bool {
|
||||
if !this.Started() {
|
||||
this.state = constant.TEAM_STATE_STARTED
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *team) StartGame() {
|
||||
|
||||
}
|
||||
|
||||
func (this *team) broadcastMsg(msg proto.Message) {
|
||||
@ -125,7 +136,7 @@ func (this *team) SendStateNotify() {
|
||||
|
||||
func newTeam() *team {
|
||||
t := new(team)
|
||||
t.state = constant.TEAM_STAET_INIT
|
||||
t.state = constant.TEAM_STATE_INIT
|
||||
t.stateNotifyMsg = &cs.SMTeamStateNotify{}
|
||||
t.stateNotifyMsg.JoinMsg = &cs.MFJoinMsg{}
|
||||
t.accountIdHash = map[string]common.Player{}
|
||||
|
Loading…
x
Reference in New Issue
Block a user