From 141b15c4e4fb65ad233df52400c9b92f124da4c7 Mon Sep 17 00:00:00 2001 From: Joshua Date: Wed, 26 Jul 2023 08:53:01 -0400 Subject: [PATCH] update session add advertisement --- .../UpdateSessionCallbackProxyAdvanced.h | 18 ++++++++++-------- .../UpdateSessionCallbackProxyAdvanced.cpp | 5 +++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h b/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h index a8a68b6..bd549a9 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h +++ b/AdvancedSessions/Source/AdvancedSessions/Classes/UpdateSessionCallbackProxyAdvanced.h @@ -21,7 +21,7 @@ class UUpdateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase // Creates a session with the default online subsystem with advanced optional inputs, you MUST fill in all categories or it will pass in values that you didn't want as default values UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions") - static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray &ExtraSettings, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = false, bool bAllowJoinInProgress = false, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false); + static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray &ExtraSettings, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = false, bool bAllowJoinInProgress = false, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false, bool bShouldAdvertise = true); // UOnlineBlueprintCallProxyBase interface virtual void Activate() override; @@ -38,28 +38,30 @@ private: FDelegateHandle OnUpdateSessionCompleteDelegateHandle; // Number of public connections - int NumPublicConnections; + int NumPublicConnections = 100; // Number of private connections - int NumPrivateConnections; + int NumPrivateConnections = 0; // Whether or not to search LAN - bool bUseLAN; + bool bUseLAN = false; // Whether or not to allow invites - bool bAllowInvites; + bool bAllowInvites = true; // Store extra settings TArray ExtraSettings; // Whether to update the online data - bool bRefreshOnlineData; + bool bRefreshOnlineData = true; // Allow joining in progress - bool bAllowJoinInProgress; + bool bAllowJoinInProgress = true; // Update whether this is a dedicated server or not - bool bDedicatedServer; + bool bDedicatedServer = false; + + bool bShouldAdvertise = true; // The world context object in which this call is taking place UObject* WorldContextObject; diff --git a/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp b/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp index 0155c64..7fa1ea0 100644 --- a/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp +++ b/AdvancedSessions/Source/AdvancedSessions/Private/UpdateSessionCallbackProxyAdvanced.cpp @@ -12,7 +12,7 @@ UUpdateSessionCallbackProxyAdvanced::UUpdateSessionCallbackProxyAdvanced(const F { } -UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer) +UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise) { UUpdateSessionCallbackProxyAdvanced* Proxy = NewObject(); Proxy->NumPublicConnections = PublicConnections; @@ -24,6 +24,7 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update Proxy->bRefreshOnlineData = bRefreshOnlineData; Proxy->bAllowJoinInProgress = bAllowJoinInProgress; Proxy->bDedicatedServer = bIsDedicatedServer; + Proxy->bShouldAdvertise = bShouldAdvertise; return Proxy; } @@ -60,7 +61,7 @@ void UUpdateSessionCallbackProxyAdvanced::Activate() //Settings->BuildUniqueId = GetBuildUniqueId(); Settings->NumPublicConnections = NumPublicConnections; Settings->NumPrivateConnections = NumPrivateConnections; - //Settings->bShouldAdvertise = true; + Settings->bShouldAdvertise = bShouldAdvertise; Settings->bAllowJoinInProgress = bAllowJoinInProgress; Settings->bIsLANMatch = bUseLAN; //Settings->bUsesPresence = true;