| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- var HeroStarAttrs = &heroStarAttrsConfig{}
- func init() {
- _allList = append(_allList, HeroStarAttrs)
- }
- type (
- HeroStarAttrsRow struct {
- HeroID int32 `json:"HeroID"` // 英雄ID
- Star int32 `json:"Star"` // 星级 主键,英雄星级 = star
- Health int64 `json:"Health"` // 血量
- Attack int64 `json:"Attack"` // 攻击
- Defense int64 `json:"Defense"` // 防御
- }
- heroStarAttrsConfig struct {
- baseConfig
- list []*HeroStarAttrsRow // all list
- heroIDStarUniMaps map[int32]map[int32]*HeroStarAttrsRow // key:heroID, star
- }
- )
- func (p *heroStarAttrsConfig) Name() string {
- return "hero_star_attrs"
- }
- func (p *heroStarAttrsConfig) Init() {
- p.heroIDStarUniMaps = map[int32]map[int32]*HeroStarAttrsRow{}
- }
- func (p *heroStarAttrsConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*HeroStarAttrsRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- heroIDStarUniMaps := map[int32]map[int32]*HeroStarAttrsRow{}
- for _, row := range list {
- itemMap := heroIDStarUniMaps[row.HeroID]
- if itemMap == nil {
- itemMap = map[int32]*HeroStarAttrsRow{}
- heroIDStarUniMaps[row.HeroID] = itemMap
- }
- itemMap[row.Star] = row
- }
- p.heroIDStarUniMaps = heroIDStarUniMaps
- return len(list), nil
- }
- // func (p *heroStarAttrsConfig) OnAfterLoad(_ bool) {
- // }
- func (p *heroStarAttrsConfig) List() []*HeroStarAttrsRow {
- return p.list
- }
- func (p *heroStarAttrsConfig) GetByHeroIDStar(heroID int32, star int32) (*HeroStarAttrsRow, bool) {
- mapItem, found := p.heroIDStarUniMaps[heroID]
- if !found {
- return nil, false
- }
- value, found := mapItem[star]
- return value, found
- }
- func (p *heroStarAttrsConfig) ContainHeroIDStar(heroID int32, star int32) bool {
- mapItem, found := p.heroIDStarUniMaps[heroID]
- if !found {
- return false
- }
- _, found = mapItem[star]
- return found
- }
|