PlatformUnrealSDK
FOnlineSessionPico Class Reference

FOnlineSessionPico class inherited from IOnlineSession(Unreal Engine). More...

#include <OnlineSessionInterfacePico.h>

Public Member Functions

 FOnlineSessionPico (FOnlineSubsystemPico &InSubsystem)
 The constructor. More...
 
virtual ~FOnlineSessionPico ()
 The default destructor.
 
virtual bool CreateSession (int32 HostingPlayerNum, FName SessionName, const FOnlineSessionSettings &NewSessionSettings) override
 Creates an online session based on the specified settings. More...
 
virtual bool StartSession (FName SessionName) override
 Marks an online session as in progress (as opposed to being in lobby or pending). More...
 
virtual bool UpdateSession (FName SessionName, FOnlineSessionSettings &UpdatedSessionSettings, bool bShouldRefreshOnlineData=true) override
 Updates the localized settings/properties for the session in question. More...
 
virtual bool EndSession (FName SessionName) override
 Marks an online session as having been ended. More...
 
virtual bool DestroySession (FName SessionName, const FOnDestroySessionCompleteDelegate &CompletionDelegate=FOnDestroySessionCompleteDelegate()) override
 Destroys the specified online session. More...
 
virtual bool IsPlayerInSession (FName SessionName, const FUniqueNetId &UniqueId) override
 Determines if the player is registered in the specified session. More...
 
virtual bool StartMatchmaking (const TArray< FUniqueNetIdRef > &LocalPlayers, FName SessionName, const FOnlineSessionSettings &NewSessionSettings, TSharedRef< FOnlineSessionSearch > &SearchSettings) override
 Starts cloud-based matchmaking for a session. More...
 
virtual bool CancelMatchmaking (int32 SearchingPlayerNum, FName SessionName) override
 Cancels a matchmaking request for a given session. More...
 
virtual bool FindSessions (int32 SearchingPlayerNum, const TSharedRef< FOnlineSessionSearch > &SearchSettings) override
 Searches for sessions matching the settings specified. More...
 
virtual bool FindSessionById (const FUniqueNetId &SearchingUserId, const FUniqueNetId &SessionId, const FUniqueNetId &FriendId, const FOnSingleSessionResultCompleteDelegate &CompletionDelegate) override
 Finds a session by session ID. More...
 
virtual bool JoinSession (int32 PlayerNum, FName SessionName, const FOnlineSessionSearchResult &DesiredSession) override
 Joins the session specified. More...
 
void Initialize ()
 Initializes the game module.
 
bool Uninitialize ()
 Uninitializes the game module. More...
 
void SetInitState (bool State)
 Sets InitSuccess for the game module. More...
 
bool IsInitSuccess () const
 Checks the current state of InitSuccess. More...
 
void OnForcedCancelMatchmaking ()
 Forces to cancel matchmaking.
 
void OnForcedLeaveRoom (ppfID RoomID)
 Forces to leave the specified room. More...
 
bool IsInMatchmakingProgress ()
 Checks InProgressMatchmakingSearch and SearchState. More...
 

Private Member Functions

ppfID GetRoomIDOfSession (const FNamedOnlineSession &Session) const
 Gets the room ID of the session. More...
 
int32 GetRoomBuildUniqueId (const ppfRoomHandle Room)
 Gets the build unique ID of a room. More...
 
bool FindModeratedRoomSessions (const TSharedRef< FOnlineSessionSearch > &SearchSettings)
 Searches for moderated rooms. More...
 
bool FindMatchmakingSessions (const FString Pool, const TSharedRef< FOnlineSessionSearch > &SearchSettings)
 Searches for the "browse" type matchmaking rooms. More...
 

Private Attributes

FOnlineSubsystemPico & PicoSubsystem
 Reference to the main Pico subsystem.
 
TMap< FName, TSharedPtr< FNamedOnlineSession > > Sessions
 Current sessions map.
 
