Spaces:
Sleeping
Sleeping
Add missing player count
Browse files- src/components/Game.tsx +5 -4
src/components/Game.tsx
CHANGED
|
@@ -19,11 +19,14 @@ import VotingPopover from './LLMVote.tsx';
|
|
| 19 |
import { createPortal } from 'react-dom';
|
| 20 |
import GameVote from './GameVote.tsx';
|
| 21 |
import { EndGame } from './EndGame.tsx';
|
|
|
|
| 22 |
|
| 23 |
export const SHOW_DEBUG_UI = !!import.meta.env.VITE_SHOW_DEBUG_UI;
|
| 24 |
const oauth = JSON.parse(localStorage.getItem('oauth'));
|
| 25 |
const oauthToken = oauth ? oauth.userInfo.fullname : undefined;
|
| 26 |
export function GameStateLabel(game: GameObj, me: PlayerDescription | undefined) {
|
|
|
|
|
|
|
| 27 |
switch (game.world.gameCycle.cycleState) {
|
| 28 |
case 'Day':
|
| 29 |
return {
|
|
@@ -43,7 +46,7 @@ export function GameStateLabel(game: GameObj, me: PlayerDescription | undefined)
|
|
| 43 |
case 'LobbyState':
|
| 44 |
return {
|
| 45 |
label: 'Lobby (waiting for start)',
|
| 46 |
-
desc:
|
| 47 |
};
|
| 48 |
case 'Night':
|
| 49 |
return {
|
|
@@ -96,9 +99,7 @@ export default function Game() {
|
|
| 96 |
if (!worldId || !engineId || !game ) {
|
| 97 |
return null;
|
| 98 |
}
|
| 99 |
-
|
| 100 |
-
console.log("game.playerDescriptions",game.playerDescriptions)
|
| 101 |
-
console.log("game.world.players",game.world.players)
|
| 102 |
const playerId = [...game.world.players.values()].find(
|
| 103 |
(p) => !!p && p.human === humanTokenIdentifier,
|
| 104 |
)?.id;
|
|
|
|
| 19 |
import { createPortal } from 'react-dom';
|
| 20 |
import GameVote from './GameVote.tsx';
|
| 21 |
import { EndGame } from './EndGame.tsx';
|
| 22 |
+
import { LOBBY_SIZE } from '../constants';
|
| 23 |
|
| 24 |
export const SHOW_DEBUG_UI = !!import.meta.env.VITE_SHOW_DEBUG_UI;
|
| 25 |
const oauth = JSON.parse(localStorage.getItem('oauth'));
|
| 26 |
const oauthToken = oauth ? oauth.userInfo.fullname : undefined;
|
| 27 |
export function GameStateLabel(game: GameObj, me: PlayerDescription | undefined) {
|
| 28 |
+
const humans = [...game.world.playersInit.values()].filter(player => player.human).length
|
| 29 |
+
|
| 30 |
switch (game.world.gameCycle.cycleState) {
|
| 31 |
case 'Day':
|
| 32 |
return {
|
|
|
|
| 46 |
case 'LobbyState':
|
| 47 |
return {
|
| 48 |
label: 'Lobby (waiting for start)',
|
| 49 |
+
desc: `Waiting the game to start. ${ humans } out of the ${ LOBBY_SIZE } requiered `,
|
| 50 |
};
|
| 51 |
case 'Night':
|
| 52 |
return {
|
|
|
|
| 99 |
if (!worldId || !engineId || !game ) {
|
| 100 |
return null;
|
| 101 |
}
|
| 102 |
+
|
|
|
|
|
|
|
| 103 |
const playerId = [...game.world.players.values()].find(
|
| 104 |
(p) => !!p && p.human === humanTokenIdentifier,
|
| 105 |
)?.id;
|