update scene
This commit is contained in:
parent
3c0c6e69c0
commit
91034d61b0
@ -1,6 +1,9 @@
|
|||||||
package busi
|
package busi
|
||||||
|
|
||||||
import "legu.airobot/lib"
|
import (
|
||||||
|
"legu.airobot/lib"
|
||||||
|
"legu.airobot/pb"
|
||||||
|
)
|
||||||
|
|
||||||
var _ lib.IScene = (*LinestoryScene)(nil)
|
var _ lib.IScene = (*LinestoryScene)(nil)
|
||||||
|
|
||||||
@ -15,5 +18,23 @@ func (ls *LinestoryScene) Info() lib.SceneInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinestoryScene) Run(robot lib.IRobot) error {
|
func (ls *LinestoryScene) Run(robot lib.IRobot) error {
|
||||||
|
req := &pb.LinestoryChapterReq{}
|
||||||
|
rsp := &pb.LinestoryChapterResp{}
|
||||||
|
if code := robot.SendMsg("linestory", "chapter", req, rsp); code != pb.ErrorCode_Success {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, _ := range rsp.TaskChapter {
|
||||||
|
req := &pb.LinestoryMaintaskReq{
|
||||||
|
ChapterId: k,
|
||||||
|
}
|
||||||
|
rsp := &pb.LinestoryMaintaskResp{}
|
||||||
|
if code := robot.SendMsg("linestory", "maintask", req, rsp); code != pb.ErrorCode_Success {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//receive
|
||||||
|
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package busi
|
package busi
|
||||||
|
|
||||||
import "legu.airobot/lib"
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"legu.airobot/lib"
|
||||||
|
"legu.airobot/pb"
|
||||||
|
)
|
||||||
|
|
||||||
type WorldtaskScene struct {
|
type WorldtaskScene struct {
|
||||||
lib.IAction
|
lib.IAction
|
||||||
@ -13,5 +18,20 @@ func (w *WorldtaskScene) Info() lib.SceneInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *WorldtaskScene) Run(robot lib.IRobot) error {
|
func (w *WorldtaskScene) Run(robot lib.IRobot) error {
|
||||||
|
w.finish(robot, 10001, 20001)
|
||||||
|
Sleep(time.Millisecond*100, time.Second)
|
||||||
|
w.finish(robot, 10001, 20002)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WorldtaskScene) finish(robot lib.IRobot, groupId, taskId int32) error {
|
||||||
|
req := &pb.WorldtaskFinishReq{
|
||||||
|
GroupId: groupId,
|
||||||
|
TaskId: taskId,
|
||||||
|
}
|
||||||
|
rsp := &pb.WorldtaskFinishResp{}
|
||||||
|
if code := robot.SendMsg("worldtask", "finish", req, rsp); code != pb.ErrorCode_Success {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
4
main.go
4
main.go
@ -40,6 +40,8 @@ func init() {
|
|||||||
&busi.ReddotScene{},
|
&busi.ReddotScene{},
|
||||||
&busi.PayScene{},
|
&busi.PayScene{},
|
||||||
&busi.MfantasyScene{},
|
&busi.MfantasyScene{},
|
||||||
|
&busi.LinestoryScene{},
|
||||||
|
&busi.WorldtaskScene{},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +69,7 @@ func setupLogger() (err error) {
|
|||||||
// FullTimestamp: true,
|
// FullTimestamp: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
logrus.SetLevel(logrus.ErrorLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
logrus.SetOutput(os.Stdout)
|
logrus.SetOutput(os.Stdout)
|
||||||
|
|
||||||
file, err := os.OpenFile("robot.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
|
file, err := os.OpenFile("robot.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
|
||||||
|
@ -181,7 +181,6 @@ func (mw *MainWindow) showProgress(data interface{}, args ...interface{}) {
|
|||||||
if r >= 1 {
|
if r >= 1 {
|
||||||
mw.tipLabel.SetText("正在处理结果...")
|
mw.tipLabel.SetText("正在处理结果...")
|
||||||
mw.progressChan <- struct{}{}
|
mw.progressChan <- struct{}{}
|
||||||
logrus.Debug("....")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user