go_dreamfactory/modules/caninerabbit/configure.go
2023-10-27 15:46:56 +08:00

44 lines
1.1 KiB
Go

package caninerabbit
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_catchrabbitreward = "game_catchrabbitreward.json"
)
type configureComp struct {
modules.MCompConfigure
module *CanineRabbit
}
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.(*CanineRabbit)
err = this.LoadMultiConfigure(map[string]interface{}{
game_catchrabbitreward: cfg.NewGameCatchrabbitreward,
})
return
}
// 获取奖励列表
func (this *configureComp) getGameGColorRewardData(id int32) (conf *cfg.GameCatchrabbitrewardData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_catchrabbitreward); err != nil {
return
}
if conf, ok = v.(*cfg.GameCatchrabbitreward).GetDataMap()[id]; !ok {
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_catchrabbitreward, id)
this.module.Errorln(err)
return
}
return
}