diff --git a/src/App.vue b/src/App.vue index 78d51b6..eee005c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,6 +43,8 @@ const showIntro = ref(false) const introWatched = ref(false) const introVideoRef = ref(null) const menuVideoRef = ref(null) +const showTopBar = ref(true) +let hideTopBarTimer: ReturnType | null = null const { loadGame, start, resumeAutoSave, makeChoice, clickHotspot, startChapter, skipScene, setSpeed, getSpeed, isSceneWatched, @@ -113,6 +115,15 @@ watch([() => store.qteTimeRelax, () => store.qteSingleKey], () => { applyQteParams() }) +watch( + () => [ + showPauseMenu.value, showMenu.value, showChapterSelect.value, + showAchievements.value, showEndingGallery.value, recapChapterId.value, + paused.value, store.showSettings, + ], + () => { resetTopBarTimer() }, +) + function onVideoReady(elA: HTMLVideoElement, elB: HTMLVideoElement) { videoElA.value = elA videoElB.value = elB @@ -243,6 +254,21 @@ function onQuitToMenu() { function onGlobalMouseMove() { store.setInputMode('mouse') + resetTopBarTimer() +} + +function anyOverlayOpen(): boolean { + return showPauseMenu.value || showMenu.value || showChapterSelect.value + || showAchievements.value || showEndingGallery.value || !!recapChapterId.value + || paused.value || store.showSettings +} + +function resetTopBarTimer() { + showTopBar.value = true + if (hideTopBarTimer) clearTimeout(hideTopBarTimer) + if (!anyOverlayOpen()) { + hideTopBarTimer = setTimeout(() => { showTopBar.value = false }, 3000) + } } onMounted(() => { @@ -253,6 +279,7 @@ onMounted(() => { onUnmounted(() => { document.removeEventListener('keydown', onGlobalKeydown) document.removeEventListener('mousemove', onGlobalMouseMove) + if (hideTopBarTimer) clearTimeout(hideTopBarTimer) }) init() @@ -271,7 +298,7 @@ init() -
+
{{ promptToast }}
-
+