ecs/servers/game/data_old/function_open1_ext.go

38 lines
865 B
Go
Raw Normal View History

2025-06-04 18:17:39 +08:00
package data
import "github.com/oylshe1314/framework/util"
type FunctionOpen1TableExtend struct {
*FunctionOpen1Table
extMap map[uint64][]*FunctionOpen1
}
func (this *FunctionOpen1TableExtend) init() error {
if this.FunctionOpen1Table == nil {
return nil
}
this.extMap = map[uint64][]*FunctionOpen1{}
for _, d := range this.l {
var key = util.Compose2uint32(uint32(d.GridType), uint32(d.GridId))
this.extMap[key] = append(this.extMap[key], d)
}
return nil
}
func (this *FunctionOpen1TableExtend) List(gridType, gridId int) []*FunctionOpen1 {
return this.extMap[util.Compose2uint32(uint32(gridType), uint32(gridId))]
}
func (this *FunctionOpen1TableExtend) Get(gridType, gridId int, lockType int) *FunctionOpen1 {
var list = this.List(gridType, gridId)
for _, d := range list {
if d.LockType == lockType {
return d
}
}
return nil
}