| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var Item = &itemConfig{}
- func init() {
- _allList = append(_allList, Item)
- }
- type (
- ItemRow struct {
- ID int32 `json:"ID"` // ID
- ParseType int32 `json:"ParseType"` // 解析类型
- ItemSubType int32 `json:"ItemSubType"` // 二级类型
- CanUse bool `json:"CanUse"` // 是否可使用
- CanSale bool `json:"CanSale"` // 是否可出售
- SalePrice types.Assets `json:"SalePrice"` // 出售价格
- Quality int32 `json:"Quality"` // 品质
- IsBind bool `json:"IsBind"` // 是否绑定
- IsMarquee bool `json:"IsMarquee"` // 跑马灯
- }
- itemConfig struct {
- baseConfig
- list []*ItemRow // all list
- idUniMaps map[int32]*ItemRow // key:id
- }
- )
- func (p *itemConfig) Name() string {
- return "item"
- }
- func (p *itemConfig) Init() {
- p.idUniMaps = map[int32]*ItemRow{}
- }
- func (p *itemConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*ItemRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- idUniMaps := map[int32]*ItemRow{}
- for _, row := range list {
- idUniMaps[row.ID] = row
- }
- p.idUniMaps = idUniMaps
- return len(list), nil
- }
- // func (p *itemConfig) OnAfterLoad(_ bool) {
- // }
- func (p *itemConfig) List() []*ItemRow {
- return p.list
- }
- func (p *itemConfig) GetByID(id int32) (*ItemRow, bool) {
- value, found := p.idUniMaps[id]
- return value, found
- }
- func (p *itemConfig) ContainID(id int32) bool {
- _, found := p.idUniMaps[id]
- return found
- }
|