Update Steam Sessions Plugin
This commit is contained in:
parent
d66513930c
commit
c59497c620
@ -23,14 +23,14 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
|
|||||||
* 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.
|
* 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.
|
||||||
* @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 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 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
|
||||||
|
* Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
|
||||||
* @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
|
* @param bUseLobbiesVoiceChatIfAvailable Set to true to setup voice chat lobbies if the API supports it
|
||||||
* @param bStartAfterCreate Set to true to start the session after it's created. If false you need to manually call StartSession when ready.
|
* @param bStartAfterCreate Set to true to start the session after it's created. If false you need to manually call StartSession when ready.
|
||||||
*/
|
*/
|
||||||
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 bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false, bool bStartAfterCreate = 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, bool bStartAfterCreate = true);
|
||||||
|
|
||||||
// UOnlineBlueprintCallProxyBase interface
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
|
@ -29,8 +29,19 @@ void UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted(const bool bWasSu
|
|||||||
OnJoinSessionCompleteDelegateHandle = SessionInterface->AddOnJoinSessionCompleteDelegate_Handle(
|
OnJoinSessionCompleteDelegateHandle = SessionInterface->AddOnJoinSessionCompleteDelegate_Handle(
|
||||||
FOnJoinSessionCompleteDelegate::CreateUObject(this, &UAdvancedFriendsGameInstance::OnJoinSessionComplete));
|
FOnJoinSessionCompleteDelegate::CreateUObject(this, &UAdvancedFriendsGameInstance::OnJoinSessionComplete));
|
||||||
|
|
||||||
|
// Temp for 5.5, they aren't filling in the struct correctly
|
||||||
|
if (!InviteResult.Session.SessionSettings.bIsDedicated)
|
||||||
|
{
|
||||||
|
FOnlineSessionSearchResult ModResult = InviteResult;
|
||||||
|
ModResult.Session.SessionSettings.bUsesPresence = true;
|
||||||
|
ModResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||||
|
SessionInterface->JoinSession(0, NAME_GameSession, ModResult);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SessionInterface->JoinSession(0, NAME_GameSession, InviteResult);
|
SessionInterface->JoinSession(0, NAME_GameSession, InviteResult);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
UE_LOG(AdvancedFriendsInterfaceLog, Log, TEXT("Called Join Session for Steam Friends List UI InviteResults: %s, UserId: %s"), *InviteResult.GetSessionIdStr(), *UserId->ToString());
|
UE_LOG(AdvancedFriendsInterfaceLog, Log, TEXT("Called Join Session for Steam Friends List UI InviteResults: %s, UserId: %s"), *InviteResult.GetSessionIdStr(), *UserId->ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,6 +317,13 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Temp for 5.5, they aren't filling in the struct correctly
|
||||||
|
if (!BluePrintResult.OnlineResult.Session.SessionSettings.bIsDedicated)
|
||||||
|
{
|
||||||
|
BluePrintResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||||
|
BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||||
|
}
|
||||||
|
|
||||||
OnSessionInviteReceived(LocalPlayer, PInviting, AppId, BluePrintResult);
|
OnSessionInviteReceived(LocalPlayer, PInviting, AppId, BluePrintResult);
|
||||||
|
|
||||||
//IAdvancedFriendsInterface* TheInterface = NULL;
|
//IAdvancedFriendsInterface* TheInterface = NULL;
|
||||||
@ -342,6 +360,13 @@ void UAdvancedFriendsGameInstance::OnSessionInviteAcceptedMaster(const bool bWas
|
|||||||
FBPUniqueNetId PInvited;
|
FBPUniqueNetId PInvited;
|
||||||
PInvited.SetUniqueNetId(PersonInvited);
|
PInvited.SetUniqueNetId(PersonInvited);
|
||||||
|
|
||||||
|
// Temp for 5.5, they aren't filling in the struct correctly
|
||||||
|
if (!BluePrintResult.OnlineResult.Session.SessionSettings.bIsDedicated)
|
||||||
|
{
|
||||||
|
BluePrintResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||||
|
BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||||
|
}
|
||||||
|
|
||||||
OnSessionInviteAccepted(LocalPlayer,PInvited, BluePrintResult);
|
OnSessionInviteAccepted(LocalPlayer,PInvited, BluePrintResult);
|
||||||
|
|
||||||
APlayerController* Player = UGameplayStatics::GetPlayerController(GetWorld(), LocalPlayer);
|
APlayerController* Player = UGameplayStatics::GetPlayerController(GetWorld(), LocalPlayer);
|
||||||
|
@ -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 bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable, bool bStartAfterCreate)
|
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, bool bStartAfterCreate)
|
||||||
{
|
{
|
||||||
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
|
||||||
Proxy->PlayerControllerWeakPtr = PlayerController;
|
Proxy->PlayerControllerWeakPtr = PlayerController;
|
||||||
@ -24,7 +24,7 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create
|
|||||||
Proxy->bAllowInvites = bAllowInvites;
|
Proxy->bAllowInvites = bAllowInvites;
|
||||||
Proxy->ExtraSettings = ExtraSettings;
|
Proxy->ExtraSettings = ExtraSettings;
|
||||||
Proxy->bDedicatedServer = bIsDedicatedServer;
|
Proxy->bDedicatedServer = bIsDedicatedServer;
|
||||||
Proxy->bUsePresence = bUsePresence;
|
/*Proxy->bUsePresence = bUsePresence;*/
|
||||||
Proxy->bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
Proxy->bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||||
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||||
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||||
@ -61,13 +61,13 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
|
|||||||
|
|
||||||
if (bDedicatedServer)
|
if (bDedicatedServer)
|
||||||
{
|
{
|
||||||
Settings.bUsesPresence = false;
|
|
||||||
Settings.bUseLobbiesIfAvailable = false;
|
Settings.bUseLobbiesIfAvailable = false;
|
||||||
|
Settings.bUsesPresence = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Settings.bUsesPresence = bUsePresence;
|
|
||||||
Settings.bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
Settings.bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
|
||||||
|
Settings.bUsesPresence = bUseLobbiesIfAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.bUseLobbiesVoiceChatIfAvailable = bUseLobbiesIfAvailable ? bUseLobbiesVoiceChatIfAvailable : false;
|
Settings.bUseLobbiesVoiceChatIfAvailable = bUseLobbiesIfAvailable ? bUseLobbiesVoiceChatIfAvailable : false;
|
||||||
|
@ -86,7 +86,6 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
|
|||||||
/** #define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))*/
|
/** #define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))*/
|
||||||
/** Whether to use lobbies vs sessions */
|
/** Whether to use lobbies vs sessions */
|
||||||
/** #define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))*/
|
/** #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);
|
||||||
|
|
||||||
@ -225,6 +224,14 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess)
|
|||||||
|
|
||||||
FBlueprintSessionResult BPResult;
|
FBlueprintSessionResult BPResult;
|
||||||
BPResult.OnlineResult = Result;
|
BPResult.OnlineResult = Result;
|
||||||
|
|
||||||
|
// Temp for 5.5, force the values if epic isn't setting them, lobbies should always have these true
|
||||||
|
if (ServerSearchType != EBPServerPresenceSearchType::DedicatedServersOnly )
|
||||||
|
{
|
||||||
|
BPResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
|
||||||
|
BPResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
|
||||||
|
}
|
||||||
|
|
||||||
SessionSearchResults.AddUnique(BPResult);
|
SessionSearchResults.AddUnique(BPResult);
|
||||||
}
|
}
|
||||||
if (!bRunSecondSearch)
|
if (!bRunSecondSearch)
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
{
|
{
|
||||||
"Name": "AdvancedSteamSessions",
|
"Name": "AdvancedSteamSessions",
|
||||||
"Type": "RunTime",
|
"Type": "RunTime",
|
||||||
"LoadingPhase": "Default"
|
"LoadingPhase": "PostDefault"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Plugins": [
|
"Plugins": [
|
||||||
|
@ -16,6 +16,7 @@ public class AdvancedSteamSessions : ModuleRules
|
|||||||
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
|
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
|
||||||
{
|
{
|
||||||
PublicDependencyModuleNames.AddRange(new string[] { "SteamShared", "Steamworks", "OnlineSubsystemSteam" });
|
PublicDependencyModuleNames.AddRange(new string[] { "SteamShared", "Steamworks", "OnlineSubsystemSteam" });
|
||||||
|
AddEngineThirdPartyPrivateStaticDependencies(Target, "Steamworks");
|
||||||
//PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
|
//PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
// Fill out your copyright notice in the Description page of Project Settings.
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
#include "AdvancedSteamFriendsLibrary.h"
|
#include "AdvancedSteamFriendsLibrary.h"
|
||||||
#include "OnlineSubSystemHeader.h"
|
#include "OnlineSubSystemHeader.h"
|
||||||
|
#include "Engine/Texture.h"
|
||||||
|
#include "Engine/Texture2D.h"
|
||||||
|
#include "TextureResource.h"
|
||||||
|
#include "PixelFormat.h"
|
||||||
|
|
||||||
//General Log
|
//General Log
|
||||||
DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
|
DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
|
||||||
|
Loading…
Reference in New Issue
Block a user