package catchbugs import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( game_catchbugstage = "game_catchbugstage.json" game_catchbugreward = "game_catchbugreward.json" game_catchbuglllustrated = "game_catchbuglllustrated.json" game_catchbugskill = "game_catchbugskill.json" ) type configureComp struct { modules.MCompConfigure module *CatchBugs } func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompConfigure.Init(service, module, comp, options) this.module = module.(*CatchBugs) err = this.LoadMultiConfigure(map[string]interface{}{ game_catchbugstage: cfg.NewGameCatchbugStage, game_catchbugreward: cfg.NewGameCatchbugReward, game_catchbuglllustrated: cfg.NewGameCatchbugLllustrated, game_catchbugskill: cfg.NewGameCatchbugSkill, }) return } // 获取奖励列表 func (this *configureComp) getGameGColorRewardDatas() (confs []*cfg.GameCatchbugRewardData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_catchbugreward); err != nil { return } confs = v.(*cfg.GameCatchbugReward).GetDataList() return } // 获取奖励列表 func (this *configureComp) getGameCatchbugLllustratedDatas() (confs []*cfg.GameCatchbugLllustratedData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_catchbuglllustrated); err != nil { return } confs = v.(*cfg.GameCatchbugLllustrated).GetDataList() return } // 获取奖励列表 func (this *configureComp) getGameCatchbugSkillData(id int32) (conf *cfg.GameCatchbugSkillData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_catchbugskill); err != nil { return } if conf, ok = v.(*cfg.GameCatchbugSkill).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_catchbugskill, id) this.module.Errorf("err:%v", err) return } return } // 获取奖励列表 func (this *configureComp) getGameCatchbugStage(id int32) (conf *cfg.GameCatchbugStageData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_catchbugstage); err != nil { return } if conf, ok = v.(*cfg.GameCatchbugStage).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_catchbugstage, id) this.module.Errorf("err:%v", err) return } return }