From ef75203db772a437ad9534a10d78a66a7030268d Mon Sep 17 00:00:00 2001 From: Tronax Date: Sun, 16 Aug 2026 13:35:46 +0200 Subject: [PATCH] feat(duel): allow swapping main view to opponent's board - Add a toggle on the picture-in-picture window to swap the big board with the mini view of the opponent's field - Color-coded frame and badge identify whose board is currently shown (blue = player 1, orange = player 2) - Block building and rushing while spectating the opponent's board; the PiP then shows your own field instead - Clarify duel-mode descriptions in lobby and start screen, add hints in the multiplayer bar - Replace previous announcement banners so only one shows at a time --- src/App.vue | 46 +++++++++++++++++++++++++++++++++- src/components/GameCanvas.vue | 2 ++ src/components/LobbyScreen.vue | 4 +-- src/components/MPBar.vue | 9 +++++-- src/components/PiPCanvas.vue | 22 +++++++++++++--- src/components/StartScreen.vue | 8 +++++- src/game/config.ts | 7 ++++++ src/game/engine.ts | 6 ++++- src/game/mpgame.ts | 26 ++++++++++++++++++- src/game/render.ts | 6 ++--- src/game/store.ts | 2 ++ src/main.ts | 7 ++++++ 12 files changed, 130 insertions(+), 15 deletions(-) diff --git a/src/App.vue b/src/App.vue index 17edb9a..290adbe 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,7 +10,28 @@ import PiPCanvas from '@/components/PiPCanvas.vue' import StartScreen from '@/components/StartScreen.vue' import TowerPanel from '@/components/TowerPanel.vue' import TowerShop from '@/components/TowerShop.vue' +import { playerColor } from '@/game/config' import { store } from '@/game/store' +import { computed } from 'vue' + +/** duel: colored frame + label around the main canvas showing whose board it is */ +const frameStyle = computed(() => { + if (!store.mp.active || store.mp.mode !== 'duel') return undefined + const viewedOwner = store.mp.viewOpponent ? 1 - store.mp.myId : store.mp.myId + return { boxShadow: `0 0 0 4px ${playerColor(viewedOwner)}` } +}) + +const badgeText = computed(() => { + if (!store.mp.active || store.mp.mode !== 'duel') return '' + return store.mp.viewOpponent + ? `👁 ${store.mp.peerName} – Ansicht (zum Bauen zurückwechseln)` + : '🛡 Deine Basis' +}) + +const badgeColor = computed(() => { + const viewedOwner = store.mp.viewOpponent ? 1 - store.mp.myId : store.mp.myId + return playerColor(viewedOwner) +})