package expedition import ( "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( game_expeditionboos = "game_expeditionboos.json" ) // /配置管理基础组件 type MCompConfigure struct { modules.MCompConfigure module *Expedition } // 组件初始化接口 func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.ModuleCompBase.Init(service, module, comp, options) this.module = module.(*Expedition) err = this.LoadMultiConfigure(map[string]interface{}{ game_expeditionboos: cfg.NewGameExpeditionBoos, }) return } // 获取所有难度一的boos func (this *MCompConfigure) getGameExpeditionBoosDatas(lv int32) (confs []*cfg.GameExpeditionBoosData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_expeditionboos); err != nil { return } else { data, ok := v.(*cfg.GameExpeditionBoos) if !ok { err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v) return } confs = make([]*cfg.GameExpeditionBoosData, 0) for _, v := range data.GetDataList() { if v.BossLv == lv { confs = append(confs, v) } } return } } // 获取所有难度一的boos func (this *MCompConfigure) getGameExpeditionBoosData(id int32) (conf *cfg.GameExpeditionBoosData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_expeditionboos); err != nil { return } else { if conf, ok = v.(*cfg.GameExpeditionBoos).GetDataMap()[id]; !ok { err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v) return } return } }