Spaces:
Sleeping
Sleeping
Commit
·
b78e8db
1
Parent(s):
e367b4e
fix: properly apply board shape from server in gameReset event
Browse filesWhen server sends gameReset event with new boardShape, now correctly:
- Use initializeGame() to create new game with new shape
- Update viewport with setBoardShape()
- Update board shape dropdown to match
Co-Authored-By: Claude <noreply@anthropic.com>
trigo-web/app/dist/assets/{index-Cs_21k17.js → index-LYvExrie.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
trigo-web/app/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>Trigo - 3D Go Game</title>
|
| 8 |
-
<script type="module" crossorigin src="/assets/index-
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-Siwlapuk.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
|
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>Trigo - 3D Go Game</title>
|
| 8 |
+
<script type="module" crossorigin src="/assets/index-LYvExrie.js"></script>
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-Siwlapuk.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
trigo-web/app/src/views/TrigoView.vue
CHANGED
|
@@ -1502,15 +1502,29 @@
|
|
| 1502 |
// Listen for game reset
|
| 1503 |
socketApi.onGameReset((data) => {
|
| 1504 |
console.log("[TrigoView] Game reset:", data);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1505 |
// Reload game state
|
| 1506 |
if (data.tgn) {
|
| 1507 |
gameStore.loadFromTGN(data.tgn);
|
| 1508 |
} else {
|
| 1509 |
-
|
|
|
|
|
|
|
| 1510 |
}
|
|
|
|
|
|
|
| 1511 |
if (viewport) {
|
|
|
|
| 1512 |
viewport.clearBoard();
|
|
|
|
| 1513 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1514 |
// Update player colors if changed
|
| 1515 |
if (data.players && socketApi.socket.id) {
|
| 1516 |
const myPlayer = data.players[socketApi.socket.id];
|
|
|
|
| 1502 |
// Listen for game reset
|
| 1503 |
socketApi.onGameReset((data) => {
|
| 1504 |
console.log("[TrigoView] Game reset:", data);
|
| 1505 |
+
|
| 1506 |
+
// Get the new board shape from server, or use current
|
| 1507 |
+
const newBoardShape = data.boardShape || boardShape.value;
|
| 1508 |
+
|
| 1509 |
// Reload game state
|
| 1510 |
if (data.tgn) {
|
| 1511 |
gameStore.loadFromTGN(data.tgn);
|
| 1512 |
} else {
|
| 1513 |
+
// Use initializeGame to apply new board shape
|
| 1514 |
+
gameStore.initializeGame(newBoardShape);
|
| 1515 |
+
gameStore.startGame();
|
| 1516 |
}
|
| 1517 |
+
|
| 1518 |
+
// Update viewport with new board shape and clear
|
| 1519 |
if (viewport) {
|
| 1520 |
+
viewport.setBoardShape(newBoardShape);
|
| 1521 |
viewport.clearBoard();
|
| 1522 |
+
viewport.setGameActive(true);
|
| 1523 |
}
|
| 1524 |
+
|
| 1525 |
+
// Update the board shape dropdown to match
|
| 1526 |
+
selectedBoardShape.value = printBoardShape(newBoardShape);
|
| 1527 |
+
|
| 1528 |
// Update player colors if changed
|
| 1529 |
if (data.players && socketApi.socket.id) {
|
| 1530 |
const myPlayer = data.players[socketApi.socket.id];
|