| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- var MonsterGroup = &monsterGroupConfig{}
- func init() {
- _allList = append(_allList, MonsterGroup)
- }
- type (
- MonsterGroupRow struct {
- ID int32 `json:"ID"` // ID
- LineupIndex int32 `json:"LineupIndex"` // 阵容站位
- MonsterID int32 `json:"MonsterID"` // 怪物ID
- TroopTypeID int32 `json:"TroopTypeID"` // 兵种ID
- Troop int32 `json:"Troop"` // 兵力
- }
- monsterGroupConfig struct {
- baseConfig
- list []*MonsterGroupRow // all list
- idLineupIndexUniMaps map[int32]map[int32]*MonsterGroupRow // key:id, lineupIndex
- }
- )
- func (p *monsterGroupConfig) Name() string {
- return "monster_group"
- }
- func (p *monsterGroupConfig) Init() {
- p.idLineupIndexUniMaps = map[int32]map[int32]*MonsterGroupRow{}
- }
- func (p *monsterGroupConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*MonsterGroupRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- idLineupIndexUniMaps := map[int32]map[int32]*MonsterGroupRow{}
- for _, row := range list {
- itemMap := idLineupIndexUniMaps[row.ID]
- if itemMap == nil {
- itemMap = map[int32]*MonsterGroupRow{}
- idLineupIndexUniMaps[row.ID] = itemMap
- }
- itemMap[row.LineupIndex] = row
- }
- p.idLineupIndexUniMaps = idLineupIndexUniMaps
- return len(list), nil
- }
- // func (p *monsterGroupConfig) OnAfterLoad(_ bool) {
- // }
- func (p *monsterGroupConfig) List() []*MonsterGroupRow {
- return p.list
- }
- func (p *monsterGroupConfig) GetByIDLineupIndex(id int32, lineupIndex int32) (*MonsterGroupRow, bool) {
- mapItem, found := p.idLineupIndexUniMaps[id]
- if !found {
- return nil, false
- }
- value, found := mapItem[lineupIndex]
- return value, found
- }
- func (p *monsterGroupConfig) ContainIDLineupIndex(id int32, lineupIndex int32) bool {
- mapItem, found := p.idLineupIndexUniMaps[id]
- if !found {
- return false
- }
- _, found = mapItem[lineupIndex]
- return found
- }
|