// Code generated by excel export. DO NOT EDIT. package data import ( "f1-game/internal/types" ) var ShopGold = &shopGoldConfig{} func init() { _allList = append(_allList, ShopGold) } type ( ShopGoldRow struct { ID int32 `json:"ID"` // ID ChargeRewards types.Assets `json:"ChargeRewards"` // 获得道具 FirstRewards types.Assets `json:"FirstRewards"` // 首充赠送 NormalRewards types.Assets `json:"NormalRewards"` // 普通赠送 } shopGoldConfig struct { baseConfig list []*ShopGoldRow // all list idUniMaps map[int32]*ShopGoldRow // key:id } ) func (p *shopGoldConfig) Name() string { return "shop_gold" } func (p *shopGoldConfig) Init() { p.idUniMaps = map[int32]*ShopGoldRow{} } func (p *shopGoldConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*ShopGoldRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list idUniMaps := map[int32]*ShopGoldRow{} for _, row := range list { idUniMaps[row.ID] = row } p.idUniMaps = idUniMaps return len(list), nil } // func (p *shopGoldConfig) OnAfterLoad(_ bool) { // } func (p *shopGoldConfig) List() []*ShopGoldRow { return p.list } func (p *shopGoldConfig) GetByID(id int32) (*ShopGoldRow, bool) { value, found := p.idUniMaps[id] return value, found } func (p *shopGoldConfig) ContainID(id int32) bool { _, found := p.idUniMaps[id] return found }