|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Quickly joins the current user in a public game. More...
#include <QuickJoinGameRequest.h>
Public Member Functions | |
| QuickJoinGameRequest (std::optional< entities::match::MatchExpression > matchExpr, std::vector< std::string > groupIds, std::optional< int32_t > roomIdToLeave=std::nullopt) | |
| Creates a new QuickJoinGameRequest searching a list of Room Groups. | |
| QuickJoinGameRequest (std::optional< entities::match::MatchExpression > matchExpr, std::vector< int32_t > roomIds, std::optional< int32_t > roomIdToLeave=std::nullopt) | |
| Creates a new QuickJoinGameRequest searching a list of Rooms, by id. | |
| QuickJoinGameRequest (std::optional< entities::match::MatchExpression > matchExpr, const std::vector< std::shared_ptr< entities::Room > > &rooms, std::optional< int32_t > roomIdToLeave=std::nullopt) | |
| Creates a new QuickJoinGameRequest searching a list of Rooms. | |
Quickly joins the current user in a public game.
By providing a matching expression and a list of Rooms or Groups, SmartFoxServer can search for a matching public Game Room and immediately join the user into that Room as a player.
If a game could be found and joined, a ROOM_JOIN event is dispatched to the requester's client, just like an ordinary JoinRoomRequest. If no matching game was found, the client gets a ROOM_JOIN_ERROR event instead.
The matching expression is optional: without it the first Room found in the search scope is good.
auto exp = entities::match::MatchExpression(entities::match::RoomProperties::HAS_FREE_PLAYER_SLOTS,
entities::match::BoolMatch::EQUALS, true);
sfs.send(requests::QuickJoinGameRequest(std::move(exp), { "chessGames" }));
|
inline |
Creates a new QuickJoinGameRequest searching a list of Room Groups.
Pass it to SmartFox::send for the request to be performed.
| matchExpr | A matching expression the server uses to search a Game Room where to join the current user; if empty, the first Room found is good. |
| groupIds | The names of the Groups the matching expression is applied to. The list can hold at most 32 names and must not be empty. |
| roomIdToLeave | The id of the Room the user should leave when joining the game. |
|
inline |
Creates a new QuickJoinGameRequest searching a list of Rooms, by id.
| matchExpr | A matching expression the server uses to search a Game Room where to join the current user; if empty, the first Room found is good. |
| roomIds | The ids of the Rooms the matching expression is applied to. The list can hold at most 32 ids and must not be empty. |
| roomIdToLeave | The id of the Room the user should leave when joining the game. |
|
inline |
Creates a new QuickJoinGameRequest searching a list of Rooms.
Only the Room ids travel to the server, so the Rooms are not kept by the request.
| matchExpr | A matching expression the server uses to search a Game Room where to join the current user; if empty, the first Room found is good. |
| rooms | The Rooms the matching expression is applied to. The list can hold at most 32 Rooms and must not be empty. |
| roomIdToLeave | The id of the Room the user should leave when joining the game. |