public class SFSGameApi extends java.lang.Object implements ISFSGameApi
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
protected com.smartfoxserver.v2.api.response.ISFSGameResponseApi |
responseApi |
protected SmartFoxServer |
sfs |
protected ISFSApi |
sfsApi |
| Constructor and Description |
|---|
SFSGameApi() |
SFSGameApi(SmartFoxServer sfs) |
| Modifier and Type | Method and Description |
|---|---|
Room |
createGame(Zone zone,
CreateSFSGameSettings settings,
User owner)
Create an SFSGame Room and automatically update the clients and fire a server event
|
Room |
createGame(Zone zone,
CreateSFSGameSettings settings,
User owner,
boolean fireClientEvent,
boolean fireServerEvent)
Create an SFSGame Room.
|
com.smartfoxserver.v2.api.response.ISFSGameResponseApi |
getResponseAPI() |
Room |
quickJoinGame(User player,
MatchExpression expression,
java.util.Collection<Room> searchableRooms,
Room roomToLeave)
Quick join a User in an SFSGame.
|
Room |
quickJoinGame(User player,
MatchExpression expression,
Zone zone,
java.lang.String groupId)
Quick join a User in an SFSGame.
|
Room |
quickJoinGame(User player,
MatchExpression expression,
Zone zone,
java.lang.String groupId,
Room roomToLeave)
Quick join a User in an SFSGame.
|
void |
replyToInvitation(User invitedUser,
int invitationId,
InvitationResponse reply,
ISFSObject params,
boolean fireClientEvent)
Handle the Invitation reply of a User
|
void |
sendInvitation(Invitation invitation,
InvitationCallback callBackHandler)
Send an Invitation to a User.
|
void |
sendInvitation(User inviter,
java.util.List<User> invitees,
int expirySeconds,
InvitationCallback callBackHandler,
ISFSObject params)
Send an Invitation to a User.
|
void |
sendJoinRoomInvitation(Room target,
User inviter,
java.util.List<User> invitees,
int expirySeconds)
Invites Users / Players in an existing Room.
|
void |
sendJoinRoomInvitation(Room target,
User inviter,
java.util.List<User> invitees,
int expirySeconds,
boolean asSpect,
boolean leaveLastJoinedRoom)
Invites Users / Players in an existing Room.
|
void |
sendJoinRoomInvitation(Room target,
User inviter,
java.util.List<User> invitees,
int expirySeconds,
boolean asSpect,
boolean leaveLastJoinedRoom,
ISFSObject params)
Invites Users / Players in an existing Room.
|
void |
setSFS(SmartFoxServer sfs)
Private
|
protected SmartFoxServer sfs
protected ISFSApi sfsApi
protected final org.slf4j.Logger log
protected final com.smartfoxserver.v2.api.response.ISFSGameResponseApi responseApi
public SFSGameApi()
public SFSGameApi(SmartFoxServer sfs)
public void setSFS(SmartFoxServer sfs)
ISFSGameApisetSFS in interface ISFSGameApipublic com.smartfoxserver.v2.api.response.ISFSGameResponseApi getResponseAPI()
getResponseAPI in interface ISFSGameApipublic Room createGame(Zone zone, CreateSFSGameSettings settings, User owner) throws SFSCreateRoomException
createGame in interface ISFSGameApizone - the Zonesettings - the SFSGame settingsowner - the owner of the game (null == The Server)SFSCreateGameExceptionSFSCreateRoomExceptionSFSGame,
CreateSFSGameSettingspublic Room createGame(Zone zone, CreateSFSGameSettings settings, User owner, boolean fireClientEvent, boolean fireServerEvent) throws SFSCreateRoomException
createGame in interface ISFSGameApizone - the Zonesettings - the SFSGame settingsowner - the game owner (null == The Server)fireClientEvent - if true an update will be sent to the clients (recommended)fireServerEvent - if true a server side event will be firedSFSCreateGameExceptionSFSCreateRoomExceptionSFSGame,
CreateSFSGameSettingspublic Room quickJoinGame(User player, MatchExpression expression, Zone zone, java.lang.String groupId) throws SFSJoinRoomException
The API will:
ISFSGameApi.quickJoinGame(User, MatchExpression, Zone, String, Room)quickJoinGame in interface ISFSGameApiplayer - the User who wants to join a gameexpression - a MatchExpression with the Room search criteriazone - the Zone where to search the RoomsgroupId - is non-null this will restrict the match to the Rooms in that groupSFSJoinRoomExceptionSFSGame,
MatchExpressionpublic Room quickJoinGame(User player, MatchExpression expression, Zone zone, java.lang.String groupId, Room roomToLeave) throws SFSJoinRoomException
The API will:
quickJoinGame in interface ISFSGameApiplayer - the User who wants to join a gameexpression - a MatchExpression with the Room search criteriazone - the Zone where to search the RoomsgroupId - is non-null this will restrict the match to the Rooms in that grouproomToLeave - the Room to leave after having successfully joined a Game.SFSJoinRoomExceptionSFSGame,
MatchExpressionpublic Room quickJoinGame(User player, MatchExpression expression, java.util.Collection<Room> searchableRooms, Room roomToLeave) throws SFSJoinRoomException
The API will:
quickJoinGame in interface ISFSGameApiplayer - the User who wants to join a gameexpression - a MatchExpression with the Room search criteriasearchableRooms - a List of Rooms to searchroomToLeave - the Room to leave after having successfully joined a Game.SFSJoinRoomExceptionSFSGame,
MatchExpressionpublic void sendInvitation(Invitation invitation, InvitationCallback callBackHandler)
sendInvitation in interface ISFSGameApiinvitation - the InvitationcallBackHandler - the Invitation callback handlerSFSInvitation,
InvitationCallbackpublic void sendInvitation(User inviter, java.util.List<User> invitees, int expirySeconds, InvitationCallback callBackHandler, ISFSObject params)
sendInvitation in interface ISFSGameApiinviter - the Inviterinvitees - the InviteeexpirySeconds - the amount of time allowed for the Invitee to accept or refuse the invitationcallBackHandler - the Invitation callback handlerparams - custom Invitation parametersSFSInvitation,
InvitationCallbackpublic void replyToInvitation(User invitedUser, int invitationId, InvitationResponse reply, ISFSObject params, boolean fireClientEvent)
replyToInvitation in interface ISFSGameApiinvitedUser - the invited UserinvitationId - the id of the invitationreply - the replyparams - optional parametersfireClientEvent - will fire a client event in case of failurepublic void sendJoinRoomInvitation(Room target, User inviter, java.util.List<User> invitees, int expirySeconds)
sendJoinRoomInvitation in interface ISFSGameApitarget - the Room where people accepting the invitation will be joined ininviter - the sender of the invitation. Null can be passed to specify that the invitation is on behalf of the server itselfinvitees - a list of people invited in the RoomexpirySeconds - the amount of seconds allowed to reply to the invitationpublic void sendJoinRoomInvitation(Room target, User inviter, java.util.List<User> invitees, int expirySeconds, boolean asSpect, boolean leaveLastJoinedRoom)
sendJoinRoomInvitation in interface ISFSGameApitarget - the Room where people accepting the invitation will be joined ininviter - the sender of the invitation. Null can be passed to specify that the invitation is on behalf of the server itselfinvitees - a list of people invited in the RoomexpirySeconds - the amount of seconds allowed to reply to the invitationasSpect - if true the provided list of people will be joined as spectators (where applicable, i.e. Game Rooms)leaveLastJoinedRoom - if true the users joining the target Room will leave the previously joined Roompublic void sendJoinRoomInvitation(Room target, User inviter, java.util.List<User> invitees, int expirySeconds, boolean asSpect, boolean leaveLastJoinedRoom, ISFSObject params)
sendJoinRoomInvitation in interface ISFSGameApitarget - the Room where people accepting the invitation will be joined ininviter - the sender of the invitation. Null can be passed to specify that the invitation is on behalf of the server itselfinvitees - a list of people invited in the RoomexpirySeconds - the amount of seconds allowed to reply to the invitationasSpect - if true the provided list of people will be joined as spectators (where applicable, i.e. Game Rooms)leaveLastJoinedRoom - if true the users joining the target Room will leave the previously joined Roomparams - an optional SFSObject with custom data that is sent to the invitees