SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSRoom Class Reference

#import <SFSRoom.h>

Inherits NSObject, and <Room>.

Inherited by MMORoom.

Instance Methods

(id- initWithId:name:groupId:
 
(NSArray *) - getVariables
 
(id< RoomVariable >) - getVariable:
 
(id< User >) - getUserByName:
 
(id< User >) - getUserById:
 
(BOOL) - containsVariable:
 
(BOOL) - containsUser:
 
(void) - merge:
 

Class Methods

(id< Room >) + fromSFSArray:
 

Protected Attributes

NSInteger _id
 
NSString * _name
 
NSString * _groupId
 
BOOL _isGame
 
BOOL _isHidden
 
BOOL _isJoined
 
BOOL _isPasswordProtected
 
BOOL _isManaged
 
NSMutableDictionary * _variables
 
NSDictionary * _properties
 
id< IUserManager > _userManager
 
NSInteger _maxUsers
 
NSInteger _maxSpectators
 
NSInteger _userCount
 
NSInteger _spectatorCount
 
__weak id< IRoomManager > _roomManager
 

Properties

NSInteger id
 
NSString * name
 
NSString * groupId
 
BOOL isGame
 
BOOL isHidden
 
BOOL isJoined
 
BOOL isPasswordProtected
 
BOOL isManaged
 
NSInteger maxUsers
 
NSInteger maxSpectators
 
NSInteger userCount
 
NSInteger capacity
 
NSInteger spectatorCount
 
NSDictionary * properties
 
id< IRoomManager > roomManager
 
NSArray * userList
 
NSArray * playerList
 
NSArray * spectatorList
 

Detailed Description

The Room object that represents a server Room.

The client API doesn't know about all Rooms on the server side but only about those that are joined and those in the Room Groups that were subscribed.

Subscribing to one or more Groups allows the client to listen for Room events in specific "areas" of the Zone without having to know and download details for all Rooms available.

The RoomList is created after a succesful login in the SmartFox2XClient roomList object and it is kept updated at all times by the Server.

See also
[SmartFox2XClient roomList]
CreateRoomRequest
JoinRoomRequest
SubscribeRoomGroupRequest
UnsubscribeRoomGroupRequest
ChangeRoomNameRequest
ChangeRoomPasswordStateRequest
ChangeRoomCapacityRequest

Method Documentation

◆ containsUser:

- (BOOL) containsUser: (id <User>)  user

Checks if a User is joined in this Room

Returns
true if the User exists in the Room

◆ containsVariable:

- (BOOL) containsVariable: (NSString *)  name

Check for the presence of a Room Variable

Returns
true if the the Room Variable exists

◆ getUserById:

- (id< User >) getUserById: (NSInteger)  id

Get a User from its ID

Returns
the User, or null if no User with that ID exists in the Room

◆ getUserByName:

- (id< User >) getUserByName: (NSString *)  name

Get a User from its name

Returns
the User, or null if no User with that name exists in the Room

◆ getVariable:

- (id< RoomVariable >) getVariable: (NSString *)  name

Get a Room Variable

Parameters
namethe name of the variable
Returns
the Room Variable, or null if no variable exists with that name

◆ getVariables

- (NSArray *) getVariables

Returns all the Room Variables

Returns
an array of Room Variables

Property Documentation

◆ capacity

- (NSInteger) capacity
readnonatomicassign

Returns the max amount of users (both Users and Spectators) that can be contained in this room

◆ groupId

- (NSString *) groupId
readnonatomicweak

The Room Group. Each Room is assigned to its Group. By default SmartFoxServer uses one single group called default

◆ id

- (NSInteger) id
readnonatomicassign

The unique id of the Room

◆ isGame

- (BOOL) isGame
readwritenonatomicassign

Determines if a Room is a Game Room

◆ isHidden

- (BOOL) isHidden
readwritenonatomicassign

Determines if the Room is hidden

◆ isJoined

- (BOOL) isJoined
readwritenonatomicassign

Returns true if the Room is joined by the current User

◆ isPasswordProtected

- (BOOL) isPasswordProtected
readwritenonatomicassign

Returns true if the Room requires a password for joining it

◆ maxSpectators

- (NSInteger) maxSpectators
readwritenonatomicassign

Get the maximum number of spectators allowed in the Room

◆ maxUsers

- (NSInteger) maxUsers
readwritenonatomicassign

Get the maximum number of users allowed for this Room

◆ name

- (NSString *) name
readwritenonatomicstrong

The Room name

◆ playerList

- (NSArray *) playerList
readnonatomicweak

Returns all the Users that are players in this Room (must be Game Room)

◆ properties

- (NSDictionary *) properties
readwritenonatomicstrong

The properties object can be used to store any custom value/object to the Room at runtime

◆ spectatorCount

- (NSInteger) spectatorCount
readwritenonatomicassign

Get the number of spectators (only for Game Rooms)

◆ spectatorList

- (NSArray *) spectatorList
readnonatomicweak

Returns all the Users that are spectators in this Room (must be Game Room)

◆ userCount

- (NSInteger) userCount
readwritenonatomicassign

Get the current number of users

◆ userList

- (NSArray *) userList
readnonatomicweak

Get the full list of users in the Room