Room

Description

The Room class is used internally by the SmartFoxClient object to store the properties of each room.  Also, Room objects are returned by different methods and events of the API.

Version

1.0.0

Status

Final

Author

The gotoAndPlay() Team

Copyright

© 2006-2007 gotoAndPlay()

http://www.gotoandplay.it

http://www.smartfoxserver.com

Summary
The Room class is used internally by the SmartFoxClient object to store the properties of each room.
The default contructor.
Get the list of users currently inside the room.
Look for a user in the room.
Retrieve a Room Variable.
Retrieve the list of all Room Variables.
Get the name of the room.
Get the id of the room.
A boolean flag indicating if the room is dynamic/temporary.
A boolean flag indicating if the room is a “game room”.
A boolean flag indicating if the room is private (password protected).
Retrieve the number of users currently inside the room.
Retrieve the number of spectators currently inside the room.
Retrieve the maximum number of users that can join the room.
Retrieve the maximum number of spectators that can join the room.
Retrieve the player id for the current user in the room.
A boolean flag indicating if the room is in “limbo mode”.

Functions

Room

public function Room(id: int,  
name: String,  
maxUsers: int,  
maxSpectators: int,  
isTemp: Boolean,  
isGame: Boolean,  
isPrivate: Boolean,  
isLimbo: Boolean,  
userCount: int = 0,
specCount: int = 0)

The default contructor.

Parameters

idthe room id.
namethe room name.
maxUsersthe maximum number of users that can join the room simultaneously.
maxSpectatorsthe maximum number of spectators in the room (for game rooms only).
isTemptrue if the room is temporary. isGame- true if the room is a “game room”.
isPrivatetrue if the roomis private (password protected).

getUserList

public function getUserList():Array

Get the list of users currently inside the room.

Parameters

None.

Return

Arraya list of User objects.

getUser

public function getUser(userId: *):User

Look for a user in the room.

Parameters

userIdthe user name (String) or the id (int) of the user to retrieve.

Return

Usera User object.

getVariable

public function getVariable(varName: String):Object

Retrieve a Room Variable.

Parameters

varNamethe name of the variable.

Return

Objectthe variable value.

See also

getVariables, SmartFoxClient.setRoomVariables

getVariables

public function getVariables():Array

Retrieve the list of all Room Variables.

Parameters

None.

Return

Arraya list of all Room Variables.

See also

getVariable, SmartFoxClient.setRoomVariables

getName

public function getName():String

Get the name of the room.

Parameters

None.

Return

Stringthe name of the room.

See also

getId

getId

public function getId():int

Get the id of the room.

Parameters

None.

Return

intthe id of the room.

See also

getName

isTemp

public function isTemp():Boolean

A boolean flag indicating if the room is dynamic/temporary.

This is always true for user-created rooms.

Parameters

None.

Return

Booleantrue if the room is a dynamic/temporary room.

isGame

public function isGame():Boolean

A boolean flag indicating if the room is a “game room”.

Parameters

None.

Return

Booleantrue if the room is a “game room”.

See also

isLimbo

isPrivate

public function isPrivate():Boolean

A boolean flag indicating if the room is private (password protected).

Parameters

None.

Return

Booleantrue if the room is private.

getUserCount

public function getUserCount():int

Retrieve the number of users currently inside the room.

Parameters

None.

Return

intthe number of users in the room.

See also

getSpectatorCount

getSpectatorCount

public function getSpectatorCount():int

Retrieve the number of spectators currently inside the room.

Parameters

None.

Return

intthe number of spectators in the room.

See also

getUserCount

getMaxUsers

public function getMaxUsers():int

Retrieve the maximum number of users that can join the room.

Parameters

None.

Return

intthe maximum number of users that can join the room.

See also

getMaxSpectators

getMaxSpectators

public function getMaxSpectators():int

Retrieve the maximum number of spectators that can join the room.

Parameters

None.

Return

intthe maximum number of spectators that can join the room.

See also

getMaxUsers

getMyPlayerIndex

public function getMyPlayerIndex():int

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.

Parameters

None.

Return

intthe player id for the current user in the room.

isLimbo

public function isLimbo():Boolean

A boolean flag indicating if the room is in “limbo mode”.

More info can be found in the “Zone configuration” documentation (http://www.smartfoxserver.com- /docs- /docPages- /config- /basics.htm#zone).

Parameters

None.

Return

Booleantrue if the room is in “limbo mode”.

See also

isGame

This is the class responsible for connecting to the server and handling all related events.
public function Room(id: int,  
name: String,  
maxUsers: int,  
maxSpectators: int,  
isTemp: Boolean,  
isGame: Boolean,  
isPrivate: Boolean,  
isLimbo: Boolean,  
userCount: int = 0,
specCount: int = 0)
The default contructor.
public function getUserList():Array
Get the list of users currently inside the room.
public function getUser(userId: *):User
Look for a user in the room.
public function getVariable(varName: String):Object
Retrieve a Room Variable.
public function getVariables():Array
Retrieve the list of all Room Variables.
public function getName():String
Get the name of the room.
public function getId():int
Get the id of the room.
public function isTemp():Boolean
A boolean flag indicating if the room is dynamic/temporary.
public function isGame():Boolean
A boolean flag indicating if the room is a “game room”.
public function isPrivate():Boolean
A boolean flag indicating if the room is private (password protected).
public function getUserCount():int
Retrieve the number of users currently inside the room.
public function getSpectatorCount():int
Retrieve the number of spectators currently inside the room.
public function getMaxUsers():int
Retrieve the maximum number of users that can join the room.
public function getMaxSpectators():int
Retrieve the maximum number of spectators that can join the room.
public function getMyPlayerIndex():int
Retrieve the player id for the current user in the room.
public function isLimbo():Boolean
A boolean flag indicating if the room is in “limbo mode”.
The User class is used internally by the SmartFoxClient object to store the properties of each user.
public function setRoomVariables(varList: Array,  
roomId: int = -1,
setOwnership: Boolean = true):void
Set on or more Room Variables.