| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- // 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
- }
|