去掉newhero 解析 使用hero配表

This commit is contained in:
meixiongfeng 2022-08-03 10:02:51 +08:00
parent 796ec966dd
commit f327295b52
6 changed files with 729 additions and 984 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ import (
) )
const ( const (
new_hero = "game_newhero.json" //英雄 new_hero = "game_hero.json" //英雄
hero_stargrow = "game_herostargrow.json" //英雄品质系数 hero_stargrow = "game_herostargrow.json" //英雄品质系数
hero_levelgrow = "game_herolevelgrow.json" //英雄成长系数 hero_levelgrow = "game_herolevelgrow.json" //英雄成长系数
hero_starup = "game_herostarup.json" // 升星 hero_starup = "game_herostarup.json" // 升星
@ -35,7 +35,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
err = this.MCompConfigure.Init(service, module, comp, options) err = this.MCompConfigure.Init(service, module, comp, options)
err = this.LoadMultiConfigure(map[string]interface{}{ err = this.LoadMultiConfigure(map[string]interface{}{
new_hero: cfg.NewGame_newHero, new_hero: cfg.NewGame_hero,
hero_stargrow: cfg.NewGame_heroStargrow, hero_stargrow: cfg.NewGame_heroStargrow,
hero_levelgrow: cfg.NewGame_heroLevelgrow, hero_levelgrow: cfg.NewGame_heroLevelgrow,
hero_starup: cfg.NewGame_heroStarup, hero_starup: cfg.NewGame_heroStarup,
@ -55,7 +55,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
} }
//获取英雄配置数据 //获取英雄配置数据
func (this *configureComp) getHeroConfigure() (configure *cfg.Game_newHero, err error) { func (this *configureComp) getHeroConfigure() (configure *cfg.Game_hero, err error) {
var ( var (
v interface{} v interface{}
ok bool ok bool
@ -64,7 +64,7 @@ func (this *configureComp) getHeroConfigure() (configure *cfg.Game_newHero, err
if v, err = this.GetConfigure(new_hero); err != nil { if v, err = this.GetConfigure(new_hero); err != nil {
return return
} else { } else {
if configure, ok = v.(*cfg.Game_newHero); !ok { if configure, ok = v.(*cfg.Game_hero); !ok {
err = fmt.Errorf("%T no is *cfg.Game_hero", v) err = fmt.Errorf("%T no is *cfg.Game_hero", v)
} }
} }
@ -204,7 +204,7 @@ func (this *configureComp) GetHeroStargrow() (configure *cfg.Game_heroStargrow,
} }
//获取英雄配置 //获取英雄配置
func (this *configureComp) GetHero(heroCfgId string) *cfg.Game_newHeroData { func (this *configureComp) GetHero(heroCfgId string) *cfg.Game_heroData {
cfg, err := this.getHeroConfigure() cfg, err := this.getHeroConfigure()
if err != nil { if err != nil {
return nil return nil

View File

@ -1,4 +1,3 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -23,7 +22,7 @@ type Tables struct {
skillAfteratk *Game_skillAfteratk skillAfteratk *Game_skillAfteratk
skillBuff *Game_skillBuff skillBuff *Game_skillBuff
skillPassive *Game_skillPassive skillPassive *Game_skillPassive
newHero *Game_newHero newHero *Game_hero
heroStargrow *Game_heroStargrow heroStargrow *Game_heroStargrow
heroLevelgrow *Game_heroLevelgrow heroLevelgrow *Game_heroLevelgrow
heroStarup *Game_heroStarup heroStarup *Game_heroStarup
@ -144,10 +143,10 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.skillPassive, err = NewGame_skillPassive(buf); err != nil { if tables.skillPassive, err = NewGame_skillPassive(buf); err != nil {
return nil, err return nil, err
} }
if buf, err = loader("game_newhero") ; err != nil { if buf, err = loader("game_hero"); err != nil {
return nil, err return nil, err
} }
if tables.newHero, err = NewGame_newHero(buf) ; err != nil { if tables.newHero, err = NewGame_hero(buf); err != nil {
return nil, err return nil, err
} }
if buf, err = loader("game_herostargrow"); err != nil { if buf, err = loader("game_herostargrow"); err != nil {

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_hero struct {
_dataMap map[string]*Game_heroData
_dataList []*Game_heroData
}
func NewGame_hero(_buf []map[string]interface{}) (*Game_hero, error) {
_dataList := make([]*Game_heroData, 0, len(_buf))
dataMap := make(map[string]*Game_heroData)
for _, _ele_ := range _buf {
if _v, err2 := NewGame_heroData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Hid] = _v
}
}
return &Game_hero{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *Game_hero) GetDataMap() map[string]*Game_heroData {
return table._dataMap
}
func (table *Game_hero) GetDataList() []*Game_heroData {
return table._dataList
}
func (table *Game_hero) Get(key string) *Game_heroData {
return table._dataMap[key]
}

View File

@ -11,7 +11,7 @@ package cfg
import "errors" import "errors"
import "bright/math" import "bright/math"
type Game_newHeroData struct { type Game_heroData struct {
Hid string Hid string
Name string Name string
Star int32 Star int32
@ -21,8 +21,9 @@ type Game_newHeroData struct {
Type int32 Type int32
Handbook int32 Handbook int32
Prefab int32 Prefab int32
Rotation string
Icon int32 Icon int32
Sound string Vocal string
Tujing []int32 Tujing []int32
Intr string Intr string
Events string Events string
@ -38,12 +39,12 @@ type Game_newHeroData struct {
Camerainterval float32 Camerainterval float32
} }
func (Game_newHeroData) GetTypeId() int { func (Game_heroData) GetTypeId() int {
return -1696809848 return 650222912
} }
func NewGame_newHeroData(_buf map[string]interface{}) (_v *Game_newHeroData, err error) { func NewGame_heroData(_buf map[string]interface{}) (_v *Game_heroData, err error) {
_v = &Game_newHeroData{} _v = &Game_heroData{}
{ var _ok_ bool; if _v.Hid, _ok_ = _buf["hid"].(string); !_ok_ { err = errors.New("hid error"); return } } { var _ok_ bool; if _v.Hid, _ok_ = _buf["hid"].(string); !_ok_ { err = errors.New("hid error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
@ -53,8 +54,9 @@ func NewGame_newHeroData(_buf map[string]interface{}) (_v *Game_newHeroData, err
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["handbook"].(float64); !_ok_ { err = errors.New("handbook error"); return }; _v.Handbook = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["handbook"].(float64); !_ok_ { err = errors.New("handbook error"); return }; _v.Handbook = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["prefab"].(float64); !_ok_ { err = errors.New("prefab error"); return }; _v.Prefab = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["prefab"].(float64); !_ok_ { err = errors.New("prefab error"); return }; _v.Prefab = int32(_tempNum_) }
{ var _ok_ bool; if _v.Rotation, _ok_ = _buf["rotation"].(string); !_ok_ { err = errors.New("rotation error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["icon"].(float64); !_ok_ { err = errors.New("icon error"); return }; _v.Icon = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["icon"].(float64); !_ok_ { err = errors.New("icon error"); return }; _v.Icon = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["sound"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Sound error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Sound, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } { var _ok_ bool; if _v.Vocal, _ok_ = _buf["vocal"].(string); !_ok_ { err = errors.New("vocal error"); return } }
{ {
var _arr_ []interface{} var _arr_ []interface{}
var _ok_ bool var _ok_ bool

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_newHero struct {
_dataMap map[string]*Game_newHeroData
_dataList []*Game_newHeroData
}
func NewGame_newHero(_buf []map[string]interface{}) (*Game_newHero, error) {
_dataList := make([]*Game_newHeroData, 0, len(_buf))
dataMap := make(map[string]*Game_newHeroData)
for _, _ele_ := range _buf {
if _v, err2 := NewGame_newHeroData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Hid] = _v
}
}
return &Game_newHero{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *Game_newHero) GetDataMap() map[string]*Game_newHeroData {
return table._dataMap
}
func (table *Game_newHero) GetDataList() []*Game_newHeroData {
return table._dataList
}
func (table *Game_newHero) Get(key string) *Game_newHeroData {
return table._dataMap[key]
}