43 lines
890 B
Go
43 lines
890 B
Go
package hero
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"go_dreamfactory/lego/core"
|
|
)
|
|
|
|
const (
|
|
game_hero = "game_hero.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_hero)
|
|
return
|
|
}
|
|
|
|
//获取英雄配置数据
|
|
func (this *Configure_Comp) GetHeroConfigure() (configure *cfg.Game_hero, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(game_hero); err != nil {
|
|
return
|
|
} else {
|
|
if configure, ok = v.(*cfg.Game_hero); !ok {
|
|
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|