Skip to content

Commit

Permalink
fix: updated to ._multiplayer.getPlayers() and Playroom.Multiplayer()…
Browse files Browse the repository at this point in the history
….getPlayers()
  • Loading branch information
momintlh committed Jan 4, 2025
1 parent 2a9d01b commit 4916b0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions Assets/PlayroomKit/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}

0 comments on commit 4916b0d

Please sign in to comment.