go_dreamfactory/modules/whackamole/configure.go
2023-10-26 09:25:22 +08:00

46 lines
1.1 KiB
Go

package whackamole
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
)
const (
game_gcolorgetfraction = "game_gcolorgetfraction.json"
game_gcolorreward = "game_gcolorreward.json"
game_gcolorttmedecay = "game_gcolorttmedecay.json"
)
type configureComp struct {
modules.MCompConfigure
module *Whackamole
lock sync.RWMutex
}
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.(*Whackamole)
return
}
// 获取奖励列表
func (this *configureComp) getGameGColorRewardData(id int32) (conf *cfg.GameGColorRewardData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_gcolorreward); err != nil {
return
}
if conf, ok = v.(*cfg.GameGColorReward).GetDataMap()[id]; !ok {
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_gcolorreward, id)
this.module.Errorln(err)
return
}
return
}