2019-12-27 07:44:07 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2019-06-07 11:22:52 -04:00
# pragma once
# include "CoreMinimal.h"
# include "Kismet/BlueprintFunctionLibrary.h"
# include "MultiUserClientStatics.generated.h"
/**
* BP copy of FConcertSessionClientInfo
* Holds info on a client connected through multi - user
*/
USTRUCT ( BlueprintType )
struct FMultiUserClientInfo
{
GENERATED_BODY ( )
/** Holds the display name of the user that owns this instance. */
UPROPERTY ( VisibleAnywhere , BlueprintReadOnly , Category = " Client Info " )
FGuid ClientEndpointId ;
/** Holds the display name of the user that owns this instance. */
UPROPERTY ( VisibleAnywhere , BlueprintReadOnly , Category = " Client Info " )
FString DisplayName ;
/** Holds the color of the user avatar in a session. */
UPROPERTY ( VisibleAnywhere , BlueprintReadOnly , Category = " Client Info " )
2021-10-06 14:16:46 -04:00
FLinearColor AvatarColor = FLinearColor ( 1.0f , 1.0f , 1.0f , 1.0f ) ;
2019-06-07 11:22:52 -04:00
/** Holds an array of tags that can be used for grouping and categorizing. */
UPROPERTY ( VisibleAnywhere , BlueprintReadOnly , AdvancedDisplay , Category = " Client Info " )
TArray < FName > Tags ;
} ;
2020-01-29 18:45:15 -05:00
/**
* Enum of the known Multi - User connection error , their value needs to match the internally returned error code .
* @ see FConcertConnectionError
*/
UENUM ( meta = ( ScriptName = " MultiUserConnectionErrorType " ) )
enum class EMultiUserConnectionError
{
None = 0 ,
Canceled = 1 ,
ConnectionAttemptAborted = 2 ,
ServerNotResponding = 3 ,
ServerError = 4 ,
WorkspaceValidationUnknown = 100 ,
SourceControlValidationUnknown = 110 ,
SourceControlValidationCanceled = 111 ,
SourceControlValidationError = 112 ,
DirtyPackageValidationError = 113 ,
} ;
USTRUCT ( BlueprintType )
struct FMultiUserConnectionError
{
GENERATED_BODY ( )
UPROPERTY ( BlueprintReadOnly , Category = " Connection Error " )
EMultiUserConnectionError ErrorCode = EMultiUserConnectionError : : None ;
UPROPERTY ( BlueprintReadOnly , Category = " Connection Error " )
FText ErrorMessage ;
} ;
UENUM ( BlueprintType )
enum class EMultiUserSourceValidationMode : uint8
{
/** Source control validation will fail on any changes when connecting to a Multi-User Session. */
Hard = 0 ,
/**
* Source control validation will warn and prompt on any changes when connecting to a Multi - User session .
* In Memory changes will be hot - reloaded .
* Source control changes aren ' t affected but will be stashed / shelved in the future .
*/
Soft ,
/** Soft validation mode with auto proceed on prompts. */
SoftAutoProceed
} ;
USTRUCT ( BlueprintType )
struct FMultiUserClientConfig
{
GENERATED_BODY ( )
UPROPERTY ( BlueprintReadWrite , Category = " Client Settings " )
FString DefaultServerURL ;
UPROPERTY ( BlueprintReadWrite , Category = " Client Settings " )
FString DefaultSessionName ;
UPROPERTY ( BlueprintReadWrite , Category = " Client Settings " )
FString DefaultSessionToRestore ;
UPROPERTY ( BlueprintReadWrite , Category = " Source Control Settings " )
2021-10-06 14:16:46 -04:00
EMultiUserSourceValidationMode ValidationMode = EMultiUserSourceValidationMode : : Hard ;
2020-01-29 18:45:15 -05:00
} ;
/** Connection status for Multi-User client sessions */
UENUM ( BlueprintType )
enum class EMultiUserConnectionStatus : uint8
{
/** Currently establishing connection to the server session */
Connecting ,
/** Connection established and alive */
Connected ,
/** Currently severing connection to the server session gracefully */
Disconnecting ,
/** Disconnected */
Disconnected ,
} ;
2019-06-07 11:22:52 -04:00
UCLASS ( )
class MULTIUSERCLIENTLIBRARY_API UMultiUserClientStatics : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY ( )
public :
/** Set whether presence is currently enabled and should be shown (unless hidden by other settings) */
2019-10-31 13:48:30 -04:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Presence " , meta = ( DevelopmentOnly , DisplayName = " Set Multi-User Presence Enabled " ) )
2019-06-07 11:22:52 -04:00
static void SetMultiUserPresenceEnabled ( const bool IsEnabled = true ) ;
/** Set Presence Actor Visibility by display name */
2019-10-31 13:48:30 -04:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Presence " , meta = ( DevelopmentOnly , DisplayName = " Set Multi-User Presence Visibility " ) )
2019-06-07 11:22:52 -04:00
static void SetMultiUserPresenceVisibility ( const FString & Name , bool Visibility , bool PropagateToAll = false ) ;
/** Set Presence Actor Visibility by client id */
2019-10-31 13:48:30 -04:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Presence " , meta = ( DevelopmentOnly , DisplayName = " Set Multi-User Presence Visibility By Id " ) )
2019-06-07 11:22:52 -04:00
static void SetMultiUserPresenceVisibilityById ( const FGuid & ClientEndpointId , bool Visibility , bool PropagateToAll = false ) ;
/** Get the Presence Actor transform for the specified client endpoint id or identity if the client isn't found */
2019-10-31 13:48:30 -04:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Presence " , meta = ( DevelopmentOnly , DisplayName = " Get Multi-User Presence Transform " ) )
2019-06-07 11:22:52 -04:00
static FTransform GetMultiUserPresenceTransform ( const FGuid & ClientEndpointId ) ;
2019-10-31 13:48:30 -04:00
/** Teleport to another Multi-User user's presence. */
2020-01-29 18:45:15 -05:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Presence " , meta = ( DevelopmentOnly , DisplayName = " Jump to Multi-User Presence " ) )
2019-06-07 11:22:52 -04:00
static void JumpToMultiUserPresence ( const FString & OtherUserName , FTransform TransformOffset ) ;
2019-10-31 13:48:30 -04:00
/** Update Multi-User Workspace Modified Packages to be in sync for source control submission. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Source Control " , meta = ( DevelopmentOnly , DeprecatedFunction , DeprecationMessage = " UpdateWorkspaceModifiedPackages is deprecated. Please use PersistMultiUserSessionChanges instead. " ) )
2019-06-07 11:22:52 -04:00
static void UpdateWorkspaceModifiedPackages ( ) ;
/** Persist the session changes and prepare the files for source control submission. */
2019-10-31 13:48:30 -04:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Source Control " , meta = ( DevelopmentOnly , DisplayName = " Persist Multi-User Session Changes " ) )
2019-06-07 11:22:52 -04:00
static void PersistMultiUserSessionChanges ( ) ;
/** Get the local ClientInfo. Works when not connected to a session. */
2019-10-31 13:48:30 -04:00
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Get Local Multi-User Client Info " ) )
2019-06-07 11:22:52 -04:00
static FMultiUserClientInfo GetLocalMultiUserClientInfo ( ) ;
2019-10-31 13:48:30 -04:00
/** Get the ClientInfo for any Multi-User participant by name. The local user is found even when not connected to a session. Returns false is no client was found. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Get Multi-User Client Info by Name " ) )
2019-06-07 11:22:52 -04:00
static bool GetMultiUserClientInfoByName ( const FString & ClientName , FMultiUserClientInfo & ClientInfo ) ;
2019-10-31 13:48:30 -04:00
/** Get ClientInfos of current Multi-User participants except for the local user. Returns false is no remote clients were found. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Get Remote Multi-User Client Infos " ) )
2019-06-07 11:22:52 -04:00
static bool GetRemoteMultiUserClientInfos ( TArray < FMultiUserClientInfo > & ClientInfos ) ;
2020-01-29 18:45:15 -05:00
/** Configure the Multi-User client. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Configure Multi-User Client " ) )
static bool ConfigureMultiUserClient ( const FMultiUserClientConfig & ClientConfig ) ;
2019-06-07 11:22:52 -04:00
2020-01-29 18:45:15 -05:00
/** Start the Multi-User default connection process. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Start Multi-User Default Connection " ) )
static bool StartMultiUserDefaultConnection ( ) ;
/** Get the last Multi-User connection error that happened, if any */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Get Last Multi-User Connection Error " ) )
static FMultiUserConnectionError GetLastMultiUserConnectionError ( ) ;
/** Get Multi-User connection status. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DisplayName = " Get Multi-User Connection Status Detail " ) )
static EMultiUserConnectionStatus GetMultiUserConnectionStatusDetail ( ) ;
/** Get Multi-User connection status. */
UFUNCTION ( BlueprintCallable , Category = " Multi-User Client " , meta = ( DevelopmentOnly , DeprecatedFunction , DeprecationMessage = " 'Get Multi-User Connection Status' is deprecated. Please use 'Get Multi-User Connection Status Detail' instead. " , DisplayName = " Get Multi-User Connection Status " ) )
static bool GetMultiUserConnectionStatus ( ) ;
2019-06-07 11:22:52 -04:00
} ;