package caninerabbit import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" ) const ( game_catchrabbit = "game_catchrabbit.json" ) type configureComp struct { modules.MCompConfigure module *CanineRabbit } 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.(*CanineRabbit) err = this.LoadMultiConfigure(map[string]interface{}{ game_catchrabbit: cfg.NewGameCatchrabbit, }) return } // 获取奖励列表 func (this *configureComp) getGameGColorRewardData(id int32) (conf *cfg.GameCatchrabbitData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_catchrabbit); err != nil { return } if conf, ok = v.(*cfg.GameCatchrabbit).GetDataMap()[id]; !ok { err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_catchrabbit, id) this.module.Errorln(err) return } return } // 获取奖励列表 func (this *configureComp) getGameGColorRewardDatas(ctype int32) (confs []*cfg.GameCatchrabbitData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_catchrabbit); err != nil { return } confs = make([]*cfg.GameCatchrabbitData, 0) for _, v := range v.(*cfg.GameCatchrabbit).GetDataList() { if v.Type == ctype { confs = append(confs, v) } } return }