47 lines
982 B
Go
47 lines
982 B
Go
package data
|
|
|
|
import "github.com/oylshe1314/framework/errors"
|
|
|
|
func (this *CopyMaterialTable) check() error {
|
|
for _, d := range this.l {
|
|
if len(d.UnlockArg) != len(d.UnlockType) {
|
|
return errors.Error("incorrect 'CopyMaterial' table, error: len(d.UnlockArg) != len(d.UnlockType), id: ", d.id())
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type CopyMaterialTableExtend struct {
|
|
*CopyMaterialTable
|
|
|
|
types []int
|
|
extMap map[int]*CopyMaterial
|
|
}
|
|
|
|
func (this *CopyMaterialTableExtend) init() error {
|
|
if this.CopyMaterialTable == nil {
|
|
return nil
|
|
}
|
|
|
|
var types = map[int]struct{}{}
|
|
this.extMap = map[int]*CopyMaterial{}
|
|
for _, d := range this.CopyMaterialTable.l {
|
|
types[d.MaterialType] = struct{}{}
|
|
this.extMap[d.SceneId] = d
|
|
}
|
|
|
|
for tipe := range types {
|
|
this.types = append(this.types, tipe)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (this *CopyMaterialTableExtend) Get(sceneId int) *CopyMaterial {
|
|
return this.extMap[sceneId]
|
|
}
|
|
|
|
func (this *CopyMaterialTableExtend) Types() []int {
|
|
return this.types
|
|
}
|