96 lines
2.6 KiB
Go
96 lines
2.6 KiB
Go
package plunder
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
const (
|
|
game_plunder = "game_plunder.json"
|
|
game_plunderbattle = "game_plunderbattle.json"
|
|
game_plunderdevelop = "game_plunderdevelop.json"
|
|
)
|
|
|
|
type configureComp struct {
|
|
modules.MCompConfigure
|
|
module *Plunder
|
|
}
|
|
|
|
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.(*Plunder)
|
|
//err = this.LoadConfigure(game_plunder, cfg.NewGamePlunder)
|
|
err = this.LoadMultiConfigure(map[string]interface{}{
|
|
game_plunder: cfg.NewGamePlunder,
|
|
game_plunderbattle: cfg.NewGamePlunderBattle,
|
|
game_plunderdevelop: cfg.NewGamePlunderDevelop,
|
|
})
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getGamePlunderData() (result []*cfg.GamePlunderData, err error) {
|
|
var (
|
|
v interface{}
|
|
)
|
|
if v, err = this.GetConfigure(game_plunder); err == nil {
|
|
if configure, ok := v.(*cfg.GamePlunder); ok {
|
|
result = configure.GetDataList()
|
|
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// 通过唯一ID 获取信息
|
|
func (this *configureComp) getGamePlunderDataById(id int32) (result *cfg.GamePlunderData, err error) {
|
|
var (
|
|
v interface{}
|
|
)
|
|
if v, err = this.GetConfigure(game_plunder); err == nil {
|
|
if configure, ok := v.(*cfg.GamePlunder); ok {
|
|
if result = configure.Get(id); result != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_plunder, id)
|
|
return
|
|
}
|
|
|
|
func (this *configureComp) getGamePlunderBattleById(id int32) (result *cfg.GamePlunderBattleData, err error) {
|
|
var (
|
|
v interface{}
|
|
)
|
|
if v, err = this.GetConfigure(game_plunderbattle); err == nil {
|
|
if configure, ok := v.(*cfg.GamePlunderBattle); ok {
|
|
if result = configure.Get(id); result != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_plunderbattle, id)
|
|
return
|
|
}
|
|
func (this *configureComp) getGameMonkeyRewardData(chapterid int32) (result []*cfg.GameMonkeyRewardData, err error) {
|
|
|
|
return
|
|
}
|
|
|
|
// 获取航海术相关
|
|
func (this *configureComp) getPlunderDevelopById(id int32) (result *cfg.GamePlunderDevelopData, err error) {
|
|
var (
|
|
v interface{}
|
|
)
|
|
if v, err = this.GetConfigure(game_plunderdevelop); err == nil {
|
|
if configure, ok := v.(*cfg.GamePlunderDevelop); ok {
|
|
if result = configure.Get(id); result != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_plunderdevelop, id)
|
|
return
|
|
}
|