Overview

Server functions

essential.addPlayer
essential.createPlayerInfo
essential.disconnectedPlayer
essential.getGameStateData
essential.getScore
essential.handlePacket
essential.handleState
essential.playerAddedToIdleGame
essential.reconnectedPlayer
essential.removePlayer
essential.setupGameRoom
essential.storeHighScore
essential.winnerResult

helper.bootPlayer
helper.calcScoreFromTime
helper.getAllPlayerInfos
helper.getAllPlayerNames
helper.getCurrentTime
helper.getPlayerInfo
helper.getPlayerPosition
helper.getSpecialStat
helper.getSquizQuestion
helper.getStat
helper.numberOfPlayersInGame
helper.postNewState
helper.postPacketToAll
helper.postPacketToPlayer
helper.postPacketToRest
helper.removeCheater
helper.setLobbyStatus
helper.setPlayerInfo
helper.storeStat
helper.trace

Client methods

chat.addText
chat.connectToLobby
chat.connectToPlayerComponent

lobby.addEventListener
lobby.exitToLobby
lobby.getInviteAddress
lobby.getSettings
lobby.sendPacket
lobby.setGameName
lobby.setLocal
lobby.updateSettings

player.clearPlayerInfo
player.updatePlayerInfo

essential.winnerResult

Prototype

function winnerResult(nameScores)

Input parameters

nameScores - array of names and scores with the results of the game

Return value

null

Description

Called at the end of a game. The nameScores object contains an array of all the players in the game, sorted by score. This is normally the place to send a data packet to all the players in the game with the results.

Example code

function winnerResult(nameScores)
{
    trace("Winner result");
    for (var i=0;i< nameScores.length;i++)
    {
        trace(nameScores[i].player+" got "+nameScores[i].score);
    }
}