This commit is contained in:
liwei1dao 2022-07-22 20:10:32 +08:00
commit 663e11e228
5 changed files with 89 additions and 69 deletions

View File

@ -11,16 +11,6 @@
}, },
{ {
"index": "2", "index": "2",
"var": [
{
"a": "item",
"t": "1",
"n": 1
}
]
},
{
"index": "3",
"var": [ "var": [
{ {
"a": "attr", "a": "attr",
@ -30,7 +20,7 @@
] ]
}, },
{ {
"index": "4", "index": "3",
"var": [ "var": [
{ {
"a": "hero", "a": "hero",
@ -40,7 +30,7 @@
] ]
}, },
{ {
"index": "5", "index": "4",
"var": [ "var": [
{ {
"a": "hero", "a": "hero",
@ -50,7 +40,7 @@
] ]
}, },
{ {
"index": "6", "index": "5",
"var": [ "var": [
{ {
"a": "hero", "a": "hero",
@ -60,11 +50,41 @@
] ]
}, },
{ {
"index": "7", "index": "6",
"var": [ "var": [
{ {
"a": "item", "a": "item",
"t": "1", "t": "10006",
"n": 2
}
]
},
{
"index": "7",
"var": [
{
"a": "equi",
"t": "10001",
"n": 1
}
]
},
{
"index": "8",
"var": [
{
"a": "equi",
"t": "10002",
"n": 1
}
]
},
{
"index": "9",
"var": [
{
"a": "equi",
"t": "10003",
"n": 1 "n": 1
} }
] ]

View File

@ -11,7 +11,7 @@ import (
const ( const (
game_global = "game_global.json" game_global = "game_global.json"
game_cominitial = "game_cominitial.json" game_initial = "game_initial.json"
) )
///配置管理基础组件 ///配置管理基础组件
@ -23,7 +23,7 @@ type MCompConfigure struct {
func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { 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) err = this.ModuleCompBase.Init(service, module, comp, options)
err = this.LoadConfigure(game_global, cfg.NewGame_global) err = this.LoadConfigure(game_global, cfg.NewGame_global)
err = this.LoadConfigure(game_cominitial, cfg.NewGame_comInitial) err = this.LoadConfigure(game_initial, cfg.NewGame_initial)
return return
} }
@ -52,7 +52,7 @@ func (this *MCompConfigure) GetConfigure(name string) (v interface{}, err error)
//全局配置 //全局配置
func (this *MCompConfigure) GetGlobalConf(key string) string { func (this *MCompConfigure) GetGlobalConf(key string) string {
if v, err := this.GetConfigure(game_cominitial); err != nil { if v, err := this.GetConfigure(game_initial); err != nil {
log.Errorf("get global conf err:%v", err) log.Errorf("get global conf err:%v", err)
return "" return ""
} else { } else {
@ -72,15 +72,15 @@ func (this *MCompConfigure) GetGlobalConf(key string) string {
return "" return ""
} }
func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.Game_comInitial, err error) { func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.Game_initial, err error) {
var ( var (
v interface{} v interface{}
ok bool ok bool
) )
if v, err = this.GetConfigure(game_cominitial); err != nil { if v, err = this.GetConfigure(game_initial); err != nil {
return return
} else { } else {
if configure, ok = v.(*cfg.Game_comInitial); !ok { if configure, ok = v.(*cfg.Game_initial); !ok {
err = fmt.Errorf("%T no is *cfg.Game_comInitial", v) err = fmt.Errorf("%T no is *cfg.Game_comInitial", v)
return return
} }

View File

@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type Game_comInitial struct {
_dataMap map[string]*Game_comInitialData
_dataList []*Game_comInitialData
}
func NewGame_comInitial(_buf []map[string]interface{}) (*Game_comInitial, error) {
_dataList := make([]*Game_comInitialData, 0, len(_buf))
dataMap := make(map[string]*Game_comInitialData)
for _, _ele_ := range _buf {
if _v, err2 := NewGame_comInitialData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Index] = _v
}
}
return &Game_comInitial{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *Game_comInitial) GetDataMap() map[string]*Game_comInitialData {
return table._dataMap
}
func (table *Game_comInitial) GetDataList() []*Game_comInitialData {
return table._dataList
}
func (table *Game_comInitial) Get(key string) *Game_comInitialData {
return table._dataMap[key]
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type Game_initial struct {
_dataMap map[string]*Game_initialData
_dataList []*Game_initialData
}
func NewGame_initial(_buf []map[string]interface{}) (*Game_initial, error) {
_dataList := make([]*Game_initialData, 0, len(_buf))
dataMap := make(map[string]*Game_initialData)
for _, _ele_ := range _buf {
if _v, err2 := NewGame_initialData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Index] = _v
}
}
return &Game_initial{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *Game_initial) GetDataMap() map[string]*Game_initialData {
return table._dataMap
}
func (table *Game_initial) GetDataList() []*Game_initialData {
return table._dataList
}
func (table *Game_initial) Get(key string) *Game_initialData {
return table._dataMap[key]
}

View File

@ -10,17 +10,17 @@ package cfg
import "errors" import "errors"
type Game_comInitialData struct { type Game_initialData struct {
Index string Index string
Var []*Game_atn Var []*Game_atn
} }
func (Game_comInitialData) GetTypeId() int { func (Game_initialData) GetTypeId() int {
return 1849654857 return -1101258478
} }
func NewGame_comInitialData(_buf map[string]interface{}) (_v *Game_comInitialData, err error) { func NewGame_initialData(_buf map[string]interface{}) (_v *Game_initialData, err error) {
_v = &Game_comInitialData{} _v = &Game_initialData{}
{ var _ok_ bool; if _v.Index, _ok_ = _buf["index"].(string); !_ok_ { err = errors.New("index error"); return } } { var _ok_ bool; if _v.Index, _ok_ = _buf["index"].(string); !_ok_ { err = errors.New("index error"); return } }
{ {
var _arr_ []interface{} var _arr_ []interface{}