TSharedPtr< FOnlineSessionSearch > InProgressMatchmakingSearch
 The SearchSettings for matchmaking.
 
FName InProgressMatchmakingSearchName
 The SessionName when in matchmaking.
 
TArray< TSharedRef< const FOnlineSessionSearchResult > > InviteAcceptedSessions
 Returns the search results of the sessions where the invitation has been accepted. Supported version: 4.8.0 or later.
 

Detailed Description

FOnlineSessionPico class inherited from IOnlineSession(Unreal Engine).

Constructor & Destructor Documentation

◆ FOnlineSessionPico()

FOnlineSessionPico ( FOnlineSubsystemPico &  InSubsystem)

The constructor.

Parameters
InSubsystemA reference to the online subsystem.

Member Function Documentation

◆ CancelMatchmaking()

virtual bool CancelMatchmaking ( int32  SearchingPlayerNum,
FName  SessionName 
)
overridevirtual

Cancels a matchmaking request for a given session.

Parameters
SearchingPlayerNumThe index of the player canceling the search.
SessionNameThe name of the session that was passed to StartMatchmaking (or CreateSession).
Returns
Bool:
  • true: success
  • false: failure

◆ CreateSession()

virtual bool CreateSession ( int32  HostingPlayerNum,
FName  SessionName,
const FOnlineSessionSettings &  NewSessionSettings 
)
overridevirtual

Creates an online session based on the specified settings.

Note: Online session registration is an async process and will not complete until the OnCreateSessionComplete delegate is called.

Parameters
HostingPlayerNumThe index of the player hosting the session.
SessionNameThe name of the session to create.
NewSessionSettingsThe settings to use for the new session.
Returns
Bool:
  • true: success
  • false: failure

◆ DestroySession()

virtual bool DestroySession ( FName  SessionName,
const FOnDestroySessionCompleteDelegate &  CompletionDelegate = FOnDestroySessionCompleteDelegate() 
)
overridevirtual

Destroys the specified online session.

Note: Online session de-registration is an async process and will not complete until the OnDestroySessionComplete delegate is called.

Parameters
SessionNameThe name of the session to destroy.
CompletionDelegateUsed when the session destroy request has been completed.
Returns
Bool:
  • true: success
  • false: failure

◆ EndSession()

virtual bool EndSession ( FName  SessionName)
overridevirtual

Marks an online session as having been ended.

Parameters
SessionNameThe name of the session the to end.
Returns
Bool:
  • true: success
  • false: failure

◆ FindMatchmakingSessions()

bool FindMatchmakingSessions ( const FString  Pool,
const TSharedRef< FOnlineSessionSearch > &  SearchSettings 
)
private

Searches for the "browse" type matchmaking rooms.

Parameters
PoolThe name of the matchmaking pool to look in.
SearchSettingsThe search settings (to set the search results and the searchState).
Returns
Bool:
  • true: success
  • false: failure

◆ FindModeratedRoomSessions()

bool FindModeratedRoomSessions ( const TSharedRef< FOnlineSessionSearch > &  SearchSettings)
private

Searches for moderated rooms.

Parameters
SearchSettingsThe search settings.
Returns
Bool:
  • true: success
  • false: failure

◆ FindSessionById()

virtual bool FindSessionById ( const FUniqueNetId &  SearchingUserId,
const FUniqueNetId &  SessionId,
const FUniqueNetId &  FriendId,
const FOnSingleSessionResultCompleteDelegate &  CompletionDelegate 
)
overridevirtual

Finds a session by session ID.

Parameters
SearchingUserIdThe ID of the user initiating the request.
SessionIdThe session ID to search for.
FriendIdNot supported. Set it invalid.
CompletionDelegateWill be executed when ppf_Room_Get completes.
Returns
Bool:
  • true: success
  • false: failure

◆ FindSessions()

virtual bool FindSessions ( int32  SearchingPlayerNum,
const TSharedRef< FOnlineSessionSearch > &  SearchSettings 
)
overridevirtual

