From 0794cdd4b9a779fefe15f8adcb6a2de4f239b170 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 22 Jul 2022 19:57:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=A1=A8=E8=8E=B7=E5=BE=97=E9=81=93=E5=85=B7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_cominitial.json | 50 ++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/bin/json/game_cominitial.json b/bin/json/game_cominitial.json index 54507b25e..714f3a907 100644 --- a/bin/json/game_cominitial.json +++ b/bin/json/game_cominitial.json @@ -11,16 +11,6 @@ }, { "index": "2", - "var": [ - { - "a": "item", - "t": "1", - "n": 1 - } - ] - }, - { - "index": "3", "var": [ { "a": "attr", @@ -30,7 +20,7 @@ ] }, { - "index": "4", + "index": "3", "var": [ { "a": "hero", @@ -40,7 +30,7 @@ ] }, { - "index": "5", + "index": "4", "var": [ { "a": "hero", @@ -50,7 +40,7 @@ ] }, { - "index": "6", + "index": "5", "var": [ { "a": "hero", @@ -60,11 +50,41 @@ ] }, { - "index": "7", + "index": "6", "var": [ { "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 } ] From 6397161f9210f5b136dc72ef710b3cf4a775fd23 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 22 Jul 2022 20:03:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?cominit=20=E8=A1=A8=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...game_cominitial.json => game_initial.json} | 0 modules/comp_configure.go | 14 +++---- sys/configure/structs/game.comInitial.go | 42 ------------------- sys/configure/structs/game.initial.go | 42 +++++++++++++++++++ ....comInitialData.go => game.initialData.go} | 10 ++--- 5 files changed, 54 insertions(+), 54 deletions(-) rename bin/json/{game_cominitial.json => game_initial.json} (100%) delete mode 100644 sys/configure/structs/game.comInitial.go create mode 100644 sys/configure/structs/game.initial.go rename sys/configure/structs/{game.comInitialData.go => game.initialData.go} (84%) diff --git a/bin/json/game_cominitial.json b/bin/json/game_initial.json similarity index 100% rename from bin/json/game_cominitial.json rename to bin/json/game_initial.json diff --git a/modules/comp_configure.go b/modules/comp_configure.go index 0ecc8a2c4..e382a9b62 100644 --- a/modules/comp_configure.go +++ b/modules/comp_configure.go @@ -10,8 +10,8 @@ import ( ) const ( - game_global = "game_global.json" - game_cominitial = "game_cominitial.json" + game_global = "game_global.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) { err = this.ModuleCompBase.Init(service, module, comp, options) 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 } @@ -52,7 +52,7 @@ func (this *MCompConfigure) GetConfigure(name string) (v interface{}, err error) //全局配置 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) return "" } else { @@ -72,15 +72,15 @@ func (this *MCompConfigure) GetGlobalConf(key string) string { return "" } -func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.Game_comInitial, err error) { +func (this *MCompConfigure) GetGlobalInitConf() (configure *cfg.Game_initial, err error) { var ( v interface{} ok bool ) - if v, err = this.GetConfigure(game_cominitial); err != nil { + if v, err = this.GetConfigure(game_initial); err != nil { return } 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) return } diff --git a/sys/configure/structs/game.comInitial.go b/sys/configure/structs/game.comInitial.go deleted file mode 100644 index 7b3e7d1ab..000000000 --- a/sys/configure/structs/game.comInitial.go +++ /dev/null @@ -1,42 +0,0 @@ - -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ -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] -} - - diff --git a/sys/configure/structs/game.initial.go b/sys/configure/structs/game.initial.go new file mode 100644 index 000000000..303796eea --- /dev/null +++ b/sys/configure/structs/game.initial.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +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] +} + + diff --git a/sys/configure/structs/game.comInitialData.go b/sys/configure/structs/game.initialData.go similarity index 84% rename from sys/configure/structs/game.comInitialData.go rename to sys/configure/structs/game.initialData.go index 5439f9597..13cb1314a 100644 --- a/sys/configure/structs/game.comInitialData.go +++ b/sys/configure/structs/game.initialData.go @@ -10,17 +10,17 @@ package cfg import "errors" -type Game_comInitialData struct { +type Game_initialData struct { Index string Var []*Game_atn } -func (Game_comInitialData) GetTypeId() int { - return 1849654857 +func (Game_initialData) GetTypeId() int { + return -1101258478 } -func NewGame_comInitialData(_buf map[string]interface{}) (_v *Game_comInitialData, err error) { - _v = &Game_comInitialData{} +func NewGame_initialData(_buf map[string]interface{}) (_v *Game_initialData, err error) { + _v = &Game_initialData{} { var _ok_ bool; if _v.Index, _ok_ = _buf["index"].(string); !_ok_ { err = errors.New("index error"); return } } { var _arr_ []interface{}