({
runtimeScene,
positionInLobby,
}: {
runtimeScene: gdjs.RuntimeScene;
positionInLobby: number;
})
| 828 | }; |
| 829 | |
| 830 | const handleLobbyUpdatedEvent = function ({ |
| 831 | runtimeScene, |
| 832 | positionInLobby, |
| 833 | }: { |
| 834 | runtimeScene: gdjs.RuntimeScene; |
| 835 | positionInLobby: number; |
| 836 | }) { |
| 837 | // This is mainly useful when joining a lobby, or when the lobby is updated before the game starts. |
| 838 | // The position in lobby should never change after the game has started (the WS is closed anyway). |
| 839 | playerNumber = positionInLobby; |
| 840 | |
| 841 | // If the player is in the lobby, tell the lobbies window that the lobby has been updated, |
| 842 | // as well as the player position. |
| 843 | const lobbiesIframe = |
| 844 | gdjs.multiplayerComponents.getLobbiesIframe(runtimeScene); |
| 845 | |
| 846 | if (!lobbiesIframe || !lobbiesIframe.contentWindow) { |
| 847 | return; |
| 848 | } |
| 849 | |
| 850 | lobbiesIframe.contentWindow.postMessage( |
| 851 | { |
| 852 | id: 'lobbyUpdated', |
| 853 | positionInLobby, |
| 854 | }, |
| 855 | '*' // We could restrict to GDevelop games platform but it's not necessary as the message is not sensitive, and it allows easy debugging. |
| 856 | ); |
| 857 | }; |
| 858 | |
| 859 | const handleGameCountdownStartedEvent = function ({ |
| 860 | runtimeScene, |
no outgoing calls
no test coverage detected