| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var MapRes = &mapResConfig{}
- func init() {
- _allList = append(_allList, MapRes)
- }
- type (
- MapResRow struct {
- ConfigID int32 `json:"ConfigID"` // 资源配置ID
- Level int32 `json:"Level"` // 等级
- ItemID int32 `json:"ItemID"` // 产出ID
- Yield int64 `json:"Yield"` // 每小时产出量
- Armies types.List[int32] `json:"Armies"` // 守军部队
- }
- mapResConfig struct {
- baseConfig
- list []*MapResRow // all list
- configIDUniMaps map[int32]*MapResRow // key:configID
- }
- )
- func (p *mapResConfig) Name() string {
- return "map_res"
- }
- func (p *mapResConfig) Init() {
- p.configIDUniMaps = map[int32]*MapResRow{}
- }
- func (p *mapResConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*MapResRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- configIDUniMaps := map[int32]*MapResRow{}
- for _, row := range list {
- configIDUniMaps[row.ConfigID] = row
- }
- p.configIDUniMaps = configIDUniMaps
- return len(list), nil
- }
- // func (p *mapResConfig) OnAfterLoad(_ bool) {
- // }
- func (p *mapResConfig) List() []*MapResRow {
- return p.list
- }
- func (p *mapResConfig) GetByConfigID(configID int32) (*MapResRow, bool) {
- value, found := p.configIDUniMaps[configID]
- return value, found
- }
- func (p *mapResConfig) ContainConfigID(configID int32) bool {
- _, found := p.configIDUniMaps[configID]
- return found
- }
|