package martialhall import ( "fmt" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/lego/core" ) const ( game_kungfu_unlock = "game_kungfuunlock.json" game_kungfu_masterworker = "game_kungfumasterworker.json" ) ///配置组件 type configureComp struct { modules.MCompConfigure module *Martialhall } //组件初始化接口 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.(*Martialhall) this.LoadConfigure(game_kungfu_unlock, cfg.NewGameKungfuUnlock) this.LoadConfigure(game_kungfu_masterworker, cfg.NewGameKungfuMasterworker) return } func (this *configureComp) getMasterworker(lv int32) (result *cfg.GameKungfuMasterworkerData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_kungfu_masterworker); err != nil { this.module.Errorln(err) return } else { if result, ok = v.(*cfg.GameKungfuMasterworker).GetDataMap()[lv]; !ok { err = fmt.Errorf("not found:%d ", lv) this.module.Errorln(err) return } } return } func (this *configureComp) getunlock(pillar int32) (result *cfg.GameKungfuUnlockData, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_kungfu_unlock); err != nil { this.module.Errorln(err) return } else { if result, ok = v.(*cfg.GameKungfuUnlock).GetDataMap()[pillar]; !ok { err = fmt.Errorf("not found:%d ", pillar) this.module.Errorln(err) return } } return }