update:语音加载优化,修复大乱斗未重连比赛服问题
This commit is contained in:
@@ -106,6 +106,7 @@ let pendingRoundAudio = false;
|
||||
// 一旦收到 BattleEnd,后续普通消息就不再进入队列。
|
||||
let battleEnded = false;
|
||||
let skipNextRestoreOnShow = false;
|
||||
let pendingReturnSnapshot = null;
|
||||
const handledMessageKeys = new Set();
|
||||
const handledMessageKeyOrder = [];
|
||||
const queuedMessageKeys = new Set();
|
||||
@@ -978,9 +979,9 @@ async function runToSomeoneShootTask(task, runId) {
|
||||
notifyMatchAudioAck(task);
|
||||
if (!isQueueAlive(runId)) return;
|
||||
|
||||
const remainingSeconds = getRemainingSeconds(battleInfo, task, {
|
||||
fullDurationIfNoBackendRemain: isRoundFirstShoot,
|
||||
});
|
||||
// 实时换人消息的倒计时由本条语音 ACK 驱动:后端收到 ACK 后才开始计时,
|
||||
// 因此前端也应从完整 shootTime 启动,不能扣除消息排队及 tententen/提示语音耗时。
|
||||
const remainingSeconds = getShootTimeSeconds(battleInfo);
|
||||
const countdown = getCountdownPayload(remainingSeconds, shootTimeTotal.value);
|
||||
markProgressDeadline(countdown);
|
||||
uni.$emit("update-remain", {
|
||||
@@ -1249,6 +1250,7 @@ function onReceiveMessage(message) {
|
||||
onLoad((options) => {
|
||||
console.log('重新进入了')
|
||||
const returnSnapshot = options.fromReturn ? takeMatchReturnSnapshot() : null;
|
||||
pendingReturnSnapshot = returnSnapshot;
|
||||
skipNextRestoreOnShow = false;
|
||||
// 新对局入口:把所有会串场的状态、队列、时间戳和缓存一次性清空。
|
||||
start.value = null;
|
||||
@@ -1293,8 +1295,7 @@ onLoad((options) => {
|
||||
latestShotFlash.value = null;
|
||||
if (returnSnapshot) {
|
||||
skipNextRestoreOnShow = true;
|
||||
applyBattleSnapshot(returnSnapshot, { restore: true });
|
||||
reconnectMatchServer(returnSnapshot);
|
||||
showRestoreLoading();
|
||||
return;
|
||||
}
|
||||
const readySnapshot = takeReadySnapshot(battleId.value);
|
||||
@@ -1316,6 +1317,12 @@ onMounted(async () => {
|
||||
uni.$on(PROGRESS_ZERO_EVENT, onProgressZero);
|
||||
uni.$on(COUNTDOWN_READY_EVENT, hideRestoreLoading);
|
||||
uni.$on(MATCH_WS_STATE_EVENT, onMatchSocketState);
|
||||
if (pendingReturnSnapshot) {
|
||||
const returnSnapshot = pendingReturnSnapshot;
|
||||
pendingReturnSnapshot = null;
|
||||
reconnectMatchServer(returnSnapshot);
|
||||
scheduleRestoreLatestBattle();
|
||||
}
|
||||
await laserCloseAPI();
|
||||
});
|
||||
|
||||
@@ -1333,6 +1340,7 @@ onBeforeUnmount(() => {
|
||||
clearTimeout(pendingRestoreTimer);
|
||||
pendingRestoreTimer = null;
|
||||
}
|
||||
pendingReturnSnapshot = null;
|
||||
hideRestoreLoading();
|
||||
invalidateBattleQueue({ stopAudio: true, stopProgress: true });
|
||||
closeBattleServer("team-battle-unmount");
|
||||
|
||||
Reference in New Issue
Block a user