43 lines
935 B
Go
43 lines
935 B
Go
package game
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"go_dreamfactory/lego/core"
|
|
)
|
|
|
|
const (
|
|
game_equipment = "game_equipment.json"
|
|
)
|
|
|
|
///配置管理组件
|
|
type Configure_Comp struct {
|
|
modules.MComp_Configure
|
|
}
|
|
|
|
//组件初始化接口
|
|
func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
this.ModuleCompBase.Init(service, module, comp, options)
|
|
this.LoadConfigure(game_equipment, cfg.NewGame_equipment)
|
|
return
|
|
}
|
|
|
|
//获取装备配置数据
|
|
func (this *Configure_Comp) GetEquipmentConfigure() (configure *cfg.Game_equipment, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(game_equipment); err != nil {
|
|
return
|
|
} else {
|
|
if configure, ok = v.(*cfg.Game_equipment); !ok {
|
|
err = fmt.Errorf("%T no is *cfg.Game_equipment", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|