55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
package robot
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"go_dreamfactory/pb"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
//用户模块 机器人
|
|
type ModuleRobot_Storyline struct {
|
|
info *pb.DBStoryline
|
|
}
|
|
|
|
func (this *ModuleRobot_Storyline) Init() (err error) {
|
|
|
|
return
|
|
}
|
|
|
|
//接收到消息
|
|
func (this *ModuleRobot_Storyline) Receive(robot IRobot, stype string, message proto.Message) (err error) {
|
|
switch stype {
|
|
case "info":
|
|
resp := message.(*pb.StorylineInfoResp)
|
|
this.info = resp.Info
|
|
break
|
|
}
|
|
return
|
|
}
|
|
func (this *ModuleRobot_Storyline) OncePipeline(robot IRobot) (err error) {
|
|
var (
|
|
errdata *pb.ErrorData
|
|
)
|
|
if _, errdata = robot.SendMessage("storyline", "info", &pb.StorylineInfoReq{}); errdata != nil {
|
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
//机器人执行流
|
|
func (this *ModuleRobot_Storyline) DoPipeline(robot IRobot) (err error) {
|
|
|
|
return
|
|
}
|
|
|
|
//做任务
|
|
func (this *ModuleRobot_Storyline) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error) {
|
|
|
|
return
|
|
}
|