SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSRoomVariable.h
1 //
2 // SFSRoomVariable.h
3 // SFS2X
4 //
5 // Original development by Infosfer Game Technologies Ltd. | http://www.infosfer.com.
6 //
7 // Maintained and developed by A51 Integrated.
8 // Copyright 2012 A51 Integrated | http://a51integrated.com. All rights reserved.
9 //
10 
11 #import <Foundation/Foundation.h>
12 #import "RoomVariable.h"
13 #import "ISFSArray.h"
14 #import "BaseVariable.h"
15 
16 /** The RoomVariable class is used to represent variables maintained on the Server side and automatically updated to the clients.
17 
18  They are particularly useful to "attach" any custom data to each Room such as the current game status and other Room-specific properties etc...
19 
20  RoomVariables support basic data types and nested complex objects:
21 
22  - Null
23  - Bool
24  - Int
25  - Double
26  - String
27  - SFSObject
28  - SFSArray
29 
30  RoomVariables also support different flags:
31 
32  - <b>Private</b>: a private variable can only be modified by its creator
33  - <b>Persistent</b>: a persistent variable will continue to exist even if its creator has left the room.
34  - <b>Global</b>: a global variable will fire updates not only to all Users in the Room but also to all Users in the Room Group
35 
36  @see SFSRoom
37  @see SetRoomVariablesRequest
38 
39  */
40 @interface SFSRoomVariable : BaseVariable <RoomVariable>
41 {
42  BOOL _isPersistent;
43  BOOL _isPrivate;
44 }
45 
46 /**
47  @param name the name of the variable
48  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
49  @param type (optional -1) it's usually not necessary to pass this parameter as the variable value is auto-detected
50  */
51 +(id)variableWithName:(NSString *)name value:(id)value type:(NSInteger)type;
52 
53 /**
54  @param name the name of the variable
55  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
56  */
57 +(id)variableWithName:(NSString *)name value:(id)value;
58 
59 /**
60  @param name the name of the variable
61  @param value the variable value ( can be BOOL, Integer, Double, String, SFSObject, SFSArray )
62  @param priv indicates whether the variable can be modified by other users or not
63  @param pers indicates whether the variable is removed from the Room when the user leaves (YES = variable is not removed)
64  */
65 +(id)variableWithName:(NSString *)name value:(id)value isPrivate:(BOOL)priv isPersistent:(BOOL) pers;
66 
67 /** Checks if the variable is persistent.
68 
69  A persistent RoomVariable continues to exist in a Room after the User has left it and until he disconnects
70  */
71 @property (nonatomic, readwrite) BOOL isPersistent;
72 
73 /** Checks if the variable is private.
74 
75  A private RoomVariable is only modifiable by its owner (the user that created it)
76  */
77 @property (nonatomic, readwrite) BOOL isPrivate;
78 
79 +(id <RoomVariable>)fromSFSArray:(id <ISFSArray>)sfsa;
80 
81 -(id <ISFSArray>)toSFSArray;
82 
83 @end
SFSRoomVariable
Definition: SFSRoomVariable.h:40
BaseVariable
Definition: BaseVariable.h:12