mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-23 16:34:07 +00:00
Merge branch 'master' into UE5-Prerelease
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
"FileVersion" : 3,
|
"FileVersion" : 3,
|
||||||
|
|
||||||
"FriendlyName" : "Advanced Sessions",
|
"FriendlyName" : "Advanced Sessions",
|
||||||
"Version" : 4.26,
|
"Version" : 4.27,
|
||||||
"VersionName": "4.26",
|
"VersionName": "4.27",
|
||||||
"Description" : "Adds new blueprint functions to handle more advanced session operations.",
|
"Description" : "Adds new blueprint functions to handle more advanced session operations.",
|
||||||
"Category" : "Advanced Sessions Plugin",
|
"Category" : "Advanced Sessions Plugin",
|
||||||
"CreatedBy" : "Joshua Statzer",
|
"CreatedBy" : "Joshua Statzer",
|
||||||
|
@@ -0,0 +1,55 @@
|
|||||||
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "BlueprintDataDefinitions.h"
|
||||||
|
#include "Interfaces/OnlineIdentityInterface.h"
|
||||||
|
#include "Engine/LocalPlayer.h"
|
||||||
|
#include "AutoLoginUserCallbackProxy.generated.h"
|
||||||
|
|
||||||
|
UCLASS(MinimalAPI)
|
||||||
|
class UAutoLoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase
|
||||||
|
{
|
||||||
|
GENERATED_UCLASS_BODY()
|
||||||
|
|
||||||
|
// Called when there is a successful destroy
|
||||||
|
UPROPERTY(BlueprintAssignable)
|
||||||
|
FEmptyOnlineDelegate OnSuccess;
|
||||||
|
|
||||||
|
// Called when there is an unsuccessful destroy
|
||||||
|
UPROPERTY(BlueprintAssignable)
|
||||||
|
FEmptyOnlineDelegate OnFailure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs the player into the online service using parameters passed on the
|
||||||
|
* command line. Expects -AUTH_LOGIN=<UserName> -AUTH_PASSWORD=<password>. If either
|
||||||
|
* are missing, the function returns false and doesn't start the login
|
||||||
|
* process
|
||||||
|
*
|
||||||
|
* @param LocalUserNum the controller number of the associated user
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
|
||||||
|
static UAutoLoginUserCallbackProxy* AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum);
|
||||||
|
|
||||||
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
|
virtual void Activate() override;
|
||||||
|
// End of UOnlineBlueprintCallProxyBase interface
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Internal callback when the operation completes, calls out to the public success/failure callbacks
|
||||||
|
void OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// The controller number of the associated user
|
||||||
|
int32 LocalUserNumber;
|
||||||
|
|
||||||
|
// The delegate executed by the online subsystem
|
||||||
|
FOnLoginCompleteDelegate Delegate;
|
||||||
|
|
||||||
|
// Handle to the registered OnDestroySessionComplete delegate
|
||||||
|
FDelegateHandle DelegateHandle;
|
||||||
|
|
||||||
|
// The world context object in which this call is taking place
|
||||||
|
UObject* WorldContextObject;
|
||||||
|
};
|
@@ -264,10 +264,18 @@ public:
|
|||||||
EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline;
|
EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
FString StatusString;
|
FString StatusString;
|
||||||
|
|
||||||
|
FBPFriendPresenceInfo()
|
||||||
|
{
|
||||||
|
bIsOnline = false;
|
||||||
|
bIsPlaying = false;
|
||||||
|
bIsPlayingThisGame = false;
|
||||||
|
bIsJoinable = false;
|
||||||
|
bHasVoiceSupport = false;
|
||||||
|
PresenceState = EBPOnlinePresenceState::Offline;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
struct FBPFriendInfo
|
struct FBPFriendInfo
|
||||||
{
|
{
|
||||||
@@ -287,8 +295,15 @@ public:
|
|||||||
bool bIsPlayingSameGame = false;
|
bool bIsPlayingSameGame = false;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
|
||||||
FBPFriendPresenceInfo PresenceInfo;
|
FBPFriendPresenceInfo PresenceInfo;
|
||||||
|
|
||||||
|
FBPFriendInfo()
|
||||||
|
{
|
||||||
|
OnlineState = EBPOnlinePresenceState::Offline;
|
||||||
|
bIsPlayingSameGame = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** The types of comparison operations for a given search query */
|
/** The types of comparison operations for a given search query */
|
||||||
// Used to compare session properties
|
// Used to compare session properties
|
||||||
UENUM(BlueprintType)
|
UENUM(BlueprintType)
|
||||||
|
@@ -24,10 +24,12 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||||||
* @param PublicConnections When doing a 'listen' server, this must be >=2 (ListenServer itself counts as a connection)
|
* @param PublicConnections When doing a 'listen' server, this must be >=2 (ListenServer itself counts as a connection)
|
||||||
* @param bUseLAN When you want to play LAN, the level to play on must be loaded with option 'bIsLanMatch'
|
* @param bUseLAN When you want to play LAN, the level to play on must be loaded with option 'bIsLanMatch'
|
||||||
* @param bUsePresence Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
|
* @param bUsePresence Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
|
||||||
|
* @param bUseLobbiesIfAvailable Used to flag the subsystem to use a lobby api instead of general hosting if the API supports it, generally true on steam for listen servers and false for dedicated
|
||||||
* @param bShouldAdvertise Set to true when the OnlineSubsystem should list your server when someone is searching for servers. Otherwise the server is hidden and only join via invite is possible.
|
* @param bShouldAdvertise Set to true when the OnlineSubsystem should list your server when someone is searching for servers. Otherwise the server is hidden and only join via invite is possible.
|
||||||
|
* @param bUseLobbiesVoiceChatIfAvailable Set to true to setup voice chat lobbies if the API supports it
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
||||||
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true);
|
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false);
|
||||||
|
|
||||||
// UOnlineBlueprintCallProxyBase interface
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
@@ -71,6 +73,9 @@ private:
|
|||||||
// Whether to use the presence option
|
// Whether to use the presence option
|
||||||
bool bUsePresence;
|
bool bUsePresence;
|
||||||
|
|
||||||
|
// Whether to prefer the use of lobbies for hosting if the api supports them
|
||||||
|
bool bUseLobbiesIfAvailable;
|
||||||
|
|
||||||
// Whether to allow joining via presence
|
// Whether to allow joining via presence
|
||||||
bool bAllowJoinViaPresence;
|
bool bAllowJoinViaPresence;
|
||||||
|
|
||||||
@@ -86,6 +91,9 @@ private:
|
|||||||
// Should advertise server?
|
// Should advertise server?
|
||||||
bool bShouldAdvertise;
|
bool bShouldAdvertise;
|
||||||
|
|
||||||
|
// Whether to prefer the use of voice chat lobbies if the api supports them
|
||||||
|
bool bUseLobbiesVoiceChatIfAvailable;
|
||||||
|
|
||||||
// Store extra settings
|
// Store extra settings
|
||||||
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
TArray<FSessionPropertyKeyPair> ExtraSettings;
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||||||
|
|
||||||
// Searches for advertised sessions with the default online subsystem and includes an array of filters
|
// Searches for advertised sessions with the default online subsystem and includes an array of filters
|
||||||
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm="Filters"), Category = "Online|AdvancedSessions")
|
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm="Filters"), Category = "Online|AdvancedSessions")
|
||||||
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, int MinSlotsAvailable = 0);
|
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, bool bSearchLobbies = true, int MinSlotsAvailable = 0);
|
||||||
|
|
||||||
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux Comparator);
|
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux Comparator);
|
||||||
|
|
||||||
@@ -92,6 +92,9 @@ private:
|
|||||||
// Search for secure servers only
|
// Search for secure servers only
|
||||||
bool bSecureServersOnly;
|
bool bSecureServersOnly;
|
||||||
|
|
||||||
|
// Search through lobbies
|
||||||
|
bool bSearchLobbies;
|
||||||
|
|
||||||
// Min slots requires to search
|
// Min slots requires to search
|
||||||
int MinSlotsAvailable;
|
int MinSlotsAvailable;
|
||||||
|
|
||||||
|
@@ -21,8 +21,8 @@ class ULoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase
|
|||||||
FEmptyOnlineDelegate OnFailure;
|
FEmptyOnlineDelegate OnFailure;
|
||||||
|
|
||||||
// Logs into the identity interface
|
// Logs into the identity interface
|
||||||
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
|
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject", AdvancedDisplay = "Type"), Category = "Online|AdvancedIdentity")
|
||||||
static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken);
|
static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString Type);
|
||||||
|
|
||||||
// UOnlineBlueprintCallProxyBase interface
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
@@ -42,6 +42,8 @@ private:
|
|||||||
// The user pass / token
|
// The user pass / token
|
||||||
FString UserToken;
|
FString UserToken;
|
||||||
|
|
||||||
|
FString Type;
|
||||||
|
|
||||||
// The delegate executed by the online subsystem
|
// The delegate executed by the online subsystem
|
||||||
FOnLoginCompleteDelegate Delegate;
|
FOnLoginCompleteDelegate Delegate;
|
||||||
|
|
||||||
|
@@ -0,0 +1,55 @@
|
|||||||
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
|
#include "AutoLoginUserCallbackProxy.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// ULoginUserCallbackProxy
|
||||||
|
|
||||||
|
UAutoLoginUserCallbackProxy::UAutoLoginUserCallbackProxy(const FObjectInitializer& ObjectInitializer)
|
||||||
|
: Super(ObjectInitializer)
|
||||||
|
, Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
UAutoLoginUserCallbackProxy* UAutoLoginUserCallbackProxy::AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum)
|
||||||
|
{
|
||||||
|
UAutoLoginUserCallbackProxy* Proxy = NewObject<UAutoLoginUserCallbackProxy>();
|
||||||
|
Proxy->LocalUserNumber = LocalUserNum;
|
||||||
|
Proxy->WorldContextObject = WorldContextObject;
|
||||||
|
return Proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAutoLoginUserCallbackProxy::Activate()
|
||||||
|
{
|
||||||
|
auto Identity = Online::GetIdentityInterface();
|
||||||
|
|
||||||
|
if (Identity.IsValid())
|
||||||
|
{
|
||||||
|
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(LocalUserNumber, Delegate);
|
||||||
|
Identity->AutoLogin(LocalUserNumber);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fail immediately
|
||||||
|
OnFailure.Broadcast();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal)
|
||||||
|
{
|
||||||
|
auto Identity = Online::GetIdentityInterface();
|
||||||
|
|
||||||
|
if (Identity.IsValid())
|
||||||
|
{
|
||||||
|
Identity->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, DelegateHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bWasSuccessful)
|
||||||
|
{
|
||||||
|
OnSuccess.Broadcast();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OnFailure.Broadcast();
|
||||||
|
}
|
||||||
|
}
|
@@ -13,7 +13,7 @@ UCreateSessionCallbackProxyAdvanced::UCreateSessionCallbackProxyAdvanced(const F
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, bool bUsePresence, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise)
|
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, bool bUsePresence, bool bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable)
|
||||||
{
|
{
|
||||||
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
||||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||||
@@ -25,11 +25,13 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create
|
|||||||
Proxy->ExtraSettings = ExtraSettings;
|
Proxy->ExtraSettings = ExtraSettings;
|
||||||
Proxy->bDedicatedServer = bIsDedicatedServer;
|
Proxy->bDedicatedServer = bIsDedicatedServer;
|
||||||
Proxy->bUsePresence = bUsePresence;
|
Proxy->bUsePresence = bUsePresence;
|
||||||
|
Proxy->bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||||
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||||
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||||
Proxy->bAntiCheatProtected = bAntiCheatProtected;
|
Proxy->bAntiCheatProtected = bAntiCheatProtected;
|
||||||
Proxy->bUsesStats = bUsesStats;
|
Proxy->bUsesStats = bUsesStats;
|
||||||
Proxy->bShouldAdvertise = bShouldAdvertise;
|
Proxy->bShouldAdvertise = bShouldAdvertise;
|
||||||
|
Proxy->bUseLobbiesVoiceChatIfAvailable = bUseLobbiesVoiceChatIfAvailable;
|
||||||
return Proxy;
|
return Proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +59,17 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
Settings.bIsDedicated = bDedicatedServer;
|
Settings.bIsDedicated = bDedicatedServer;
|
||||||
|
|
||||||
if (bDedicatedServer)
|
if (bDedicatedServer)
|
||||||
|
{
|
||||||
Settings.bUsesPresence = false;
|
Settings.bUsesPresence = false;
|
||||||
|
Settings.bUseLobbiesIfAvailable = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Settings.bUsesPresence = bUsePresence;
|
Settings.bUsesPresence = bUsePresence;
|
||||||
|
Settings.bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings.bUseLobbiesVoiceChatIfAvailable = bUseLobbiesIfAvailable ? bUseLobbiesVoiceChatIfAvailable : false;
|
||||||
Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||||
Settings.bAntiCheatProtected = bAntiCheatProtected;
|
Settings.bAntiCheatProtected = bAntiCheatProtected;
|
||||||
Settings.bUsesStats = bUsesStats;
|
Settings.bUsesStats = bUsesStats;
|
||||||
|
@@ -15,7 +15,7 @@ UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FOb
|
|||||||
bIsOnSecondSearch = false;
|
bIsOnSecondSearch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, int MinSlotsAvailable)
|
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, bool bSearchLobbies, int MinSlotsAvailable)
|
||||||
{
|
{
|
||||||
UFindSessionsCallbackProxyAdvanced* Proxy = NewObject<UFindSessionsCallbackProxyAdvanced>();
|
UFindSessionsCallbackProxyAdvanced* Proxy = NewObject<UFindSessionsCallbackProxyAdvanced>();
|
||||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||||
@@ -27,6 +27,7 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess
|
|||||||
Proxy->bEmptyServersOnly = bEmptyServersOnly,
|
Proxy->bEmptyServersOnly = bEmptyServersOnly,
|
||||||
Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly;
|
Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly;
|
||||||
Proxy->bSecureServersOnly = bSecureServersOnly;
|
Proxy->bSecureServersOnly = bSecureServersOnly;
|
||||||
|
Proxy->bSearchLobbies = bSearchLobbies;
|
||||||
Proxy->MinSlotsAvailable = MinSlotsAvailable;
|
Proxy->MinSlotsAvailable = MinSlotsAvailable;
|
||||||
return Proxy;
|
return Proxy;
|
||||||
}
|
}
|
||||||
@@ -73,6 +74,17 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||||||
#define SEARCH_USER FName(TEXT("SEARCHUSER"))
|
#define SEARCH_USER FName(TEXT("SEARCHUSER"))
|
||||||
// Keywords to match in session search
|
// Keywords to match in session search
|
||||||
#define SEARCH_KEYWORDS FName(TEXT("SEARCHKEYWORDS"))*/
|
#define SEARCH_KEYWORDS FName(TEXT("SEARCHKEYWORDS"))*/
|
||||||
|
/** Keywords to match in session search */
|
||||||
|
/** The matchmaking queue name to matchmake in, e.g. "TeamDeathmatch" (value is string) */
|
||||||
|
/** #define SEARCH_MATCHMAKING_QUEUE FName(TEXT("MATCHMAKINGQUEUE"))*/
|
||||||
|
/** If set, use the named Xbox Live hopper to find a session via matchmaking (value is a string) */
|
||||||
|
/** #define SEARCH_XBOX_LIVE_HOPPER_NAME FName(TEXT("LIVEHOPPERNAME"))*/
|
||||||
|
/** Which session template from the service configuration to use */
|
||||||
|
/** #define SEARCH_XBOX_LIVE_SESSION_TEMPLATE_NAME FName(TEXT("LIVESESSIONTEMPLATE"))*/
|
||||||
|
/** Selection method used to determine which match to join when multiple are returned (valid only on Switch) */
|
||||||
|
/** #define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))*/
|
||||||
|
/** Whether to use lobbies vs sessions */
|
||||||
|
/** #define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))*/
|
||||||
|
|
||||||
if (bEmptyServersOnly)
|
if (bEmptyServersOnly)
|
||||||
tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals);
|
tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals);
|
||||||
@@ -86,8 +98,6 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||||||
if (MinSlotsAvailable != 0)
|
if (MinSlotsAvailable != 0)
|
||||||
tem.Set(SEARCH_MINSLOTSAVAILABLE, MinSlotsAvailable, EOnlineComparisonOp::GreaterThanEquals);
|
tem.Set(SEARCH_MINSLOTSAVAILABLE, MinSlotsAvailable, EOnlineComparisonOp::GreaterThanEquals);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Filter results
|
// Filter results
|
||||||
if (SearchSettings.Num() > 0)
|
if (SearchSettings.Num() > 0)
|
||||||
{
|
{
|
||||||
@@ -104,6 +114,9 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||||||
case EBPServerPresenceSearchType::ClientServersOnly:
|
case EBPServerPresenceSearchType::ClientServersOnly:
|
||||||
{
|
{
|
||||||
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
|
||||||
|
|
||||||
|
if (bSearchLobbies)
|
||||||
|
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -12,12 +12,13 @@ ULoginUserCallbackProxy::ULoginUserCallbackProxy(const FObjectInitializer& Objec
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ULoginUserCallbackProxy* ULoginUserCallbackProxy::LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken)
|
ULoginUserCallbackProxy* ULoginUserCallbackProxy::LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString Type)
|
||||||
{
|
{
|
||||||
ULoginUserCallbackProxy* Proxy = NewObject<ULoginUserCallbackProxy>();
|
ULoginUserCallbackProxy* Proxy = NewObject<ULoginUserCallbackProxy>();
|
||||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||||
Proxy->UserID = UserID;
|
Proxy->UserID = UserID;
|
||||||
Proxy->UserToken = UserToken;
|
Proxy->UserToken = UserToken;
|
||||||
|
Proxy->Type = Type;
|
||||||
Proxy->WorldContextObject = WorldContextObject;
|
Proxy->WorldContextObject = WorldContextObject;
|
||||||
return Proxy;
|
return Proxy;
|
||||||
}
|
}
|
||||||
@@ -43,8 +44,13 @@ void ULoginUserCallbackProxy::Activate()
|
|||||||
|
|
||||||
if (Identity.IsValid())
|
if (Identity.IsValid())
|
||||||
{
|
{
|
||||||
|
// Fallback to default AuthType if nothing is specified
|
||||||
|
if (Type.IsEmpty())
|
||||||
|
{
|
||||||
|
Type = Identity->GetAuthType();
|
||||||
|
}
|
||||||
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(Player->GetControllerId(), Delegate);
|
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(Player->GetControllerId(), Delegate);
|
||||||
FOnlineAccountCredentials AccountCreds(Identity->GetAuthType(), UserID, UserToken);
|
FOnlineAccountCredentials AccountCreds(Type, UserID, UserToken);
|
||||||
Identity->Login(Player->GetControllerId(), AccountCreds);
|
Identity->Login(Player->GetControllerId(), AccountCreds);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -29,9 +29,11 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update
|
|||||||
|
|
||||||
void UUpdateSessionCallbackProxyAdvanced::Activate()
|
void UUpdateSessionCallbackProxyAdvanced::Activate()
|
||||||
{
|
{
|
||||||
|
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("UpdateSession"), GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull));
|
||||||
|
|
||||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
if (Helper.OnlineSub != nullptr)
|
||||||
|
{
|
||||||
|
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
{
|
{
|
||||||
if (Sessions->GetNumSessions() < 1)
|
if (Sessions->GetNumSessions() < 1)
|
||||||
@@ -94,6 +96,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||||||
{
|
{
|
||||||
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
|
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Fail immediately
|
// Fail immediately
|
||||||
OnFailure.Broadcast();
|
OnFailure.Broadcast();
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Sessions not supported"));
|
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Sessions not supported"));
|
||||||
@@ -101,7 +104,11 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||||||
|
|
||||||
void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful)
|
void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful)
|
||||||
{
|
{
|
||||||
IOnlineSessionPtr Sessions = Online::GetSessionInterface(GetWorld());
|
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("UpdateSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull));
|
||||||
|
|
||||||
|
if (Helper.OnlineSub != nullptr)
|
||||||
|
{
|
||||||
|
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
|
||||||
if (Sessions.IsValid())
|
if (Sessions.IsValid())
|
||||||
{
|
{
|
||||||
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
|
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
|
||||||
@@ -112,6 +119,7 @@ void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, b
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!bWasSuccessful)
|
if (!bWasSuccessful)
|
||||||
{
|
{
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
"FileVersion" : 3,
|
"FileVersion" : 3,
|
||||||
|
|
||||||
"FriendlyName" : "Advanced Steam Sessions",
|
"FriendlyName" : "Advanced Steam Sessions",
|
||||||
"Version" : 4.26,
|
"Version" : 4.27,
|
||||||
"VersionName": "4.26",
|
"VersionName": "4.27",
|
||||||
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
|
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
|
||||||
"Category" : "Advanced Sessions Plugin",
|
"Category" : "Advanced Sessions Plugin",
|
||||||
"CreatedBy" : "Joshua Statzer",
|
"CreatedBy" : "Joshua Statzer",
|
||||||
|
@@ -305,6 +305,19 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UENUM(Blueprintable)
|
||||||
|
enum class EBPTextFilteringContext : uint8
|
||||||
|
{
|
||||||
|
/*Unknown context.*/
|
||||||
|
FContext_Unknown = 0,
|
||||||
|
/*Game content, only legally required filtering is performed.*/
|
||||||
|
FContext_GameContent = 1,
|
||||||
|
/*Char from another player.*/
|
||||||
|
FContext_Chat = 2,
|
||||||
|
/*Character or item name.*/
|
||||||
|
FContext_Name = 3
|
||||||
|
};
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary
|
class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary
|
||||||
{
|
{
|
||||||
@@ -325,6 +338,10 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
||||||
|
|
||||||
|
// Returns if the steam overlay is currently active (this can return false during initial overlay hooking)
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
|
static bool IsOverlayEnabled();
|
||||||
|
|
||||||
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
|
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
|
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
|
||||||
@@ -350,4 +367,21 @@ public:
|
|||||||
// Get a full list of steam groups
|
// Get a full list of steam groups
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|SteamGroups")
|
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|SteamGroups")
|
||||||
static void GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups);
|
static void GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups);
|
||||||
|
|
||||||
|
// Initializes text filtering (pre-loading dictonaries)
|
||||||
|
// Returns if it succeeded, false if filtering is unavailable for the games language
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
|
||||||
|
static bool InitTextFiltering();
|
||||||
|
|
||||||
|
// Attempts to filter a string with the given filtering context
|
||||||
|
// Returns true if the text has been filtered, false if it hasn't (no filtering required or operation failed)
|
||||||
|
// If false it will still output the original text
|
||||||
|
// Textsource is the steam id that is the source of the text (player name / chat)
|
||||||
|
// Requires that InitTextFiltering be called first!!
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
|
||||||
|
static bool FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText);
|
||||||
|
|
||||||
|
// Returns if steam is running in big picture mode
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|SteamAPI")
|
||||||
|
static bool IsSteamInBigPictureMode();
|
||||||
};
|
};
|
||||||
|
@@ -255,6 +255,19 @@ bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId Uni
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::IsOverlayEnabled()
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
return SteamUtils()->IsOverlayEnabled();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
|
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
|
||||||
{
|
{
|
||||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
@@ -351,3 +364,76 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN
|
|||||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::InitTextFiltering()
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
return SteamUtils()->InitFilterText();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText)
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
uint32 BufferLen = TextToFilter.Len() + 10; // Docs say 1 byte excess min, going with 10
|
||||||
|
char* OutText = new char[BufferLen];
|
||||||
|
|
||||||
|
uint64 id = 0;
|
||||||
|
|
||||||
|
if (TextSourceID.IsValid())
|
||||||
|
{
|
||||||
|
id = *((uint64*)TextSourceID.UniqueNetId->GetBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
// MAC is bugged with current steam version according to epic, they forced it to be the old steam ver
|
||||||
|
#if PLATFORM_MAC
|
||||||
|
// Filters the provided input message and places the filtered result into pchOutFilteredText.
|
||||||
|
// pchOutFilteredText is where the output will be placed, even if no filtering or censoring is performed
|
||||||
|
// nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText
|
||||||
|
// pchInputText is the input string that should be filtered, which can be ASCII or UTF-8
|
||||||
|
// bLegalOnly should be false if you want profanity and legally required filtering (where required) and true if you want legally required filtering only
|
||||||
|
// Returns the number of characters (not bytes) filtered.
|
||||||
|
int FilterCount = SteamUtils()->FilterText(OutText, BufferLen, TCHAR_TO_ANSI(*TextToFilter), Context == EBPTextFilteringContext::FContext_GameContent);
|
||||||
|
#else
|
||||||
|
int FilterCount = SteamUtils()->FilterText((ETextFilteringContext)Context, id, TCHAR_TO_ANSI(*TextToFilter), OutText, BufferLen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (FilterCount > 0)
|
||||||
|
{
|
||||||
|
FilteredText = FString(UTF8_TO_TCHAR(OutText));
|
||||||
|
delete[] OutText;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] OutText;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FilteredText = TextToFilter;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UAdvancedSteamFriendsLibrary::IsSteamInBigPictureMode()
|
||||||
|
{
|
||||||
|
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||||
|
|
||||||
|
if (SteamAPI_Init())
|
||||||
|
{
|
||||||
|
return SteamUtils()->IsSteamInBigPictureMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
Reference in New Issue
Block a user