| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- var Chapter = &chapterConfig{}
- func init() {
- _allList = append(_allList, Chapter)
- }
- type (
- ChapterRow struct {
- ID int32 `json:"ID"` // 章节ID
- UnlockID int32 `json:"UnlockID"` // 前置关卡ID
- StartID int32 `json:"StartID"` // 开始关卡ID
- EndID int32 `json:"EndID"` // 结束关卡ID
- RewardPoolID int32 `json:"RewardPoolID"` // 奖励库ID
- }
- chapterConfig struct {
- baseConfig
- list []*ChapterRow // all list
- idUniMaps map[int32]*ChapterRow // key:id
- }
- )
- func (p *chapterConfig) Name() string {
- return "chapter"
- }
- func (p *chapterConfig) Init() {
- p.idUniMaps = map[int32]*ChapterRow{}
- }
- func (p *chapterConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*ChapterRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- idUniMaps := map[int32]*ChapterRow{}
- for _, row := range list {
- idUniMaps[row.ID] = row
- }
- p.idUniMaps = idUniMaps
- return len(list), nil
- }
- // func (p *chapterConfig) OnAfterLoad(_ bool) {
- // }
- func (p *chapterConfig) List() []*ChapterRow {
- return p.list
- }
- func (p *chapterConfig) GetByID(id int32) (*ChapterRow, bool) {
- value, found := p.idUniMaps[id]
- return value, found
- }
- func (p *chapterConfig) ContainID(id int32) bool {
- _, found := p.idUniMaps[id]
- return found
- }
|