Room
| Kind of class: | class |
|---|---|
| Inherits from: | none |
| Version: | 3.0.0 |
| Author: | The gotoAndPlay() Team http://www.smartfoxserver.com http://www.gotoandplay.it |
| Classpath: | it.gotoandplay.smartfoxserver.Room |
| File last modified: | Monday, 10 December 2007, 08:54:19 |
The Room class stores the properties of each server room.
This class is used internally by the SmartFoxClient class; also, Room objects are returned by various methods and events of the SmartFoxServer API.
NOTE: in the provided examples,
This class is used internally by the SmartFoxClient class; also, Room objects are returned by various methods and events of the SmartFoxServer API.
NOTE: in the provided examples,
room always indicates a Room instance.Summary
Instance methods
- getUserList : Object
- Get the list of users currently inside the room.
- getUser (userId) : User
- Retrieve a user currently in the room.
- getVariable (varName:String)
- Retrieve a Room Variable.
- getVariables : Object
- Retrieve the list of all Room Variables.
- getName : String
- Get the name of the room.
- getId : Number
- Get the id of the room.
- isTemp : Boolean
- A boolean flag indicating if the room is dynamic/temporary.
- isGame : Boolean
- A boolean flag indicating if the room is a "game room".
- isPrivate : Boolean
- A boolean flag indicating if the room is private (password protected).
- getUserCount : Number
- Retrieve the number of users currently inside the room.
- getSpectatorCount : Number
- Retrieve the number of spectators currently inside the room.
- getMaxUsers : Number
- Retrieve the maximum number of users that can join the room.
- getMaxSpectators : Number
- Retrieve the maximum number of spectators that can join the room.
- getMyPlayerIndex : Number
- Retrieve the player id for the current user in the room.
- isLimbo : Boolean
- A boolean flag indicating if the room is in "limbo mode".
Instance methods
getId
function getId (
) : Number
Get the id of the room.
Returns:
- The id of the room.
Example:
-
trace("Room id:" + room.getId())
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
getMaxSpectators
function getMaxSpectators (
) : Number
Retrieve the maximum number of spectators that can join the room.
Spectators can exist in game rooms only.
Spectators can exist in game rooms only.
Returns:
- The maximum number of spectators that can join the room.
Example:
-
if (room.isGame) trace("Max spectators allowed to join the room: " + room.getMaxSpectators())
See also:
Version:
- SmartFoxServer Basic / Pro
getMaxUsers
function getMaxUsers (
) : Number
Retrieve the maximum number of users that can join the room.
Returns:
- The maximum number of users that can join the room.
Example:
-
trace("Max users allowed to join the room: " + room.getMaxUsers())
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
getMyPlayerIndex
function getMyPlayerIndex (
) : Number
Retrieve the player id for the current user in the room.
This id is 1-based (player 1, player 2, etc.), but if the user is a spectator its value is -1.
This id is 1-based (player 1, player 2, etc.), but if the user is a spectator its value is -1.
Returns:
- The player id for the current user.
Example:
-
if (room.isGame) trace("My player id in this room: " + room.getMyPlayerIndex())
Version:
- SmartFoxServer Lite / Basic / Pro
getName
function getName (
) : String
Get the name of the room.
Returns:
- The name of the room.
Example:
-
trace("Room name:" + room.getName())
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
getSpectatorCount
function getSpectatorCount (
) : Number
Retrieve the number of spectators currently inside the room.
Returns:
- The number of spectators in the room.
Example:
-
var specsNum:Number = room.getSpectatorCount() trace("There are " + specsNum + " spectators in the room")
See also:
Version:
- SmartFoxServer Basic / Pro
getUser
Retrieve a user currently in the room.
Parameters:
userId:
the user name (
String) or the id (Number) of the user to retrieve.Returns:
- A User object.
Example:
-
var user:User = room.getUser("jack")
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
getUserCount
function getUserCount (
) : Number
Retrieve the number of users currently inside the room.
Returns:
- The number of users in the room.
Example:
-
var usersNum:Number = room.getUserCount() trace("There are " + usersNum + " users in the room")
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
getUserList
function getUserList (
) : Object
Get the list of users currently inside the room.
getVariable
function getVariable (
varName:String)
Retrieve a Room Variable.
Parameters:
varName:
the name of the variable to retrieve.
Returns:
- The Room Variable's value.
Example:
-
var location:String = room.getVariable("location")
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
getVariables
function getVariables (
) : Object
Retrieve the list of all Room Variables.
Returns:
- An object containing Room Variables' values, which can be retrieved by means of the variable name.
Example:
-
var roomVars:Object = room.getVariables() for (var v:String in roomVars) trace("Name:" + v + " | Value:" + roomVars[v])
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
isGame
function isGame (
) : Boolean
A boolean flag indicating if the room is a "game room".
Returns:
-
trueif the room is a "game room".
Example:
-
if (room.isGame) trace("This is a game room")
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
isLimbo
function isLimbo (
) : Boolean
A boolean flag indicating if the room is in "limbo mode".
Returns:
-
trueif the room is in "limbo mode".
Example:
-
if (room.isLimbo) trace("This is a limbo room")
See also:
Version:
- SmartFoxServer Lite / Basic / Pro
isPrivate
function isPrivate (
) : Boolean
A boolean flag indicating if the room is private (password protected).
Returns:
-
trueif the room is private.
Example:
-
if (room.isPrivate) trace("Password required for this room")
Version:
- SmartFoxServer Lite / Basic / Pro
isTemp
function isTemp (
) : Boolean
A boolean flag indicating if the room is dynamic/temporary.
This is always true for rooms created at runtime on client-side.
This is always true for rooms created at runtime on client-side.
Returns:
-
trueif the room is a dynamic/temporary room.
Example:
-
if (room.isTemp) trace("Room is temporary")
Version:
- SmartFoxServer Lite / Basic / Pro