【修改转动钥匙挡位按钮】
This commit is contained in:
parent
41460f29c1
commit
caeff9b089
@ -45,7 +45,7 @@ var AlarmDriveType = ecs.NewComponentType[AlarmDrive]()
|
||||
|
||||
// 挡位组件
|
||||
type GearState struct {
|
||||
Val int
|
||||
Val int32
|
||||
}
|
||||
|
||||
var GearStateType = ecs.NewComponentType[GearState]()
|
||||
|
@ -153,7 +153,7 @@ func setSpkDefault(spk *component.SpkElectronic) {
|
||||
}
|
||||
|
||||
// 设置IBP钥匙状态
|
||||
func setIbpKeyGearVal(entry *ecs.Entry, val int) {
|
||||
func setIbpKeyGearVal(entry *ecs.Entry, val int32) {
|
||||
if entry == nil {
|
||||
return
|
||||
}
|
||||
|
22
fi/ibp.go
22
fi/ibp.go
@ -48,28 +48,14 @@ func PressUpButton(w ecs.World, id string) {
|
||||
})
|
||||
}
|
||||
|
||||
// 修改钥匙旋钮关闭状态
|
||||
func PutKeyOff(w ecs.World, id string) {
|
||||
// 修改钥匙挡位
|
||||
func SwitchKeyGear(w ecs.World, id string, gear int32) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
entry, ok := wd.EntityMap[id]
|
||||
if ok {
|
||||
state := component.BitStateType.Get(entry)
|
||||
state.Val = false
|
||||
} else {
|
||||
fmt.Printf("未找到id=%s的钥匙开关\n", id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 修改钥匙旋钮开启状态
|
||||
func PutKeyOn(w ecs.World, id string) {
|
||||
w.Execute(func() {
|
||||
wd := entity.GetWorldData(w)
|
||||
entry, ok := wd.EntityMap[id]
|
||||
if ok {
|
||||
state := component.BitStateType.Get(entry)
|
||||
state.Val = true
|
||||
state := component.GearStateType.Get(entry)
|
||||
state.Val = gear
|
||||
} else {
|
||||
fmt.Printf("未找到id=%s的钥匙开关\n", id)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user