mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
GCG流程至投掷骰子
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"hk4e/pkg/logger"
|
||||
"hk4e/protocol/proto"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GCGAi struct {
|
||||
game *GCGGame // 所在的游戏
|
||||
controllerId uint32 // 操控者Id
|
||||
}
|
||||
|
||||
// ReceiveGCGMessagePackNotify 接收GCG消息包通知
|
||||
func (g *GCGAi) ReceiveGCGMessagePackNotify(notify *proto.GCGMessagePackNotify) {
|
||||
// 获取玩家的操控者对象
|
||||
gameController := g.game.controllerMap[g.controllerId]
|
||||
if gameController == nil {
|
||||
logger.Error("ai 角色 nil")
|
||||
return
|
||||
}
|
||||
|
||||
for _, pack := range notify.MsgPackList {
|
||||
for _, message := range pack.MsgList {
|
||||
switch message.Message.(type) {
|
||||
case *proto.GCGMessage_PhaseChange:
|
||||
// 阶段改变
|
||||
msg := message.GetPhaseChange()
|
||||
switch msg.AfterPhase {
|
||||
case proto.GCGPhaseType_GCG_PHASE_TYPE_ON_STAGE:
|
||||
logger.Error("请选择你的英雄 hhh")
|
||||
go func() {
|
||||
time.Sleep(1000 * 3)
|
||||
// 默认选第一张牌
|
||||
cardInfo := gameController.cardList[0]
|
||||
// 操控者选择角色牌
|
||||
g.game.ControllerSelectChar(gameController, cardInfo, []uint32{})
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user