You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
997 B
Go
52 lines
997 B
Go
package game_status
|
|
|
|
import (
|
|
"dcg/game/manager"
|
|
pbCommon "dcg/game/pb/common"
|
|
"dcg/game/svc"
|
|
"git.noahlan.cn/northlan/ngs/component"
|
|
"git.noahlan.cn/northlan/ngs/session"
|
|
)
|
|
|
|
type GameStatus struct {
|
|
component.Base
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewGameStatus(svcCtx *svc.ServiceContext) *GameStatus {
|
|
return &GameStatus{
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (p *GameStatus) Init() {
|
|
}
|
|
|
|
func (p *GameStatus) Shutdown() {
|
|
}
|
|
|
|
func (p *GameStatus) CMD() string {
|
|
return "game"
|
|
}
|
|
|
|
func (p *GameStatus) Prefix() string {
|
|
return ""
|
|
}
|
|
|
|
// Status 游戏房间状态变更
|
|
func (p *GameStatus) Status(s *session.Session, msg *pbCommon.GameStatusReq) error {
|
|
manager.GameManager.SessionGameStatus(s, manager.GameStatus(msg.Status))
|
|
|
|
data, err := manager.GameManager.SessionData(s)
|
|
if err != nil {
|
|
return s.Response(&pbCommon.GameStatusResp{
|
|
Success: false,
|
|
})
|
|
}
|
|
return s.Response(&pbCommon.GameStatusResp{
|
|
Success: true,
|
|
BattleId: data.BattleId(),
|
|
Timestamp: msg.Timestamp,
|
|
})
|
|
}
|