修改模拟射箭

This commit is contained in:
kron
2025-07-05 18:51:27 +08:00
parent 2e8f63b17e
commit 620ab246b9
2 changed files with 10 additions and 4 deletions

View File

@@ -201,7 +201,7 @@ export const simulShootAPI = (device_id, x, y) => {
const data = { const data = {
device_id, device_id,
}; };
if (x && y) { if (x !== undefined && y !== undefined) {
data.x = x; data.x = x;
data.y = y; data.y = y;
} }

View File

@@ -111,6 +111,9 @@ function calcRealY(num) {
const simulShoot = async () => { const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId); if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
}; };
const simulShoot2 = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId, 1, 1);
};
</script> </script>
<template> <template>
@@ -179,8 +182,9 @@ const simulShoot = async () => {
<view v-if="avatar" class="footer"> <view v-if="avatar" class="footer">
<image :src="avatar" mode="widthFix" /> <image :src="avatar" mode="widthFix" />
</view> </view>
<view class="simul" @click="simulShoot" :style="{ color: '#fff' }"> <view class="simul">
模拟射箭 <button @click="simulShoot">模拟</button>
<button @click="simulShoot2">射箭</button>
</view> </view>
<StartCountdown :start="startCount" /> <StartCountdown :start="startCount" />
</view> </view>
@@ -262,7 +266,9 @@ const simulShoot = async () => {
position: absolute; position: absolute;
bottom: 20px; bottom: 20px;
right: 20px; right: 20px;
color: #fff;
margin-left: 20px; margin-left: 20px;
} }
.simul > button {
color: #fff;
}
</style> </style>