ecs/servers/game/data_old/ad_ext.go
2025-06-04 18:17:39 +08:00

29 lines
698 B
Go

package data
import (
"github.com/oylshe1314/framework/util"
)
type AdTableExtend struct {
*AdTable
extMap map[complex128]*Ad
}
func (this *AdTableExtend) init() error {
if this.AdTable == nil {
return nil
}
this.extMap = map[complex128]*Ad{}
for _, d := range this.l {
this.extMap[complex(float64(util.Compose2uint32(uint32(d.FunctionType), uint32(d.FunctionArg1))), float64(util.Compose2uint32(uint32(d.FunctionArg2), uint32(d.FunctionArg3))))] = d
}
return nil
}
func (this *AdTableExtend) Get(tipe, arg1, arg2, arg3 int) *Ad {
return this.extMap[complex(float64(util.Compose2uint32(uint32(tipe), uint32(arg1))), float64(util.Compose2uint32(uint32(arg2), uint32(arg3))))]
}