diff --git a/static/script.js b/static/script.js index 263c3e5..802925f 100644 --- a/static/script.js +++ b/static/script.js @@ -2285,52 +2285,48 @@ function convertPitchYToPan(y) { } + // function buildVmixCommandsFromFormation(side) { // const players = Array.isArray(formationState[side]) ? formationState[side] : []; -// const inputName = getFormationVmixInputName(side); // const commands = []; // const playerPrefix = side === "home" ? "HOME" : "AWAY"; +// const inputName = side === "home" ? "РАССТАНОВКА - ХОЗЯЕВА" : "РАССТАНОВКА - ГОСТИ"; + // if (players.length < 2) { // return []; // } -// // Сбрасываем только свою сторону -// for (let i = 1; i <= 10; i++) { -// commands.push( -// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(`${playerPrefix} - Игрок${i}`)}`) -// ); -// } - -// commands.push( -// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(inputName)}`) -// ); - // // Вратарь players[0], полевые players[1..10] // players.slice(1, 11).forEach((player, index) => { -// const layer = index + 1; +// const playerNumber = index + 1; +// const playerInputName = `${playerPrefix} - Игрок${playerNumber}`; + // const x = convertPitchXToPan(player.x).toFixed(3); // const y = convertPitchYToPan(player.y).toFixed(3); + +// for (let i = 1; i <= 10; i++) { // commands.push( -// vmixCmd(`Function=SetLayer${layer}PanX&Input=${encodeURIComponent(inputName)}&Value=${x}`) +// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(`${playerPrefix} - Игрок${i}`)}`) // ); +// }; + // commands.push( -// vmixCmd(`Function=SetLayer${layer}PanX&Input=${encodeURIComponent(inputName)}&Value=${x}`) +// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(inputName)}`) +// ); + + + +// commands.push( +// vmixCmd(`Function=SetPanX&Input=${encodeURIComponent(playerInputName)}&Value=${x}`) // ); // commands.push( -// vmixCmd(`Function=SetLayer${layer}PanY&Input=${encodeURIComponent(inputName)}&Value=${y}`) -// ); -// commands.push( -// vmixCmd(`Function=SetLayer${layer}PanY&Input=${encodeURIComponent(inputName)}&Value=${y}`) +// vmixCmd(`Function=SetPanY&Input=${encodeURIComponent(playerInputName)}&Value=${y}`) // ); // }); -// commands.push( -// vmixCmd(`Function=PreviewInput&Input=${encodeURIComponent(inputName)}`) -// ); - // return commands; // } @@ -2340,12 +2336,20 @@ function buildVmixCommandsFromFormation(side) { const playerPrefix = side === "home" ? "HOME" : "AWAY"; const inputName = side === "home" ? "РАССТАНОВКА - ХОЗЯЕВА" : "РАССТАНОВКА - ГОСТИ"; - if (players.length < 2) { return []; } - // Вратарь players[0], полевые players[1..10] + for (let i = 1; i <= 10; i++) { + commands.push( + vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(`${playerPrefix} - Игрок${i}`)}`) + ); + } + + commands.push( + vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(inputName)}`) + ); + players.slice(1, 11).forEach((player, index) => { const playerNumber = index + 1; const playerInputName = `${playerPrefix} - Игрок${playerNumber}`; @@ -2353,19 +2357,6 @@ function buildVmixCommandsFromFormation(side) { const x = convertPitchXToPan(player.x).toFixed(3); const y = convertPitchYToPan(player.y).toFixed(3); - - for (let i = 1; i <= 10; i++) { - commands.push( - vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(`${playerPrefix} - Игрок${i}`)}`) - ); - }; - - commands.push( - vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(inputName)}`) - ); - - - commands.push( vmixCmd(`Function=SetPanX&Input=${encodeURIComponent(playerInputName)}&Value=${x}`) );