From 4916b0d68f657eb2c897fe85022b55636f22c595 Mon Sep 17 00:00:00 2001 From: momintlh <77355191+momintlh@users.noreply.github.com> Date: Sat, 4 Jan 2025 10:41:22 +0500 Subject: [PATCH] fix: updated to ._multiplayer.getPlayers() and Playroom.Multiplayer().getPlayers() --- Assets/PlayroomKit/src/index.js | 22 +++++++++++----------- ProjectSettings/EditorBuildSettings.asset | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Assets/PlayroomKit/src/index.js b/Assets/PlayroomKit/src/index.js index 069b7d9..f45cf8d 100644 --- a/Assets/PlayroomKit/src/index.js +++ b/Assets/PlayroomKit/src/index.js @@ -381,7 +381,7 @@ mergeInto(LibraryManager.library, { * @returns {string | null} return the hexColor for the player's profile color, or null if the player is not found. */ GetProfileByPlayerId: function (playerId) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); @@ -419,7 +419,7 @@ mergeInto(LibraryManager.library, { * @param {number | boolean} value - The value to associate with the key in the player's state. */ SetPlayerStateByPlayerId: function (playerId, key, value, reliable) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() reliable = !!reliable; @@ -445,7 +445,7 @@ mergeInto(LibraryManager.library, { }, SetPlayerStateFloatByPlayerId: function (playerId, key, value, reliable) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() reliable = !!reliable; @@ -481,7 +481,7 @@ mergeInto(LibraryManager.library, { * @param {string} value - The string value to associate with the key in the player's state. */ SetPlayerStateStringById: function (playerId, key, value, reliable) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() reliable = !!reliable; @@ -513,7 +513,7 @@ mergeInto(LibraryManager.library, { * @param {string} jsonValues - The JSON representation of the dictionary value to associate with the key in the player's state. */ SetPlayerStateDictionary: function (playerId, key, jsonValues, reliable) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() reliable = !!reliable; if (typeof players !== "object" || players === null) { @@ -549,7 +549,7 @@ mergeInto(LibraryManager.library, { * @returns {number | null} The integer value associated with the key in the player's state, or null if the player is not found or the key is not found in the player's state. */ GetPlayerStateIntById: function (playerId, key) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); @@ -581,7 +581,7 @@ mergeInto(LibraryManager.library, { * @returns {number | null} The floating-point value associated with the key in the player's state, or null if the player is not found or the key is not found in the player's state. */ GetPlayerStateFloatById: function (playerId, key) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); @@ -613,7 +613,7 @@ mergeInto(LibraryManager.library, { * @returns {string | null} The string value associated with the key in the player's state, or null if the player is not found or the key is not found in the player's state. */ GetPlayerStateStringById: function (playerId, key) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); @@ -657,7 +657,7 @@ mergeInto(LibraryManager.library, { * @returns {string | null} The JSON representation of the dictionary value associated with the key in the player's state, or null if the player is not found or the key is not found in the player's state. */ GetPlayerStateDictionary: function (playerId, key) { - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); @@ -766,7 +766,7 @@ mergeInto(LibraryManager.library, { return; } - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); @@ -798,7 +798,7 @@ mergeInto(LibraryManager.library, { return; } - const players = window._multiplayer.getPlayers(); + const players = Playroom.Multiplayer().getPlayers() if (typeof players !== "object" || players === null) { console.error('The "players" variable is not an object:', players); diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 323419e..9647369 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -8,13 +8,13 @@ EditorBuildSettings: - enabled: 0 path: Assets/PlayroomKit/Examples/2d-platformer/2d-platformer.unity guid: cf82eec4c654cf44b89cec2a91afebd5 - - enabled: 0 + - enabled: 1 path: Assets/PlayroomKit/Examples/discord-activity/discord-activity.unity guid: bb7ef8e4a67f3fb46b78e5d95a6858a7 - enabled: 0 path: Assets/PlayroomKit/Examples/package-showcase/showcase.unity guid: 85c9af77ae006408ab24500b953a9035 - - enabled: 1 + - enabled: 0 path: Assets/Scenes/TestScene.unity guid: 490247da3cf48784ab657a183ba059d1 m_configObjects: {}