package hero import ( "fmt" "go_dreamfactory/modules" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/lego/core" ) const ( game_hero = "game_newhero.json" game_heroStargrow = "game_heroStargrow.json" game_heroLevelgrow = "game_heroLevelgrow.json" game_heroStarup = "game_heroStarup.json" game_heroLevelup = "game_heroLevelup.json" game_heroExp = "game_exp.json" ) ///配置管理组件 type Configure_Comp struct { modules.MComp_Configure } //组件初始化接口 func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.ModuleCompBase.Init(service, module, comp, options) this.LoadConfigure(game_hero, cfg.NewGame_newHero) this.LoadConfigure(game_heroStargrow, cfg.NewGame_heroStargrow) this.LoadConfigure(game_heroLevelgrow, cfg.NewGame_heroLevelgrow) this.LoadConfigure(game_heroStarup, cfg.NewGame_heroStarup) this.LoadConfigure(game_heroLevelup, cfg.NewGame_heroLevelup) this.LoadConfigure(game_heroExp, cfg.NewGame_heroExp) return } //获取英雄配置数据 func (this *Configure_Comp) GetHeroConfigure() (configure *cfg.Game_newHero, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_hero); err == nil { if configure, ok = v.(*cfg.Game_newHero); !ok { err = fmt.Errorf("%T no is *cfg.Game_hero", v) } } else { err = fmt.Errorf("%T no is *cfg.Game_hero", v) } return } // 获取英雄强化增加属性配置数据 func (this *Configure_Comp) GetHeroStargrowCon() (configure *cfg.Game_heroStargrow, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_heroStargrow); err == nil { if configure, ok = v.(*cfg.Game_heroStargrow); !ok { err = fmt.Errorf("%T no is *cfg.Game_hero", v) return } } else { err = fmt.Errorf("%T no is *cfg.Game_hero", v) } return } // 获取英雄升级属性变化相关配置数据 func (this *Configure_Comp) GetHeroLevelgrowCon() (configure *cfg.Game_heroLevelgrow, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_heroLevelgrow); err == nil { if configure, ok = v.(*cfg.Game_heroLevelgrow); !ok { err = fmt.Errorf("%T no is *cfg.Game_heroLevelgrow", v) return } } return } // 获取英雄升星相关配置数据 func (this *Configure_Comp) GetHeroStarupCon() (configure *cfg.Game_heroStarup, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_heroStarup); err == nil { if configure, ok = v.(*cfg.Game_heroStarup); !ok { err = fmt.Errorf("%T no is *cfg.Game_heroStarup", v) return } } else { err = fmt.Errorf("%T no is *cfg.Game_heroStarup", v) } return } // 获取英雄升级相关配置数据 func (this *Configure_Comp) GetHeroLevelUpCon() (configure *cfg.Game_heroLevelup, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_heroLevelup); err == nil { if configure, ok = v.(*cfg.Game_heroLevelup); !ok { err = fmt.Errorf("%T no is *cfg.Game_heroLevelup", v) return } } else { err = fmt.Errorf("%T no is *cfg.Game_heroLevelup", v) } return } // 获取英雄升级相关配置数据 func (this *Configure_Comp) GetHeroLevelUpByLv(lv int32) (data *cfg.Game_heroLevelupData, err error) { if v, err1 := this.GetConfigure(game_heroLevelup); err1 == nil { if configure, ok := v.(*cfg.Game_heroLevelup); !ok { err = fmt.Errorf("%T no is *cfg.Game_heroLevelup", v) return } else { data = configure.Get(lv) } } else { err = fmt.Errorf("%T no is *cfg.Game_heroLevelup", v) } return } func (this *Configure_Comp) GetHeroExpCon() (configure *cfg.Game_heroExp, err error) { var ( v interface{} ok bool ) if v, err = this.GetConfigure(game_heroExp); err == nil { if configure, ok = v.(*cfg.Game_heroExp); !ok { err = fmt.Errorf("%T no is *cfg.Game_heroExp", v) return } } else { err = fmt.Errorf("%T no is *cfg.Game_heroExp", v) } return } func (this *Configure_Comp) GetHeroExpConByHeroid(hid int32) (data *cfg.Game_heroExpData, err error) { var ( v interface{} ) if v, err = this.GetConfigure(game_heroExp); err == nil { if configure, ok := v.(*cfg.Game_heroExp); !ok { err = fmt.Errorf("%T no is *cfg.Game_heroExp", v) return } else { data = configure.Get(hid) } } else { err = fmt.Errorf("%T no is *cfg.Game_heroExp", v) } return }