From 816b701963638a9c8307a398ebe07e87aeb855b4 Mon Sep 17 00:00:00 2001 From: Joshua Date: Tue, 24 Aug 2021 09:22:34 -0400 Subject: [PATCH] add lobby search to find add lobby search to find --- .../FindSessionsCallbackProxyAdvanced.h | 5 ++++- .../FindSessionsCallbackProxyAdvanced.cpp | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h b/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h index c48994a..713b7c6 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/FindSessionsCallbackProxyAdvanced.h @@ -22,7 +22,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, EBPServerPresenceSearchType ServerTypeToSearch, const TArray &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 &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); @@ -92,6 +92,9 @@ private: // Search for secure servers only bool bSecureServersOnly; + // Search through lobbies + bool bSearchLobbies; + // Min slots requires to search int MinSlotsAvailable; diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp index 3f62d81..ff6944c 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/FindSessionsCallbackProxyAdvanced.cpp @@ -15,7 +15,7 @@ UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FOb bIsOnSecondSearch = false; } -UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray &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 &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, bool bSearchLobbies, int MinSlotsAvailable) { UFindSessionsCallbackProxyAdvanced* Proxy = NewObject(); Proxy->PlayerControllerWeakPtr = PlayerController; @@ -27,6 +27,7 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess Proxy->bEmptyServersOnly = bEmptyServersOnly, Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly; Proxy->bSecureServersOnly = bSecureServersOnly; + Proxy->bSearchLobbies = bSearchLobbies; Proxy->MinSlotsAvailable = MinSlotsAvailable; return Proxy; } @@ -73,6 +74,17 @@ void UFindSessionsCallbackProxyAdvanced::Activate() #define SEARCH_USER FName(TEXT("SEARCHUSER")) // Keywords to match in session search #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) tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals); @@ -86,8 +98,6 @@ void UFindSessionsCallbackProxyAdvanced::Activate() if (MinSlotsAvailable != 0) tem.Set(SEARCH_MINSLOTSAVAILABLE, MinSlotsAvailable, EOnlineComparisonOp::GreaterThanEquals); - - // Filter results if (SearchSettings.Num() > 0) { @@ -104,6 +114,9 @@ void UFindSessionsCallbackProxyAdvanced::Activate() case EBPServerPresenceSearchType::ClientServersOnly: { tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals); + + if (bSearchLobbies) + tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals); } break;