map_main_quest.go 1.7 KB

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