Constructor

GameManagerState

new GameManagerState(applicationName, maxPlayers, lobbyState, gameplayState, gameData, gameStatusText, players)

Immutable class to represent a snapshot of the game manager state.

Parameter

applicationName

string

maxPlayers

number

lobbyState

chrome.cast.games.LobbyState

gameplayState

chrome.cast.games.GameplayState

gameData

Object

gameStatusText

string

players

Array of non-null chrome.cast.games.PlayerInfo

Value must not be null.

Methods

equals

equals(otherState) returns boolean

Returns true if this object and the provided {chrome.cast.games.GameManagerState} are equivalent.

Parameter

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

getApplicationName

getApplicationName() returns string

Returns the name of the running application.

Returns

string 

getConnectedControllablePlayers

getConnectedControllablePlayers() returns Array of non-null chrome.cast.games.PlayerInfo

Returns the list of players in a connected state that are also managed by this sender device. A player is considered to be in a connected state if the associated chrome.cast.games.PlayerInfo#playerState is one of chrome.cast.games.PlayerState.IDLE, chrome.cast.games.PlayerState.AVAILABLE, chrome.cast.games.PlayerState.PLAYING or chrome.cast.games.PlayerState.READY.

Returns

non-null Array of non-null chrome.cast.games.PlayerInfo 

See also
chrome.cast.games.PlayerInfo#isConnected
chrome.cast.games.PlayerInfo#isControllable

getConnectedPlayers

getConnectedPlayers() returns Array of non-null chrome.cast.games.PlayerInfo

Returns the list of players in a connected state. A player is considered to be in a connected state if the associated chrome.cast.games.PlayerInfo#playerState is one of chrome.cast.games.PlayerState.IDLE, chrome.cast.games.PlayerState.AVAILABLE, chrome.cast.games.PlayerState.PLAYING or chrome.cast.games.PlayerState.READY.

Returns

non-null Array of non-null chrome.cast.games.PlayerInfo 

See also
chrome.cast.games.PlayerInfo#isConnected

getControllablePlayers

getControllablePlayers() returns Array of non-null chrome.cast.games.PlayerInfo

Returns the list of player information for players created and managed by this sender device.

Returns

non-null Array of non-null chrome.cast.games.PlayerInfo 

See also
chrome.cast.games.PlayerInfo#isControllable

getGameData

getGameData() returns Object

Returns the game data.

Returns

Object 

getGameplayState

getGameplayState() returns chrome.cast.games.GameplayState

Returns the gameplay state.

Returns

chrome.cast.games.GameplayState 

getGameStatusText

getGameStatusText() returns string

Returns the game status text.

Returns

string 

getListOfChangedPlayers

getListOfChangedPlayers(otherState) returns Array of string

Returns a list of player id that are different between this object and the provided chrome.cast.games.GameManagerState. This includes players that were added, removed, or have changed in any way.

Parameter

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

non-null Array of string 

getLobbyState

getLobbyState() returns chrome.cast.games.LobbyState

Returns the lobby state.

Returns

chrome.cast.games.LobbyState 

getMaxPlayers

getMaxPlayers() returns number

Returns the maximum number of players supported by the running application.

Returns

number 

getPlayer

getPlayer(playerId) returns chrome.cast.games.PlayerInfo

Returns the player with the provided id, or null if that player does not exist.

Parameter

playerId

string

The playerId of the desired player.

Returns

chrome.cast.games.PlayerInfo 

getPlayers

getPlayers() returns Array of non-null chrome.cast.games.PlayerInfo

Returns the list of players.

Returns

non-null Array of non-null chrome.cast.games.PlayerInfo 

getPlayersInState

getPlayersInState(playerState) returns Array of non-null chrome.cast.games.PlayerInfo

Returns a list of players that are in the specified player state.

Parameter

playerState

chrome.cast.games.PlayerState

Returns

non-null Array of non-null chrome.cast.games.PlayerInfo 

hasGameDataChanged

hasGameDataChanged(otherState) returns boolean

Returns whether the game data is different between this object and the provided chrome.cast.games.GameManagerState.

Parameter

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

hasGameplayStateChanged

hasGameplayStateChanged(otherState) returns boolean

Returns whether the gameplay state is different between this object and the provided chrome.cast.games.GameManagerState.

Parameter

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

hasGameStatusTextChanged

hasGameStatusTextChanged(otherState) returns boolean

Returns whether the game data is different between this object and the provided chrome.cast.games.GameManagerState.

Parameter

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

hasLobbyStateChanged

hasLobbyStateChanged(otherState) returns boolean

Returns whether the lobby state is different between this object and the provided chrome.cast.games.GameManagerState.

Parameter

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

hasPlayerChanged

hasPlayerChanged(playerId, otherState) returns boolean

Returns whether the player with the provided player id has changed between this object and the provided chrome.cast.games.GameManagerState.

Parameter

playerId

string

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

hasPlayerDataChanged

hasPlayerDataChanged(playerId, otherState) returns boolean

Returns whether the player data of the player with the specified player id has changed between this object and the provided chrome.cast.games.GameManagerState.

Parameter

playerId

string

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean 

hasPlayerStateChanged

hasPlayerStateChanged(playerId, otherState) returns boolean

Returns whether the player state of the player with the specified player id has changed between this object and the provided chrome.cast.games.GameManagerState.

Parameter

playerId

string

otherState

chrome.cast.games.GameManagerState

Value must not be null.

Returns

boolean