This commit is contained in:
2026-10-04 13:32:22 +07:00
parent c04e60ffb8
commit 839d83433e
2 changed files with 68 additions and 4 deletions
+4 -4
View File
@@ -5,10 +5,10 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Вечерний детектив</title>
<script type="module" crossorigin src="/assets/index-Cvq506nd.js"></script>
<link rel="modulepreload" crossorigin href="/assets/client-DXlIdAPE.js">
<link rel="modulepreload" crossorigin href="/assets/light-BIsOPw8z.js">
<link rel="modulepreload" crossorigin href="/assets/light-DaDb1s6-.js">
<script type="module" crossorigin src="/assets/index-VgViCwpY.js"></script>
<link rel="modulepreload" crossorigin href="/assets/client-Dr2LhGo3.js">
<link rel="modulepreload" crossorigin href="/assets/light-DXa4IKh6.js">
<link rel="modulepreload" crossorigin href="/assets/light-4JJV7N1X.js">
<link rel="stylesheet" crossorigin href="/assets/index-CF62QB4P.css">
</head>
<body>
+64
View File
@@ -215,6 +215,7 @@ getGameScreens()
async function getScreenPlan() {
if (screenPlanDirty.value) return
const res = await client.GetScreenPlan({ gameID: Number(gameId) })
if (screenPlanDirty.value) return
screenPlan.value = res.plan
screenPlanDraft.value = res.plan?.steps?.map((step) => ({ ...step })) || []
}
@@ -283,6 +284,26 @@ async function setScreenPlanStep(index: number) {
}
}
async function sendScreenPlanCommand(mode: ScreenMode | undefined, command: ScreenCommand) {
if (
screenPlanDirty.value ||
(mode !== 'SCREEN_MODE_TIMER' && mode !== 'SCREEN_MODE_INTRO' && mode !== 'SCREEN_MODE_CONCLUSION')
) {
return
}
try {
await client.SendScreenCommand({
gameID: Number(gameId),
command,
positionMs: Math.max(0, Math.round(screenPosition.value * 1000)),
volume: Math.max(0, Math.min(100, Math.round(screenVolume.value))),
})
await getGameScreens()
} catch (err) {
message.error(err instanceof Error ? err.message : 'Не удалось управлять экраном')
}
}
function stopScreenScanner() {
cancelAnimationFrame(screenScannerFrame)
screenScannerStream?.getTracks().forEach((track) => track.stop())
@@ -952,6 +973,7 @@ useSimplePolling(() => {
</n-button>
</n-flex>
</div>
<template v-if="!screenPlan && !screenPlanDirty">
<n-space class="screen-mode-controls">
<n-button
size="small"
@@ -1040,6 +1062,7 @@ useSimplePolling(() => {
>Перемотать</n-button
>
</n-space>
</template>
<div class="screen-plan">
<n-flex align="center" justify="space-between">
<p class="screens-title">План экранов</p>
@@ -1111,6 +1134,47 @@ useSimplePolling(() => {
>
Показать
</n-button>
<template v-if="screenPlan?.currentStep === index && !screenPlanDirty">
<template v-if="step.mode === 'SCREEN_MODE_TIMER'">
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_START')">
Старт
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_PAUSE')">
Пауза
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_RESUME')">
Продолжить
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_TIMER_RESET')">
Сбросить
</n-button>
</template>
<template v-else-if="step.mode === 'SCREEN_MODE_INTRO' || step.mode === 'SCREEN_MODE_CONCLUSION'">
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_PLAY')">
Запуск
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_PAUSE')">
Пауза
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_RESUME')">
Продолжить
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_STOP')">
Стоп
</n-button>
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_REPLAY')">
Повтор
</n-button>
<n-input-number v-model:value="screenVolume" :min="0" :max="100" :step="5" size="small" />
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_VOLUME')">
Громкость
</n-button>
<n-input-number v-model:value="screenPosition" :min="0" :step="5" size="small" />
<n-button size="small" @click="sendScreenPlanCommand(step.mode, 'SCREEN_COMMAND_SEEK')">
Перемотать
</n-button>
</template>
</template>
</n-space>
<n-space>
<n-button size="small" @click="addScreenPlanStep">Добавить шаг</n-button>