lord_show.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. import (
  4. "f1-game/internal/types"
  5. )
  6. var LordShow = &lordShowConfig{}
  7. func init() {
  8. _allList = append(_allList, LordShow)
  9. }
  10. type (
  11. LordShowRow struct {
  12. ShowID int32 `json:"ShowID"` // 外显ID
  13. Type int32 `json:"type"` // 类型
  14. ActiveCondition types.Pair[int32, int32] `json:"activeCondition"` // 激活条件
  15. ExpireTime int32 `json:"expireTime"` // 有效时间(s)
  16. }
  17. lordShowConfig struct {
  18. baseConfig
  19. list []*LordShowRow // all list
  20. showIDUniMaps map[int32]*LordShowRow // key:showID
  21. }
  22. )
  23. func (p *lordShowConfig) Name() string {
  24. return "lord_show"
  25. }
  26. func (p *lordShowConfig) Init() {
  27. p.showIDUniMaps = map[int32]*LordShowRow{}
  28. }
  29. func (p *lordShowConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  30. if reload && p.denyLoad {
  31. return 0, nil
  32. }
  33. var list []*LordShowRow
  34. if err := DecodeData(maps, &list); err != nil {
  35. return 0, err
  36. }
  37. p.list = list
  38. showIDUniMaps := map[int32]*LordShowRow{}
  39. for _, row := range list {
  40. showIDUniMaps[row.ShowID] = row
  41. }
  42. p.showIDUniMaps = showIDUniMaps
  43. return len(list), nil
  44. }
  45. // func (p *lordShowConfig) OnAfterLoad(_ bool) {
  46. // }
  47. func (p *lordShowConfig) List() []*LordShowRow {
  48. return p.list
  49. }
  50. func (p *lordShowConfig) GetByShowID(showID int32) (*LordShowRow, bool) {
  51. value, found := p.showIDUniMaps[showID]
  52. return value, found
  53. }
  54. func (p *lordShowConfig) ContainShowID(showID int32) bool {
  55. _, found := p.showIDUniMaps[showID]
  56. return found
  57. }