// Code generated by excel export. DO NOT EDIT. package data var MapAreaState = &mapAreaStateConfig{} func init() { _allList = append(_allList, MapAreaState) } type ( MapAreaStateRow struct { ID int32 `json:"ID"` // 州ID MapID int32 `json:"MapID"` // 地图ID Type int32 `json:"Type"` // 类型 BornLimit int32 `json:"BornLimit"` // 出生名额 } mapAreaStateConfig struct { baseConfig list []*MapAreaStateRow // all list idUniMaps map[int32]*MapAreaStateRow // key:id mapIDIDUniMaps map[int32]map[int32]*MapAreaStateRow // key:mapID, id } ) func (p *mapAreaStateConfig) Name() string { return "map_area_state" } func (p *mapAreaStateConfig) Init() { p.idUniMaps = map[int32]*MapAreaStateRow{} p.mapIDIDUniMaps = map[int32]map[int32]*MapAreaStateRow{} } func (p *mapAreaStateConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*MapAreaStateRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list idUniMaps := map[int32]*MapAreaStateRow{} for _, row := range list { idUniMaps[row.ID] = row } p.idUniMaps = idUniMaps mapIDIDUniMaps := map[int32]map[int32]*MapAreaStateRow{} for _, row := range list { itemMap := mapIDIDUniMaps[row.MapID] if itemMap == nil { itemMap = map[int32]*MapAreaStateRow{} mapIDIDUniMaps[row.MapID] = itemMap } itemMap[row.ID] = row } p.mapIDIDUniMaps = mapIDIDUniMaps return len(list), nil } // func (p *mapAreaStateConfig) OnAfterLoad(_ bool) { // } func (p *mapAreaStateConfig) List() []*MapAreaStateRow { return p.list } func (p *mapAreaStateConfig) GetByID(id int32) (*MapAreaStateRow, bool) { value, found := p.idUniMaps[id] return value, found } func (p *mapAreaStateConfig) ContainID(id int32) bool { _, found := p.idUniMaps[id] return found } func (p *mapAreaStateConfig) GetByMapIDID(mapID int32, id int32) (*MapAreaStateRow, bool) { mapItem, found := p.mapIDIDUniMaps[mapID] if !found { return nil, false } value, found := mapItem[id] return value, found } func (p *mapAreaStateConfig) ContainMapIDID(mapID int32, id int32) bool { mapItem, found := p.mapIDIDUniMaps[mapID] if !found { return false } _, found = mapItem[id] return found }