// Code generated by excel export. DO NOT EDIT. package data import ( "f1-game/internal/types" ) var LeagueTechLevel = &leagueTechLevelConfig{} func init() { _allList = append(_allList, LeagueTechLevel) } type ( LeagueTechLevelRow struct { TechID int32 `json:"TechID"` // 科技ID Level int32 `json:"Level"` // 等级 UpgradeCost types.Assets `json:"UpgradeCost"` // 升级消耗 Attrs types.Attrs `json:"Attrs"` // 属性值 PreTechs types.PairList[int32, int32] `json:"PreTechs"` // 前置科技等级 } leagueTechLevelConfig struct { baseConfig list []*LeagueTechLevelRow // all list techIDLevelUniMaps map[int32]map[int32]*LeagueTechLevelRow // key:techID, level } ) func (p *leagueTechLevelConfig) Name() string { return "league_tech_level" } func (p *leagueTechLevelConfig) Init() { p.techIDLevelUniMaps = map[int32]map[int32]*LeagueTechLevelRow{} } func (p *leagueTechLevelConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*LeagueTechLevelRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list techIDLevelUniMaps := map[int32]map[int32]*LeagueTechLevelRow{} for _, row := range list { itemMap := techIDLevelUniMaps[row.TechID] if itemMap == nil { itemMap = map[int32]*LeagueTechLevelRow{} techIDLevelUniMaps[row.TechID] = itemMap } itemMap[row.Level] = row } p.techIDLevelUniMaps = techIDLevelUniMaps return len(list), nil } // func (p *leagueTechLevelConfig) OnAfterLoad(_ bool) { // } func (p *leagueTechLevelConfig) List() []*LeagueTechLevelRow { return p.list } func (p *leagueTechLevelConfig) GetByTechIDLevel(techID int32, level int32) (*LeagueTechLevelRow, bool) { mapItem, found := p.techIDLevelUniMaps[techID] if !found { return nil, false } value, found := mapItem[level] return value, found } func (p *leagueTechLevelConfig) ContainTechIDLevel(techID int32, level int32) bool { mapItem, found := p.techIDLevelUniMaps[techID] if !found { return false } _, found = mapItem[level] return found }