go_dreamfactory/modules/plunder/configure.go
2024-01-17 18:22:09 +08:00

61 lines
1.4 KiB
Go

package plunder
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_plunder = "game_plunder.json"
)
type configureComp struct {
modules.MCompConfigure
module *Plunder
}
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)
this.module = module.(*Plunder)
err = this.LoadConfigure(game_plunder, cfg.NewGamePlunder)
return
}
func (this *configureComp) getGamePlunderData() (result []*cfg.GamePlunderData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_plunder); err == nil {
if configure, ok := v.(*cfg.GamePlunder); ok {
result = configure.GetDataList()
}
}
return
}
// 通过唯一ID 获取信息
func (this *configureComp) getGamePlunderDataById(id int32) (result *cfg.GamePlunderData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_plunder); err == nil {
if configure, ok := v.(*cfg.GamePlunder); ok {
if result = configure.Get(id); result != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_plunder, id)
return
}
// 获取章节对应的奖励
func (this *configureComp) getGameMonkeyRewardData(chapterid int32) (result []*cfg.GameMonkeyRewardData, err error) {
return
}