61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package growtask
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
const (
|
|
gameGrowreward = "game_growreward.json"
|
|
gameGrowTask = "game_growtask.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{}{
|
|
gameGrowreward: cfg.NewGameGrowReward,
|
|
gameGrowTask: cfg.NewGameGrowTask,
|
|
})
|
|
return
|
|
}
|
|
|
|
// 成长任务配置
|
|
func (this *configureComp) getGrowtaskCfg() (data *cfg.GameGrowTask, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(gameGrowTask); err != nil {
|
|
return
|
|
} else {
|
|
if data, ok = v.(*cfg.GameGrowTask); !ok {
|
|
err = fmt.Errorf("%T no is *cfg.GameGrowTask", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// 奖励配置
|
|
func (this *configureComp) getGrowrewardCfg() (data *cfg.GameGrowReward, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(gameGrowreward); err != nil {
|
|
return
|
|
} else {
|
|
if data, ok = v.(*cfg.GameGrowReward); !ok {
|
|
err = fmt.Errorf("%T no is *cfg.GameGrowReward", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|