53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package busi
|
|
|
|
import (
|
|
"time"
|
|
|
|
"legu.airobot/lib"
|
|
"legu.airobot/pb"
|
|
)
|
|
|
|
//商店场景
|
|
|
|
var _ lib.IScene = (*ResMgrScene)(nil)
|
|
|
|
type ResMgrScene struct {
|
|
lib.Action
|
|
}
|
|
|
|
func (f *ResMgrScene) Info() lib.SceneInfo {
|
|
return lib.SceneInfo{
|
|
Name: "资源添加和管理",
|
|
Desc: "添加资源同事保存资源数据到本地 提供其他压测工具使用",
|
|
}
|
|
}
|
|
|
|
func (f *ResMgrScene) Run(ai lib.IRobot) (err error) {
|
|
var (
|
|
code pb.ErrorCode
|
|
)
|
|
if code = ai.SendMsg("gm", "cmd", &pb.GMCmdReq{
|
|
Cmod: "bingo:Iamyoudad",
|
|
}, &pb.GMCmdResp{}); code != pb.ErrorCode_Success {
|
|
ai.Stop()
|
|
}
|
|
Sleep(time.Second*0, time.Second*1)
|
|
herolistreq := &pb.HeroListReq{}
|
|
herolistresp := &pb.HeroListResp{}
|
|
if code = ai.SendMsg("hero", "list", herolistreq, herolistresp); code != pb.ErrorCode_Success {
|
|
ai.Stop()
|
|
return
|
|
}
|
|
ai.Store("hero.list", herolistresp)
|
|
Sleep(time.Second*0, time.Second*1)
|
|
itemlistreq := &pb.ItemsGetlistReq{}
|
|
itemlistresp := &pb.ItemsGetlistResp{}
|
|
if code = ai.SendMsg("items", "list", itemlistreq, itemlistresp); code != pb.ErrorCode_Success {
|
|
ai.Stop()
|
|
return
|
|
}
|
|
ai.Store("items.list", itemlistresp)
|
|
Sleep(time.Second*0, time.Second*1)
|
|
return nil
|
|
}
|