фиксики1

This commit is contained in:
2026-04-24 19:56:24 +03:00
parent c9c6761303
commit 2c21bce9ed
5 changed files with 81 additions and 65 deletions

View File

@@ -29,8 +29,8 @@ refereeEditorState.pool = refereeEditorState.pool.map(normalizeReferee);
const REFEREE_ROLE_OPTIONS = [
"Главный судья",
"Ассистент 1",
"Ассистент 2",
"Ассистент судьи №1",
"Ассистент судьи №2",
"Резервный судья",
"VAR",
"AVAR",
@@ -2285,9 +2285,57 @@ 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";
// 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 x = convertPitchXToPan(player.x).toFixed(3);
// const y = convertPitchYToPan(player.y).toFixed(3);
// commands.push(
// vmixCmd(`Function=SetLayer${layer}PanX&Input=${encodeURIComponent(inputName)}&Value=${x}`)
// );
// commands.push(
// vmixCmd(`Function=SetLayer${layer}PanX&Input=${encodeURIComponent(inputName)}&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}`)
// );
// });
// commands.push(
// vmixCmd(`Function=PreviewInput&Input=${encodeURIComponent(inputName)}`)
// );
// return commands;
// }
function buildVmixCommandsFromFormation(side) {
const players = Array.isArray(formationState[side]) ? formationState[side] : [];
const inputName = getFormationVmixInputName(side);
const commands = [];
const playerPrefix = side === "home" ? "HOME" : "AWAY";
@@ -2295,40 +2343,26 @@ function buildVmixCommandsFromFormation(side) {
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);
commands.push(
vmixCmd(`Function=SetLayer${layer}PanX&Input=${encodeURIComponent(inputName)}&Value=${x}`)
vmixCmd(`Function=SetPanX&Input=${encodeURIComponent(playerInputName)}&Value=${x}`)
);
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;
}
async function sendFormationToVmix(side) {
syncFormationCaptainsInState(side);
@@ -3406,6 +3440,10 @@ async function loadSquadEditorData() {
window.MATCH_DATA.homeCoachPool = Array.isArray(data.home_coach_pool) ? data.home_coach_pool : [];
window.MATCH_DATA.awayCoachPool = Array.isArray(data.away_coach_pool) ? data.away_coach_pool : [];
if (typeof renderLiveCoachBlocks === "function") {
renderLiveCoachBlocks();
}
return true;
} catch (e) {
console.warn("Ошибка загрузки squad editor data", e);