Class: PG

PG

Phune Gaming SDK

new PG()

Constructs a new instance of the Phune Gaming SDK.
Source:

Methods

<static> exitGameLobby()

Informs the server that the game configuration phase ended and the game can start.
Source:

<static> init(params)

Initialize the Phune Gaming SDK.
Parameters:
Name Type Description
params Object Object containing all the options to configure the SDK. This includes the mandatory callback functions: onMatchPrepare, onMatchStart, onMoveValid, onMoveInvalid, onMatchEnd, as well as the optional callback functions: onServerMessage, onPlayerMessage and onKeyPress.
Source:

<static> ready()

Informs the server that the client is ready to start the match.
Source:

<static> sendMessageToPlayer(messageDetails, sendTimeIntervalLimit)

Peer-to-peer message sent directly to another player.
Parameters:
Name Type Argument Description
messageDetails Object The content of the message to be sent.
sendTimeIntervalLimit number <optional>
Do not allow sending more than one message within the specified time in milliseconds. If this is called more than once during this interval only the last message will be sent.
Source:

<static> sendMessageToServer(messageDetails, isAnswerPublic, serializeRequest)

Send a message to the server-side rules. This message is specific to a game and will not be processed by the platform itself. The response from the server could either be sent to you only or to all players.
Parameters:
Name Type Argument Description
messageDetails Object The content of the message to be sent.
isAnswerPublic boolean Whether the reply from the server's rules should be sent to all players or not.
serializeRequest boolean <optional>
Whether the messages should be processed in order of arrival or can be executed in parallel.
Source:

<static> sendMove(moveDetails, validate) → {boolean}

Send a move to the platform server.
Parameters:
Name Type Argument Description
moveDetails Object The move details.
validate function <optional>
Optional function to validate the move before sending it to server.
Source:
Returns:
True when the move is valid or when no validation function was provided.
Type
boolean

<static> showMenu()

Asks the platform to show the game menu.
Source: