51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package hero
|
|
|
|
import (
|
|
"fmt"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
|
|
"go_dreamfactory/lego/core"
|
|
)
|
|
|
|
const (
|
|
game_hero = "game_newhero.json"
|
|
game_heroStargrow = "game_heroStargrow.json"
|
|
game_heroLevelgrow = "game_heroLevelgrow.json"
|
|
game_heroStarup = "game_heroStarup.json"
|
|
game_heroLevelup = "game_heroLevelup.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_hero, cfg.NewGame_newHero)
|
|
this.LoadConfigure(game_heroStargrow, cfg.NewGame_heroStargrow)
|
|
this.LoadConfigure(game_heroLevelgrow, cfg.NewGame_heroLevelgrow)
|
|
this.LoadConfigure(game_heroStarup, cfg.NewGame_heroStarup)
|
|
this.LoadConfigure(game_heroLevelup, cfg.NewGame_heroLevelup)
|
|
return
|
|
}
|
|
|
|
//获取英雄配置数据
|
|
func (this *Configure_Comp) GetHeroConfigure() (configure *cfg.Game_newHero, err error) {
|
|
var (
|
|
v interface{}
|
|
ok bool
|
|
)
|
|
if v, err = this.GetConfigure(game_hero); err != nil {
|
|
return
|
|
} else {
|
|
if configure, ok = v.(*cfg.Game_newHero); !ok {
|
|
err = fmt.Errorf("%T no is *cfg.Game_hero", v)
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|