MCPcopy Index your code
hub / github.com/4ian/GDevelop / handleLobbyUpdatedEvent

Function handleLobbyUpdatedEvent

Extensions/Multiplayer/multiplayertools.ts:830–857  ·  view source on GitHub ↗
({
      runtimeScene,
      positionInLobby,
    }: {
      runtimeScene: gdjs.RuntimeScene;
      positionInLobby: number;
    })

Source from the content-addressed store, hash-verified

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,

Callers 1

handleJoinLobbyEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected