添加全局返回游戏

This commit is contained in:
kron
2025-07-13 14:57:16 +08:00
parent b6d78d6070
commit fa959c73aa
10 changed files with 109 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ const isFinalShoot = ref(false);
onLoad(async (options) => {
if (options.battleId) {
const battleInfo = uni.getStorageSync(`battle-${options.battleId}`);
// console.log("----battleInfo", battleInfo);
console.log("----battleInfo", battleInfo);
if (battleInfo) {
battleId.value = battleInfo.id;
start.value = true;
@@ -83,7 +83,7 @@ onLoad(async (options) => {
}
});
async function stopMatch() {
uni.navigateBack();
uni.$showHint(3);
}
async function readyToGo() {
if (battleId.value) {
@@ -153,6 +153,11 @@ async function onReceiveMessage(messages = []) {
msg.target
);
}
} else {
roundResults.value.push({
redArrows: [],
blueArrows: [],
});
}
}
if (msg.constructor === MESSAGETYPES.CurrentRoundEnded) {
@@ -217,6 +222,7 @@ onUnmounted(() => {
:title="battleId ? '1V1排位赛' : '搜索对手...'"
:bgType="1"
:onBack="onBack"
:showBackToGame="false"
>
<view class="container">
<block v-if="battleId">
@@ -260,7 +266,11 @@ onUnmounted(() => {
:round="currentRound - 1"
:bluePoint="currentBluePoint"
:redPoint="currentRedPoint"
:roundData="roundResults[roundResults.length - 1]"
:roundData="
roundResults[roundResults.length - 2]
? roundResults[roundResults.length - 2]
: []
"
:onAutoClose="() => (showRoundTip = false)"
/>
</ScreenHint>