league_quest.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. var LeagueQuest = &leagueQuestConfig{}
  4. func init() {
  5. _allList = append(_allList, LeagueQuest)
  6. }
  7. type (
  8. LeagueQuestRow struct {
  9. ChapterID int32 `json:"ChapterID"` // 章节ID
  10. QuestType int32 `json:"questType"` // 任务类型
  11. QuestGroupID int32 `json:"questGroupID"` // 任务组ID
  12. }
  13. leagueQuestConfig struct {
  14. baseConfig
  15. list []*LeagueQuestRow // all list
  16. chapterIDUniMaps map[int32]*LeagueQuestRow // key:chapterID
  17. }
  18. )
  19. func (p *leagueQuestConfig) Name() string {
  20. return "league_quest"
  21. }
  22. func (p *leagueQuestConfig) Init() {
  23. p.chapterIDUniMaps = map[int32]*LeagueQuestRow{}
  24. }
  25. func (p *leagueQuestConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  26. if reload && p.denyLoad {
  27. return 0, nil
  28. }
  29. var list []*LeagueQuestRow
  30. if err := DecodeData(maps, &list); err != nil {
  31. return 0, err
  32. }
  33. p.list = list
  34. chapterIDUniMaps := map[int32]*LeagueQuestRow{}
  35. for _, row := range list {
  36. chapterIDUniMaps[row.ChapterID] = row
  37. }
  38. p.chapterIDUniMaps = chapterIDUniMaps
  39. return len(list), nil
  40. }
  41. // func (p *leagueQuestConfig) OnAfterLoad(_ bool) {
  42. // }
  43. func (p *leagueQuestConfig) List() []*LeagueQuestRow {
  44. return p.list
  45. }
  46. func (p *leagueQuestConfig) GetByChapterID(chapterID int32) (*LeagueQuestRow, bool) {
  47. value, found := p.chapterIDUniMaps[chapterID]
  48. return value, found
  49. }
  50. func (p *leagueQuestConfig) ContainChapterID(chapterID int32) bool {
  51. _, found := p.chapterIDUniMaps[chapterID]
  52. return found
  53. }