// Code generated by excel export. DO NOT EDIT. package data import ( "f1-game/internal/types" ) var MainQuest = &mainQuestConfig{} func init() { _allList = append(_allList, MainQuest) } type ( MainQuestRow struct { ChapterID int32 `json:"ChapterID"` // 章节ID ChapterRewards types.Assets `json:"ChapterRewards"` // 章节奖励 QuestGroupID int32 `json:"QuestGroupID"` // 任务组ID NextChapterID int32 `json:"NextChapterID"` // 下一章节ID } mainQuestConfig struct { baseConfig list []*MainQuestRow // all list chapterIDUniMaps map[int32]*MainQuestRow // key:chapterID } ) func (p *mainQuestConfig) Name() string { return "main_quest" } func (p *mainQuestConfig) Init() { p.chapterIDUniMaps = map[int32]*MainQuestRow{} } func (p *mainQuestConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*MainQuestRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list chapterIDUniMaps := map[int32]*MainQuestRow{} for _, row := range list { chapterIDUniMaps[row.ChapterID] = row } p.chapterIDUniMaps = chapterIDUniMaps return len(list), nil } // func (p *mainQuestConfig) OnAfterLoad(_ bool) { // } func (p *mainQuestConfig) List() []*MainQuestRow { return p.list } func (p *mainQuestConfig) GetByChapterID(chapterID int32) (*MainQuestRow, bool) { value, found := p.chapterIDUniMaps[chapterID] return value, found } func (p *mainQuestConfig) ContainChapterID(chapterID int32) bool { _, found := p.chapterIDUniMaps[chapterID] return found }