go_dreamfactory/modules/expedition/configure.go
2024-01-26 19:13:05 +08:00

71 lines
1.6 KiB
Go

package expedition
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_expeditionboss = "game_expeditionboss.json"
)
// /配置管理基础组件
type MCompConfigure struct {
modules.MCompConfigure
module *Expedition
}
// 组件初始化接口
func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.ModuleCompBase.Init(service, module, comp, options)
this.module = module.(*Expedition)
err = this.LoadMultiConfigure(map[string]interface{}{
game_expeditionboss: cfg.NewGameExpeditionBoss,
})
return
}
// 获取所有难度一的boos
func (this *MCompConfigure) getGameExpeditionBoosDatas(lv int32) (confs []*cfg.GameExpeditionBossData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_expeditionboss); err != nil {
return
} else {
data, ok := v.(*cfg.GameExpeditionBoss)
if !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v)
return
}
confs = make([]*cfg.GameExpeditionBossData, 0)
for _, v := range data.GetDataList() {
if v.BossLv == lv {
confs = append(confs, v)
}
}
return
}
}
// 获取所有难度一的boos
func (this *MCompConfigure) getGameExpeditionBoosData(id int32) (conf *cfg.GameExpeditionBossData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_expeditionboss); err != nil {
return
} else {
if conf, ok = v.(*cfg.GameExpeditionBoss).GetDataMap()[id]; !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v)
return
}
return
}
}