package busi import ( "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() } 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) itemlistreq := &pb.ItemsGetlistReq{} itemlistresp := &pb.ItemsGetlistResp{} if code = ai.SendMsg("item", "list", itemlistreq, itemlistresp); code != pb.ErrorCode_Success { ai.Stop() return } ai.Store("item.list", itemlistresp) return nil }