SFS2X Objective-C API  1.7.13
iOS / macOS / tvOS
SFSGameSettings.h
1 //
2 // SFSGameSettings.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 
12 #import "RoomSettings.h"
13 #import "ISFSObject.h"
14 
15 @class MatchExpression;
16 
17 /** This class provides all the settings required to create an SFSGame(*).
18 
19  The SFSGame(*) object extends the Room object providing new advanced features such as Player matching, Game invitations, public and private Games, quick game joining etc.
20 
21  (*) = the SFSGame class exists only on the server side as extension of the SFSRoom class. On the client side it's seen as a regular Room.
22 
23  This is a quick overview of the settings that you can use to setup an SFSGame
24 
25  - <b>isGamePublic</b>: a public game can be joined by any Player whose variables match the SFSGame Player Match Expression. Private games are based on invitations sent by the Game creator.
26  - <b>minPlayersToStartGame</b>: the minimum number of players to start the game.
27  - <b>invitedPlayers</b>: (private games only) a list of players invited in the Game
28  - <b>searchableRooms</b>: (private games only) a list of Rooms where the Game API can search for more players to invite.
29  The API will look for more players if the number of people invited is smaller than the minPlayersToStartGame. This way you can add your friends to the game and let the system find more players to start it.
30  - <b>leaveLastJoinedRoom</b>: auto-remove players from their previous Room after successful join
31  - <b>playerMatchExpression</b>: an expression to match players willing to play the game, by default no expression is used
32  - <b>spectatorMatchExpression</b>: an expression to match spectators willing to play the game, by default no expression is used
33  - <b>invitationExpiryTime</b>: the amount of time allowed for invited players to accept / refuse
34  - <b>invitationParameters</b>: optional custom invitation parameters.These could provide details about the inviter, the game, an invitation message etc...
35  - <b>notifyGameStartedViaRoomVariable</b>: automatically update a reserved Room Variable to signal that the game is started/stopped. The Room variable uses the <b>global</b> setting to be broadcast outside of the Room. This can be used on the client side to show the game state in your game list.
36 
37  @see CreateSFSGameRequest
38  @see MatchExpression
39 
40  */
42 @private
43  BOOL _isPublic;
44  NSInteger _minPlayersToStartGame;
45  NSArray *_invitedPlayers;
46  NSArray *_searchableRooms;
47  MatchExpression *_playerMatchExpression;
48  MatchExpression *_spectatorMatchExpression;
49  NSInteger _invitationExpiryTime;
50  BOOL _leaveJoinedLastRoom;
51  BOOL _notifyGameStarted;
52  id <ISFSObject> _invitationParams;
53 }
54 
55 /**
56  Check if the Game is public or private
57  */
58 @property (nonatomic, assign) BOOL isPublic;
59 /**
60  The minimum number of players to start the Game
61  */
62 @property (nonatomic, assign) NSInteger minPlayersToStartGame;
63 /**
64  Private games only: a list of invited Players (an Array of Users)
65  */
66 @property (nonatomic, strong) NSArray *invitedPlayers;
67 /**
68  Private games only: a list of room groups (Array of String) where to search for more players
69  */
70 @property (nonatomic, strong) NSArray *searchableRooms;
71 /**
72  (Recommended for public Games only)
73  A MatchExpression for filtering Users joining the Game.
74 
75  @see MatchExpression
76  */
77 @property (nonatomic, strong) MatchExpression *playerMatchExpression;
78 /**
79  A MatchExpression for filtering Spectators joining the Game.
80 
81  @see MatchExpression
82  */
83 @property (nonatomic, strong) MatchExpression *spectatorMatchExpression;
84 /**
85  The amount of time (in seconds) available for the User to reply to the invitation.
86  Suggested range 10-40 seconds
87  */
88 @property (nonatomic, assign) NSInteger invitationExpiryTime;
89 /**
90  Determines if the Players will leave their previous Room when joining the Game
91  */
92 @property (nonatomic, assign) BOOL leaveJoinedLastRoom;
93 /**
94  Uses a "reserved" global Room Variable to notify the started/stopped status of the game.
95  This depends on the numer of Users inside the Room.
96 
97  @see SFSRoomVariable
98  @see ReservedRoomVariables
99  */
100 @property (nonatomic, assign) BOOL notifyGameStarted;
101 /**
102  An optional custom object with parameters (e.g. a message, game details etc...)
103  */
104 @property (nonatomic, strong) id <ISFSObject> invitationParams;
105 
106 -(id)initWithName:(NSString *)name;
107 +(id)settingsWithName:(NSString *)name;
108 
109 @end
MatchExpression
Definition: MatchExpression.h:42
RoomSettings
Definition: RoomSettings.h:39
SFSGameSettings
Definition: SFSGameSettings.h:41