|
@@ -192,9 +192,11 @@ function intSoketRtc(host: string) {
|
|
|
// init Control
|
|
// init Control
|
|
|
// window.addEventListener('gamepadconnected', conControl)
|
|
// window.addEventListener('gamepadconnected', conControl)
|
|
|
// window.addEventListener('gamepaddisconnected', disControl)
|
|
// window.addEventListener('gamepaddisconnected', disControl)
|
|
|
- window.$electron.onContrl((db:ArrayBuffer) => {
|
|
|
|
|
|
|
+ window.$electron.onContrl((db: ArrayBuffer) => {
|
|
|
console.log('123', db)
|
|
console.log('123', db)
|
|
|
})
|
|
})
|
|
|
|
|
+ console.log('成功?')
|
|
|
|
|
+
|
|
|
await sleep(3000)
|
|
await sleep(3000)
|
|
|
showLoading.value = false
|
|
showLoading.value = false
|
|
|
}
|
|
}
|
|
@@ -236,7 +238,14 @@ function intSoketRtc(host: string) {
|
|
|
// watch(() => warnAudio.value, (v) => {
|
|
// watch(() => warnAudio.value, (v) => {
|
|
|
// if (v && socket.value && socket.value.connected) socket.value.emit('msg', { type: 'warnAudio', warnAudio: v })
|
|
// if (v && socket.value && socket.value.connected) socket.value.emit('msg', { type: 'warnAudio', warnAudio: v })
|
|
|
// })
|
|
// })
|
|
|
-
|
|
|
|
|
|
|
+window.$electron.onContrl((db: Uint8Array) => {
|
|
|
|
|
+ // 拨片 2 是右拨片,1是左拨片,0是取消
|
|
|
|
|
+ const bp = db[6] === 2 ? '右拨片' : db[6] === 1 ? '左拨片' : ''
|
|
|
|
|
+ const fx = parseInt(db[44].toString(), 10) // 转10进制
|
|
|
|
|
+ const fxp = fx < 123 ? `左轮${fx}` : fx > 132 ? `右轮${fx}` : ''
|
|
|
|
|
+ const ym = parseInt(db[46].toString(), 10) // 油门
|
|
|
|
|
+ console.log(66, bp, fxp, 255 - ym)
|
|
|
|
|
+})
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
intSoketRtc(HOST.value)
|
|
intSoketRtc(HOST.value)
|
|
|
})
|
|
})
|