70 lines
1.4 KiB
Go
70 lines
1.4 KiB
Go
package reputation
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
const (
|
|
gameTalent = "game_talent.json"
|
|
gameCampLv = "game_camplv.json"
|
|
)
|
|
|
|
type configureComp struct {
|
|
modules.MCompConfigure
|
|
}
|
|
|
|
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)
|
|
err = this.LoadMultiConfigure(map[string]interface{}{
|
|
gameTalent: cfg.NewGameTalent,
|
|
gameCampLv: cfg.NewGameCampLv,
|
|
})
|
|
return
|
|
}
|
|
|
|
// 天赋树配置
|
|
func (this *configureComp) getTalentCfg() (data *cfg.GameTalent, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(gameTalent); err != nil {
|
|
return
|
|
} else {
|
|
if data, ok = v.(*cfg.GameTalent); !ok {
|
|
err = fmt.Errorf("%T is *cfg.GameTalent", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getTalentNodeCfg(id int32) (data *cfg.GameTalentData) {
|
|
gt, err := this.getTalentCfg()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
data, _ = gt.GetDataMap()[id]
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getCampLvCfg() (data *cfg.GameCampLv, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(gameCampLv); err != nil {
|
|
return
|
|
} else {
|
|
if data, ok = v.(*cfg.GameCampLv); !ok {
|
|
err = fmt.Errorf("%T is *cfg.GameCampLv", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|