| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- var MapRedeploy = &mapRedeployConfig{}
- func init() {
- _allList = append(_allList, MapRedeploy)
- }
- type (
- MapRedeployRow struct {
- ConfigID int32 `json:"ConfigID"` // 配置ID
- Level int32 `json:"Level"` // 等级
- RedeployLimit int32 `json:"RedeployLimit"` // 调动上限
- CanConscript bool `json:"CanConscript"` // 是否可征兵
- }
- mapRedeployConfig struct {
- baseConfig
- list []*MapRedeployRow // all list
- configIDLevelUniMaps map[int32]map[int32]*MapRedeployRow // key:configID, level
- }
- )
- func (p *mapRedeployConfig) Name() string {
- return "map_redeploy"
- }
- func (p *mapRedeployConfig) Init() {
- p.configIDLevelUniMaps = map[int32]map[int32]*MapRedeployRow{}
- }
- func (p *mapRedeployConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*MapRedeployRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- configIDLevelUniMaps := map[int32]map[int32]*MapRedeployRow{}
- for _, row := range list {
- itemMap := configIDLevelUniMaps[row.ConfigID]
- if itemMap == nil {
- itemMap = map[int32]*MapRedeployRow{}
- configIDLevelUniMaps[row.ConfigID] = itemMap
- }
- itemMap[row.Level] = row
- }
- p.configIDLevelUniMaps = configIDLevelUniMaps
- return len(list), nil
- }
- // func (p *mapRedeployConfig) OnAfterLoad(_ bool) {
- // }
- func (p *mapRedeployConfig) List() []*MapRedeployRow {
- return p.list
- }
- func (p *mapRedeployConfig) GetByConfigIDLevel(configID int32, level int32) (*MapRedeployRow, bool) {
- mapItem, found := p.configIDLevelUniMaps[configID]
- if !found {
- return nil, false
- }
- value, found := mapItem[level]
- return value, found
- }
- func (p *mapRedeployConfig) ContainConfigIDLevel(configID int32, level int32) bool {
- mapItem, found := p.configIDLevelUniMaps[configID]
- if !found {
- return false
- }
- _, found = mapItem[level]
- return found
- }
|