shop_gold.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. import (
  4. "f1-game/internal/types"
  5. )
  6. var ShopGold = &shopGoldConfig{}
  7. func init() {
  8. _allList = append(_allList, ShopGold)
  9. }
  10. type (
  11. ShopGoldRow struct {
  12. ID int32 `json:"ID"` // ID
  13. ChargeRewards types.Assets `json:"ChargeRewards"` // 获得道具
  14. FirstRewards types.Assets `json:"FirstRewards"` // 首充赠送
  15. NormalRewards types.Assets `json:"NormalRewards"` // 普通赠送
  16. }
  17. shopGoldConfig struct {
  18. baseConfig
  19. list []*ShopGoldRow // all list
  20. idUniMaps map[int32]*ShopGoldRow // key:id
  21. }
  22. )
  23. func (p *shopGoldConfig) Name() string {
  24. return "shop_gold"
  25. }
  26. func (p *shopGoldConfig) Init() {
  27. p.idUniMaps = map[int32]*ShopGoldRow{}
  28. }
  29. func (p *shopGoldConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  30. if reload && p.denyLoad {
  31. return 0, nil
  32. }
  33. var list []*ShopGoldRow
  34. if err := DecodeData(maps, &list); err != nil {
  35. return 0, err
  36. }
  37. p.list = list
  38. idUniMaps := map[int32]*ShopGoldRow{}
  39. for _, row := range list {
  40. idUniMaps[row.ID] = row
  41. }
  42. p.idUniMaps = idUniMaps
  43. return len(list), nil
  44. }
  45. // func (p *shopGoldConfig) OnAfterLoad(_ bool) {
  46. // }
  47. func (p *shopGoldConfig) List() []*ShopGoldRow {
  48. return p.list
  49. }
  50. func (p *shopGoldConfig) GetByID(id int32) (*ShopGoldRow, bool) {
  51. value, found := p.idUniMaps[id]
  52. return value, found
  53. }
  54. func (p *shopGoldConfig) ContainID(id int32) bool {
  55. _, found := p.idUniMaps[id]
  56. return found
  57. }