| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var ShopCard = &shopCardConfig{}
- func init() {
- _allList = append(_allList, ShopCard)
- }
- type (
- ShopCardRow struct {
- ID int32 `json:"ID"` // ID
- ChargeRewards types.Assets `json:"ChargeRewards"` // 立即获得奖励
- Day int32 `json:"Day"` // 持续天数
- DayRewards types.Assets `json:"DayRewards"` // 持续奖励
- DayLimit int32 `json:"DayLimit"` // 日期上限
- }
- shopCardConfig struct {
- baseConfig
- list []*ShopCardRow // all list
- idUniMaps map[int32]*ShopCardRow // key:id
- }
- )
- func (p *shopCardConfig) Name() string {
- return "shop_card"
- }
- func (p *shopCardConfig) Init() {
- p.idUniMaps = map[int32]*ShopCardRow{}
- }
- func (p *shopCardConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*ShopCardRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- idUniMaps := map[int32]*ShopCardRow{}
- for _, row := range list {
- idUniMaps[row.ID] = row
- }
- p.idUniMaps = idUniMaps
- return len(list), nil
- }
- // func (p *shopCardConfig) OnAfterLoad(_ bool) {
- // }
- func (p *shopCardConfig) List() []*ShopCardRow {
- return p.list
- }
- func (p *shopCardConfig) GetByID(id int32) (*ShopCardRow, bool) {
- value, found := p.idUniMaps[id]
- return value, found
- }
- func (p *shopCardConfig) ContainID(id int32) bool {
- _, found := p.idUniMaps[id]
- return found
- }
|