package academy import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( game_teaching = "game_teaching.json" game_herostrategy = "game_herostrategy.json" ) ///背包配置管理组件 type configureComp struct { modules.MCompConfigure module *Academy } //组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MCompConfigure.Init(service, module, comp, options) this.module = module.(*Academy) this.LoadConfigure(game_teaching, cfg.NewGameTeaching) this.LoadConfigure(game_herostrategy, cfg.NewGameHeroStrategy) return } //查询管卡表 func (this *configureComp) getGameTeaching(id int32) (result *cfg.GameTeachingData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_teaching); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameTeaching).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(moduleName, game_teaching, id) this.module.Errorln(err) } } return } //查询管卡表 func (this *configureComp) getGameTeachingByGroup(group int32) (result []*cfg.GameTeachingData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_teaching); err != nil { this.module.Errorln(err) } else { result = make([]*cfg.GameTeachingData, 0) for _, v := range v.(*cfg.GameTeaching).GetDataMap() { result = append(result, v) } } return } //查询英雄 func (this *configureComp) getGameHeroTeaching(id string) (result *cfg.GameHeroStrategyData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_herostrategy); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameHeroStrategy).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(moduleName, game_herostrategy, id) this.module.Errorln(err) } } return }