Searches for sessions matching the settings specified.

Parameters
SearchingPlayerNumThe index of the player searching for a match.
SearchSettingsThe desired settings that the returned sessions will have.
Returns
Bool:
  • true: success
  • false: failure

◆ GetRoomBuildUniqueId()

int32 GetRoomBuildUniqueId ( const ppfRoomHandle  Room)
private

Gets the build unique ID of a room.

Parameters
RoomThe handle of the room.
Returns
The build unique ID of the room.

◆ GetRoomIDOfSession()

ppfID GetRoomIDOfSession ( const FNamedOnlineSession &  Session) const
private

Gets the room ID of the session.

Parameters
SessionThe session to get room ID for.
Returns
The room ID of the specified session.

◆ IsInitSuccess()

bool IsInitSuccess ( ) const

Checks the current state of InitSuccess.

Returns
The state of InitSuccess:
  • true
  • false

◆ IsInMatchmakingProgress()

bool IsInMatchmakingProgress ( )

Checks InProgressMatchmakingSearch and SearchState.

Returns
  • true if InProgressMatchmakingSearch is valid and SearchState is EOnlineAsyncTaskState::InProgress
  • false: otherwise

◆ IsPlayerInSession()

virtual bool IsPlayerInSession ( FName  SessionName,
const FUniqueNetId &  UniqueId 
)
overridevirtual

Determines if the player is registered in the specified session.

Parameters
SessionNameThe name of the session.
UniqueIdThe ID of the player to check if in session or not.
Returns
Bool:
  • true: in session
  • false: not in session

◆ JoinSession()

virtual bool JoinSession ( int32  PlayerNum,
FName  SessionName,
const FOnlineSessionSearchResult &  DesiredSession 
)
overridevirtual

Joins the session specified.

Parameters
PlayerNumThe index of the player searching for a match.
SessionNameThe name of the session to join.
DesiredSessionThe desired session to join.
Returns
Bool:
  • true: success
  • false: failure

◆ OnForcedLeaveRoom()

void OnForcedLeaveRoom ( ppfID  RoomID)

Forces to leave the specified room.

Parameters
RoomIDThe ID of the room to force leave.

◆ SetInitState()

void SetInitState ( bool  State)

Sets InitSuccess for the game module.

Parameters
State
  • true when setting InitSuccess to true
  • false when setting InitSuccess to false

◆ StartMatchmaking()

virtual bool StartMatchmaking ( const TArray< FUniqueNetIdRef > &  LocalPlayers,
FName  SessionName,
const FOnlineSessionSettings &  NewSessionSettings,
TSharedRef< FOnlineSessionSearch > &  SearchSettings 
)
overridevirtual

Starts cloud-based matchmaking for a session.

Parameters
LocalPlayersThe IDs of all local players that will participate in the match.
SessionNameThe name of the session to use.
NewSessionSettingsThe desired settings to match against or create with when forming new sessions. NumPrivateConnections needs to be zero.
SearchSettingsThe desired settings that the matched session will have.
Returns
Bool:
  • true: success
  • false: failure

◆ StartSession()

virtual bool StartSession ( FName  SessionName)
overridevirtual

Marks an online session as in progress (as opposed to being in lobby or pending).

Parameters
SessionNameThe name of session to change state for.
Returns
Bool:
  • true: success
  • false: failure

◆ Uninitialize()

bool Uninitialize ( )

Uninitializes the game module.

Returns
Always returns true.

◆ UpdateSession()

virtual bool UpdateSession ( FName  SessionName,
FOnlineSessionSettings &  UpdatedSessionSettings,
bool  bShouldRefreshOnlineData = true 
)
overridevirtual

Updates the localized settings/properties for the session in question.

Parameters
SessionNameThe name of the session to update.
UpdatedSessionSettingsThe object to update the session settings with.
bShouldRefreshOnlineDataWhether to submit the data to the backend or not.
Returns
Bool:
  • true: success
  • false: failure