go_dreamfactory/modules/sociaty/config.go
2023-09-26 19:04:31 +08:00

121 lines
2.8 KiB
Go

package sociaty
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameSociatyLv = "game_guildlv.json"
gameSociatyTask = "game_guildtask.json"
gameSociatySign = "game_guildsign.json"
gameSociatyActivity = "game_guildactivity.json"
gameSociatyBossTask = "game_guildbosstask.json"
gameburiedCond = "game_buriedcondi.json"
)
type configureComp struct {
modules.MCompConfigure
module *Sociaty
}
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.(*Sociaty)
err = this.LoadMultiConfigure(map[string]interface{}{
gameSociatyLv: cfg.NewGameGuildLv,
gameSociatyTask: cfg.NewGameGuildTask,
gameSociatySign: cfg.NewGameGuildSign,
gameSociatyActivity: cfg.NewGameGuildActivity,
gameburiedCond: cfg.NewGameBuriedCondi,
})
return
}
// 等级配置
func (this *configureComp) getSociatyLvCfg() (data *cfg.GameGuildLv, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatyLv); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildLv); !ok {
err = comm.NewNotFoundConfErr(string(this.module.GetType()), gameSociatyLv, fmt.Errorf("%T no is *cfg.GameGuildLv", v))
return
}
}
return
}
// 签到配置
func (this *configureComp) getSociatySignCfg() (data *cfg.GameGuildSign, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatySign); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildSign); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildSign", v)
return
}
}
return
}
// 任务配置
func (this *configureComp) getSociatyTaskCfg() (data *cfg.GameGuildTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatyTask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildTask); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildTask", v)
return
}
}
return
}
// 活跃度配置
func (this *configureComp) getSociatyActivityCfg() (data *cfg.GameGuildActivity, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatyActivity); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildActivity); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v)
return
}
}
return
}
func (this *configureComp) getBuriedCondCfg() (data *cfg.GameBuriedCondi, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameburiedCond); err != nil {
return
} else {
if data, ok = v.(*cfg.GameBuriedCondi); !ok {
err = fmt.Errorf("%T is *cfg.GameWorldAll", v)
return
}
}
return
}