Package | com.smartfoxserver.v2.entities.variables |
Class | public class SFSRoomVariable |
Inheritance | SFSRoomVariable BaseVariable Object |
Implements | RoomVariable |
Room Variables are particularly useful to store custom Room data such as a game status and other Room-level informations.
Room Variables can be set by means of the SetRoomVariablesRequest request; they support the following data types (also nested):
Boolean, int, Number, String, SFSObject, SFSArray. A Room Variable can also be null
.
Room Variables also support a number of specific flags:
See also
Property | Defined By | ||
---|---|---|---|
isPersistent : Boolean
Indicates whether this Room Variable is persistent or not. | SFSRoomVariable | ||
isPrivate : Boolean
Indicates whether this Room Variable is private or not. | SFSRoomVariable | ||
name : String [read-only]
Indicates the name of this variable. | BaseVariable | ||
type : String [read-only]
Indicates the type of this variable. | BaseVariable |
Method | Defined By | ||
---|---|---|---|
SFSRoomVariable(name:String, value:*, type:int = -1)
Creates a new SFSRoomVariable instance. | SFSRoomVariable | ||
getBoolValue():Boolean
Retrieves the value of a boolean variable. | BaseVariable | ||
getDoubleValue():Number
Retrieves the value of a numeric variable. | BaseVariable | ||
getIntValue():int
Retrieves the value of an integer variable. | BaseVariable | ||
Retrieves the value of a SFSArray variable. | BaseVariable | ||
Retrieves the value of a SFSObject variable. | BaseVariable | ||
getStringValue():String
Retrieves the value of a string variable. | BaseVariable | ||
getValue():*
Retrieves the untyped value of this variable. | BaseVariable | ||
isNull():Boolean
Indicates if the variable is null. | BaseVariable | ||
toString():String
Returns a string that contains the Room Variable name, type, value and isPrivate flag. | SFSRoomVariable |
isPersistent | property |
isPersistent:Boolean
Indicates whether this Room Variable is persistent or not. A persistent Room Variable continues to exist in the Room after the user who created it has left it and until he disconnects.
NOTE: setting the isPersistent property manually on an existing Room Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the Room Variable object is created by the developer only (using the new keyword).
public function get isPersistent():Boolean
public function set isPersistent(value:Boolean):void
isPrivate | property |
isPrivate:Boolean
Indicates whether this Room Variable is private or not. A private Room Variable is visible to all users in the same Room, but it can be modified only by its owner (the user that created it).
NOTE: setting the isPrivate property manually on an existing Room Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the Room Variable object is created by the developer only (using the new keyword).
public function get isPrivate():Boolean
public function set isPrivate(value:Boolean):void
SFSRoomVariable | () | Constructor |
public function SFSRoomVariable(name:String, value:*, type:int = -1)
Creates a new SFSRoomVariable instance.
Parametersname:String — The name of the Room Variable.
| |
value:* — The value of the Room Variable; valid data types are: Boolean, int, Number, String, SFSObject, SFSArray. The value can also be null .
| |
type:int (default = -1 ) — The type of the Room Variable among those available in the VariableType class. Usually it is not necessary to pass this parameter, as the type is auto-detected from the value.
|
See also
toString | () | method |
public function toString():String
Returns a string that contains the Room Variable name, type, value and isPrivate flag.
ReturnsString — The string representation of the SFSRoomVariable object.
|