53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
package robot
|
|
|
|
import (
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/pb"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
//客户端端
|
|
type IClient interface {
|
|
Init(addr string, client IClient) (err error)
|
|
Heartbeat()
|
|
Receive(msg *pb.UserMessage) (err error)
|
|
WriteMsg(msg *pb.UserMessage) (err error)
|
|
Close()
|
|
OnClose()
|
|
}
|
|
|
|
//机器人
|
|
type IRobot interface {
|
|
IClient
|
|
Account() string
|
|
ServerId() string
|
|
GetModule(module core.M_Modules) IModuleRobot
|
|
SendMessage(mtype, stype string, msg proto.Message) (resp proto.Message, errdata *pb.ErrorData)
|
|
SendTaskMessage(task, comdi int32, mtype, stype string, msg proto.Message) (resp proto.Message, errdata *pb.ErrorData)
|
|
DoTask(taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData, module core.M_Modules) (err error)
|
|
}
|
|
|
|
//机器人模块
|
|
type IModuleRobot interface {
|
|
Init() (err error)
|
|
//接收到回应和推送消息
|
|
Receive(robot IRobot, stype string, message proto.Message) (err error)
|
|
//执行流水线任务
|
|
DoPipeline(robot IRobot) (err error)
|
|
//执行任务
|
|
DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error)
|
|
}
|
|
|
|
type SecBuild struct {
|
|
Account string `json:"account"`
|
|
ServerId string `json:"serverId"`
|
|
TimeStamp int64 `json:"timestamp"`
|
|
}
|
|
|
|
type MessageResp struct {
|
|
resp proto.Message
|
|
errdata *pb.ErrorData
|
|
}
|