47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package martialhall
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"go_dreamfactory/lego/core"
|
|
)
|
|
|
|
const (
|
|
game_kungfu_unlock = "game_kungfu_unlock.json"
|
|
game_kungfu_masterworker = "game_kungfu_masterworker.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.LoadConfigure(game_kungfu_unlock, cfg.NewGamekungfu_unlock)
|
|
this.LoadConfigure(game_kungfu_masterworker, cfg.NewGamekungfu_masterworker)
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getMasterworker(lv int32) (result *cfg.Gamekungfu_masterworkerData, 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.Gamekungfu_masterworker).GetDataMap()[lv]; !ok {
|
|
err = fmt.Errorf("not found:%s ", lv)
|
|
this.module.Errorln(err)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|