go_dreamfactory/modules/robot/modulerobot_mainline.go
2023-08-23 18:34:19 +08:00

71 lines
1.4 KiB
Go

package robot
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
//用户模块 机器人
type ModuleRobot_MainLine struct {
info *pb.DBMainline
}
func (this *ModuleRobot_MainLine) Init() {
}
//接收到消息
func (this *ModuleRobot_MainLine) Receive(robot IRobot, stype string, message proto.Message) (err error) {
switch stype {
case "info":
resp := message.(*pb.MainlineInfoResp)
this.info = resp.Info
break
case "create":
// resp := message.(*pb.UserCreateResp)
break
}
return
}
//机器人执行流
func (this *ModuleRobot_MainLine) DoPipeline(robot IRobot) (err error) {
return
}
//做任务
func (this *ModuleRobot_MainLine) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error) {
var (
errdata *pb.ErrorData
)
if _, errdata = robot.SendMessage("mainline", "info", &pb.MainlineInfoReq{}); errdata != nil {
err = errors.New(errdata.Message)
return
}
switch comm.TaskType(condconf.Type) {
}
return
}
// 读取主线关卡表
func (this *ModuleRobot_MainLine) getGameMainStageData(cid int32) (conf []*cfg.GameMainStageData, err error) {
var (
v interface{}
)
if v, err = configure.GetConfigure(game_mainstage); err != nil {
return
} else {
conf = v.(*cfg.GameMainStage).GetDataList()
}
return
}