package combat import ( "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( game_combatlevel = "game_combatlevel.json" game_combatmanster = "game_combatmanster.json" game_combatbox = "game_combatbox.json" ) ///背包配置管理组件 type configureComp struct { modules.MCompConfigure module *Combat } //组件初始化接口 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.(*Combat) this.LoadConfigure(game_combatlevel, cfg.NewGameCombatLevel) this.LoadConfigure(game_combatmanster, cfg.NewGameCombatManster) this.LoadConfigure(game_combatbox, cfg.NewGameCombatBox) return } //查询管卡表 func (this *configureComp) getCombatLevel(id int32) (result *cfg.GameCombatLevelData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_combatlevel); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameCombatLevel).GetDataMap()[id]; !ok { err = fmt.Errorf("on found getCombatLevel:%d", id) this.module.Errorln(err) } } return } //查询管卡表 func (this *configureComp) getGameCombatManster(mid int32) (result *cfg.GameCombatMansterData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_combatmanster); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameCombatManster).GetDataMap()[mid]; !ok { err = fmt.Errorf("on found GameMonster:%d", mid) this.module.Errorln(err) } } return } //查询管卡表 func (this *configureComp) getGameCombatbox(id int32) (result *cfg.GameCombatBoxData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_combatbox); err != nil { this.module.Errorln(err) } else { if result, ok = v.(*cfg.GameCombatBox).GetDataMap()[id]; !ok { err = fmt.Errorf("on found getGameCombatbox:%d", id) this.module.Errorln(err) } } return }