添加X环显示
This commit is contained in:
@@ -59,6 +59,7 @@ export const audioFils = {
|
|||||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutxin69nj1xh7yfz.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutxin69nj1xh7yfz.mp3",
|
||||||
"10环":
|
"10环":
|
||||||
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutxinnvsx0tt7ksa.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-09-17/dcutxinnvsx0tt7ksa.mp3",
|
||||||
|
X环: "https://static.shelingxingqiu.com/attachment/2026-02-09/dga8puwekpe2gmtbu4.mp3",
|
||||||
向上调整:
|
向上调整:
|
||||||
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6ellf5pfvu3l8dhr.mp3",
|
"https://static.shelingxingqiu.com/attachment/2025-11-12/de6ellf5pfvu3l8dhr.mp3",
|
||||||
向右上调整:
|
向右上调整:
|
||||||
@@ -132,7 +133,7 @@ class AudioManager {
|
|||||||
this.localFileCache = uni.getStorageSync("audio_local_files") || {};
|
this.localFileCache = uni.getStorageSync("audio_local_files") || {};
|
||||||
// 启动时自动清理过期的缓存文件(URL 已不在 audioFils 中的文件)
|
// 启动时自动清理过期的缓存文件(URL 已不在 audioFils 中的文件)
|
||||||
this.cleanObsoleteCache();
|
this.cleanObsoleteCache();
|
||||||
|
|
||||||
this.initAudios();
|
this.initAudios();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ const simulShoot = async () => {
|
|||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
|
||||||
};
|
};
|
||||||
const simulShoot2 = async () => {
|
const simulShoot2 = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId, 1, 1);
|
if (device.value.deviceId)
|
||||||
|
await simulShootAPI(device.value.deviceId, 0.01, 0.01);
|
||||||
};
|
};
|
||||||
|
|
||||||
const env = computed(() => {
|
const env = computed(() => {
|
||||||
@@ -180,7 +181,8 @@ onBeforeUnmount(() => {
|
|||||||
left: calcRealX(latestOne.ring ? latestOne.x : 0, 28),
|
left: calcRealX(latestOne.ring ? latestOne.x : 0, 28),
|
||||||
top: calcRealY(latestOne.ring ? latestOne.y : 0, 28),
|
top: calcRealY(latestOne.ring ? latestOne.y : 0, 28),
|
||||||
}"
|
}"
|
||||||
>{{ latestOne.ring || "未上靶" }}<text v-if="latestOne.ring">环</text>
|
>{{ latestOne.ringX ? "X" : latestOne.ring || "未上靶"
|
||||||
|
}}<text v-if="latestOne.ring">环</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
v-if="
|
v-if="
|
||||||
@@ -203,7 +205,7 @@ onBeforeUnmount(() => {
|
|||||||
left: calcRealX(bluelatestOne.ring ? bluelatestOne.x : 0, 28),
|
left: calcRealX(bluelatestOne.ring ? bluelatestOne.x : 0, 28),
|
||||||
top: calcRealY(bluelatestOne.ring ? bluelatestOne.y : 0, 28),
|
top: calcRealY(bluelatestOne.ring ? bluelatestOne.y : 0, 28),
|
||||||
}"
|
}"
|
||||||
>{{ bluelatestOne.ring || "未上靶"
|
>{{ bluelatestOne.ringX ? "X" : bluelatestOne.ring || "未上靶"
|
||||||
}}<text v-if="bluelatestOne.ring">环</text></view
|
}}<text v-if="bluelatestOne.ring">环</text></view
|
||||||
>
|
>
|
||||||
<block v-for="(bow, index) in scores" :key="index">
|
<block v-for="(bow, index) in scores" :key="index">
|
||||||
|
|||||||
@@ -49,31 +49,34 @@ const updateSound = () => {
|
|||||||
async function onReceiveMessage(message) {
|
async function onReceiveMessage(message) {
|
||||||
if (ended.value) return;
|
if (ended.value) return;
|
||||||
if (Array.isArray(message)) return;
|
if (Array.isArray(message)) return;
|
||||||
if (message.type === MESSAGETYPESV2.BattleStart) {
|
const { type, mode, current, shootData } = message;
|
||||||
melee.value = Boolean(message.mode > 3);
|
if (type === MESSAGETYPESV2.BattleStart) {
|
||||||
totalShot.value = message.mode === 1 ? 3 : 2;
|
melee.value = Boolean(mode > 3);
|
||||||
|
totalShot.value = mode === 1 ? 3 : 2;
|
||||||
currentRoundEnded.value = true;
|
currentRoundEnded.value = true;
|
||||||
audioManager.play("比赛开始");
|
audioManager.play("比赛开始");
|
||||||
}
|
}
|
||||||
if (message.type === MESSAGETYPESV2.BattleEnd) {
|
if (type === MESSAGETYPESV2.BattleEnd) {
|
||||||
audioManager.play("比赛结束");
|
audioManager.play("比赛结束");
|
||||||
}
|
}
|
||||||
if (message.type === MESSAGETYPESV2.ShootResult) {
|
if (type === MESSAGETYPESV2.ShootResult) {
|
||||||
if (melee.value && message.current.playerId !== user.value.id) return;
|
if (melee.value && current.playerId !== user.value.id) return;
|
||||||
if (message.current.playerId === user.value.id) currentShot.value++;
|
if (current.playerId === user.value.id) currentShot.value++;
|
||||||
if (message.shootData) {
|
if (message.shootData) {
|
||||||
let key = [];
|
let key = [];
|
||||||
key.push(
|
key.push(
|
||||||
message.shootData.ring ? `${message.shootData.ring}环` : "未上靶"
|
shootData.ring
|
||||||
|
? `${shootData.ringX ? "X" : shootData.ring}环`
|
||||||
|
: "未上靶"
|
||||||
);
|
);
|
||||||
if (!message.shootData.ring)
|
if (!shootData.ring)
|
||||||
key.push(`向${getDirectionText(message.shootData.angle)}调整`);
|
key.push(`向${getDirectionText(shootData.angle)}调整`);
|
||||||
audioManager.play(key, false);
|
audioManager.play(key, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message.type === MESSAGETYPESV2.NewRound) {
|
if (type === MESSAGETYPESV2.NewRound) {
|
||||||
currentShot.value = 0;
|
currentShot.value = 0;
|
||||||
currentRound.value = message.current.round;
|
currentRound.value = current.round;
|
||||||
currentRoundEnded.value = true;
|
currentRoundEnded.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ async function onReceiveMessage(msg) {
|
|||||||
if (msg.shootData) arrow = msg.shootData;
|
if (msg.shootData) arrow = msg.shootData;
|
||||||
}
|
}
|
||||||
let key = [];
|
let key = [];
|
||||||
key.push(arrow.ring ? `${arrow.ring}环` : "未上靶");
|
key.push(arrow.ring ? `${arrow.ringX ? "X" : arrow.ring}环` : "未上靶");
|
||||||
if (!arrow.ring) key.push(`向${getDirectionText(arrow.angle)}调整`);
|
if (!arrow.ring) key.push(`向${getDirectionText(arrow.angle)}调整`);
|
||||||
audioManager.play(key, false);
|
audioManager.play(key, false);
|
||||||
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
|
} else if (msg.type === MESSAGETYPESV2.HalfRest) {
|
||||||
|
|||||||
Reference in New Issue
Block a user