This commit is contained in:
mordentral
2016-04-19 10:03:36 -04:00
parent fdfafcc845
commit 4fe9a9dc31
5 changed files with 32 additions and 8 deletions

View File

@@ -44,6 +44,18 @@ namespace EBlueprintResultSwitch
};
}
// This is to define server type searches
UENUM(BlueprintType)
namespace EBPServerPresenceSearchType
{
enum Type
{
AllServers,
ClientServersOnly,
DedicatedServersOnly
};
}
// Wanted this to be switchable in the editor
UENUM(BlueprintType)

View File

@@ -18,7 +18,7 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// Creates a session with the default online subsystem with advanced optional inputs
// Creates a session with the default online subsystem with advanced optional inputs, for dedicated servers leave UsePresence as false and set IsDedicatedServer to true. Dedicated servers don't use presence.
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);

View File

@@ -21,7 +21,7 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
// 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")
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, bool bSearchDedicated, const TArray<FSessionsSearchSetting> &Filters);
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, TEnumAsByte<EBPServerPresenceSearchType::Type> ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters);
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux::Type Comparator);
@@ -68,7 +68,7 @@ private:
bool bUseLAN;
// Whether or not to search for dedicated servers
bool bUseDedicated;
EBPServerPresenceSearchType::Type ServerSearchType;
// Maximum number of results to return
int MaxResults;

View File

@@ -60,13 +60,13 @@ bool UAdvancedFriendsLibrary::RequestSteamFriendInfo(APlayerController *PlayerCo
if (!PlayerController)
{
UE_LOG(AdvancedFriendsLog, Warning, TEXT("IsAFriend Had a bad Player Controller!"));
return nullptr;
return false;
}
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
{
UE_LOG(AdvancedFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
return nullptr;
return false;
}
if (SteamAPI_Init())

View File

@@ -14,7 +14,7 @@ UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FOb
{
}
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, const TArray<FSessionsSearchSetting> &Filters)
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, TEnumAsByte<EBPServerPresenceSearchType::Type> ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters)
{
UFindSessionsCallbackProxyAdvanced* Proxy = NewObject<UFindSessionsCallbackProxyAdvanced>();
Proxy->PlayerControllerWeakPtr = PlayerController;
@@ -22,7 +22,7 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess
Proxy->MaxResults = MaxResults;
Proxy->WorldContextObject = WorldContextObject;
Proxy->SearchSettings = Filters;
Procy->bUseDedicated = bUseDedicated;
Proxy->ServerSearchType = ServerTypeToSearch;
return Proxy;
}
@@ -46,9 +46,21 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
// Create temp filter variable, because I had to re-define a blueprint version of this, it is required.
FOnlineSearchSettingsEx tem;
if (!bUseDedicated)
switch (ServerSearchType)
{
case EBPServerPresenceSearchType::ClientServersOnly:
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
break;
case EBPServerPresenceSearchType::DedicatedServersOnly:
tem.Set(SEARCH_PRESENCE, false, EOnlineComparisonOp::Equals);
break;
case EBPServerPresenceSearchType::AllServers:
default:
break;
}
// Filter results