update scene

This commit is contained in:
wh_zcy 2022-12-26 14:10:19 +08:00
parent 3c0c6e69c0
commit 91034d61b0
4 changed files with 46 additions and 4 deletions

View File

@ -1,6 +1,9 @@
package busi
import "legu.airobot/lib"
import (
"legu.airobot/lib"
"legu.airobot/pb"
)
var _ lib.IScene = (*LinestoryScene)(nil)
@ -15,5 +18,23 @@ func (ls *LinestoryScene) Info() lib.SceneInfo {
}
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
}

View File

@ -1,6 +1,11 @@
package busi
import "legu.airobot/lib"
import (
"time"
"legu.airobot/lib"
"legu.airobot/pb"
)
type WorldtaskScene struct {
lib.IAction
@ -13,5 +18,20 @@ func (w *WorldtaskScene) Info() lib.SceneInfo {
}
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
}

View File

@ -40,6 +40,8 @@ func init() {
&busi.ReddotScene{},
&busi.PayScene{},
&busi.MfantasyScene{},
&busi.LinestoryScene{},
&busi.WorldtaskScene{},
)
}
@ -67,7 +69,7 @@ func setupLogger() (err error) {
// FullTimestamp: true,
})
logrus.SetLevel(logrus.ErrorLevel)
logrus.SetLevel(logrus.DebugLevel)
logrus.SetOutput(os.Stdout)
file, err := os.OpenFile("robot.log", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)

View File

@ -181,7 +181,6 @@ func (mw *MainWindow) showProgress(data interface{}, args ...interface{}) {
if r >= 1 {
mw.tipLabel.SetText("正在处理结果...")
mw.progressChan <- struct{}{}
logrus.Debug("....")
}
}