| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var LeagueTech = &leagueTechConfig{}
- func init() {
- _allList = append(_allList, LeagueTech)
- }
- type (
- LeagueTechRow struct {
- ID int32 `json:"ID"` // 科技ID
- PreTechs types.PairList[int32, int32] `json:"PreTechs"` // 前置科技
- }
- leagueTechConfig struct {
- baseConfig
- list []*LeagueTechRow // all list
- idUniMaps map[int32]*LeagueTechRow // key:id
- }
- )
- func (p *leagueTechConfig) Name() string {
- return "league_tech"
- }
- func (p *leagueTechConfig) Init() {
- p.idUniMaps = map[int32]*LeagueTechRow{}
- }
- func (p *leagueTechConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*LeagueTechRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- idUniMaps := map[int32]*LeagueTechRow{}
- for _, row := range list {
- idUniMaps[row.ID] = row
- }
- p.idUniMaps = idUniMaps
- return len(list), nil
- }
- // func (p *leagueTechConfig) OnAfterLoad(_ bool) {
- // }
- func (p *leagueTechConfig) List() []*LeagueTechRow {
- return p.list
- }
- func (p *leagueTechConfig) GetByID(id int32) (*LeagueTechRow, bool) {
- value, found := p.idUniMaps[id]
- return value, found
- }
- func (p *leagueTechConfig) ContainID(id int32) bool {
- _, found := p.idUniMaps[id]
- return found
- }
|