Server-Side / GameRoom / Events

onGameStart

onGameEnd

onPreGameStart

onGameAction

onGameData

onEnoughPlayers

onNewPlayer

onPlayerRejoin

dataOnGameJoin

onPlayerDisconnect

onPlayerDrop

dataOnRejoin

onEmptyRoom

dataOnLateGameJoin

dataOnGameStart

dataOnGameEnd

Server-Side / GameRoom / Properties

isGameStarted

isGameEnded

players

Server-Side / GameRoom / Methods

upTime()

numberOfPlayers()

numberOfConnectedPlayers()

numberOfSavedSeats()

publishMessage()

publishGameAction()

startGame([ dataOnGameStart ])

endGame([ dataOnGameEnd ])

isPaused(player)

pausePlayer(player)

resumePlayer(player)

pauseGame()

resumeGame()

getPLayerInfo(player)

Server-Side / Player / Properties

uid

connected

true if player is connect to server and false otherwise.

Server-Side / Player / Methods

sendMessage(message)

sendGameAction(message)

kick()

getAllStats([isGlobal : false])

getStats(fieldName, [isGlobal : false])

updateStats(fieldName, newValue, [isGlobal: false])

sendExternalMessage(message)

Server-Side / StickyText

StickyText is a telegram only class to edit Gates.

Gates are game links that players used to enter the game from Telegram conversations, By default Gates are filled with a short description about the game however it can be edited dynamically by this class.

To do this, First we need to access the Lobby object which exists in both Player.lobby and GameRoom.lobby then we can use it to post updates about in-game events.

GameRoom.prototype.onGameStart = function () {
const template = 'Online players in Lobby # ${ lobbyId }: ${ count }';
// Note: Zero index means that this text will be at top of any other sticky text.
const index = 0;
const lobby = this.lobby;
this.onlinePlayersSticky = lobby.createStickyText(template, index);
};

After creation, It can be easily updated.

GameRoom.prototype.onNewPlayer = function () {
this.onlinePlayersSticky.update({
lobbyId: this.lobby.uid,
count: this.numberOfPlayers()
});
};

Client-Side / GameMatris / Events

onConnect

onConnectTimeout

onDisconnect

onReconnect

onReconnectAttempt

onReconnectScheduled

onReconnectFailed

onReconnectTimeout

onRegister

onRegisterFailed

onPasswordRequired

onPasswordIncorrect

onFatalError

onPause

onResume

onGamePause

onGameJoin

onGameRejoin

onGameRejoinFailed

onGameLateJoin

onGameStart

onGameEnd

onGameAction

onGameData

onPlayerJoin

onPlayerLeft

onPlayerDisconnect

onPlayerRejoin

onAnotherGameExists

onKicked

onOffline

onOnline

onClose

Client-Side / GameMatris / Properties

playersList

myId

lobbyId

isGameStarted

isGameEnded

Client-Side / GameMatris / Methods

connect()

register()

getPlayer(playerId)

addPlayerProperty(key, [defaultValue])

playerExists(playerId)

ignoreAnotherGame()

joinAnotherGame()

sendMessage(message)

sendGameAction(action)

isGameActionAllowed()

Client-Side / Player / Properties

name

username

uid

connected

true if player is connect to server and false otherwise.

Client-Side / Player / Methods

isConnected()