mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-25 01:14:20 +00:00
Compare commits
5 Commits
5.7-Previe
...
5.5-Locked
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68ba1f51ae | ||
|
|
ca9797b112 | ||
|
|
a6f91c874c | ||
|
|
81d17ad107 | ||
|
|
24b39f20e7 |
@@ -44,6 +44,11 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedVoiceInterface)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedVoiceInterface)
|
||||||
bool bEnableTalkingStatusDelegate;
|
bool bEnableTalkingStatusDelegate;
|
||||||
|
|
||||||
|
// If true we will auto travel to a game session when an invite is received.
|
||||||
|
// This can get in the way of Beacon Sessions, you may want to disable it.
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface)
|
||||||
|
bool bAutoTravelOnAcceptedUserInviteReceived = true;
|
||||||
|
|
||||||
//virtual void PostLoad() override;
|
//virtual void PostLoad() override;
|
||||||
virtual void Shutdown() override;
|
virtual void Shutdown() override;
|
||||||
virtual void Init() override;
|
virtual void Init() override;
|
||||||
|
|||||||
@@ -160,6 +160,10 @@ public:
|
|||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||||
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
|
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
|
||||||
|
|
||||||
|
// Get the unique net id of a network player attached to the given controller
|
||||||
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||||
|
static void GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId);
|
||||||
|
|
||||||
// Get the unique net id of a network player who is assigned the the given player state
|
// Get the unique net id of a network player who is assigned the the given player state
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
|
||||||
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
|
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
|
||||||
|
|||||||
@@ -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
|
// 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")
|
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
|
||||||
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &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);
|
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &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, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false);
|
||||||
|
|
||||||
// UOnlineBlueprintCallProxyBase interface
|
// UOnlineBlueprintCallProxyBase interface
|
||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
@@ -58,6 +58,12 @@ private:
|
|||||||
// Allow joining in progress
|
// Allow joining in progress
|
||||||
bool bAllowJoinInProgress = true;
|
bool bAllowJoinInProgress = true;
|
||||||
|
|
||||||
|
// Allow joining in progress
|
||||||
|
bool bAllowJoinViaPresence = true;
|
||||||
|
|
||||||
|
// Allow joining in progress
|
||||||
|
bool bAllowJoinViaPresenceFriendsOnly = false;
|
||||||
|
|
||||||
// Update whether this is a dedicated server or not
|
// Update whether this is a dedicated server or not
|
||||||
bool bDedicatedServer = false;
|
bool bDedicatedServer = false;
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ void UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted(const bool bWasSu
|
|||||||
|
|
||||||
void UAdvancedFriendsGameInstance::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
|
void UAdvancedFriendsGameInstance::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// If we don't want to auto travel to the session instance then exit out
|
||||||
|
if (!bAutoTravelOnAcceptedUserInviteReceived)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
|
||||||
if (SessionInterface.IsValid())
|
if (SessionInterface.IsValid())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -451,6 +451,17 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UAdvancedSessionsLibrary::GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId)
|
||||||
|
{
|
||||||
|
FBPUniqueNetId ReturnID;
|
||||||
|
if (SessionResult.OnlineResult.IsValid())
|
||||||
|
{
|
||||||
|
ReturnID.SetUniqueNetId(SessionResult.OnlineResult.Session.OwningUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
UniqueNetId = ReturnID;
|
||||||
|
}
|
||||||
|
|
||||||
void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId)
|
void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId)
|
||||||
{
|
{
|
||||||
if (!PlayerState)
|
if (!PlayerState)
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSucce
|
|||||||
{
|
{
|
||||||
OnFailure.Broadcast();
|
OnFailure.Broadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnFailure.Broadcast();
|
OnFailure.Broadcast();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ UUpdateSessionCallbackProxyAdvanced::UUpdateSessionCallbackProxyAdvanced(const F
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise)
|
UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly)
|
||||||
{
|
{
|
||||||
UUpdateSessionCallbackProxyAdvanced* Proxy = NewObject<UUpdateSessionCallbackProxyAdvanced>();
|
UUpdateSessionCallbackProxyAdvanced* Proxy = NewObject<UUpdateSessionCallbackProxyAdvanced>();
|
||||||
Proxy->NumPublicConnections = PublicConnections;
|
Proxy->NumPublicConnections = PublicConnections;
|
||||||
@@ -25,6 +25,8 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update
|
|||||||
Proxy->bAllowJoinInProgress = bAllowJoinInProgress;
|
Proxy->bAllowJoinInProgress = bAllowJoinInProgress;
|
||||||
Proxy->bDedicatedServer = bIsDedicatedServer;
|
Proxy->bDedicatedServer = bIsDedicatedServer;
|
||||||
Proxy->bShouldAdvertise = bShouldAdvertise;
|
Proxy->bShouldAdvertise = bShouldAdvertise;
|
||||||
|
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||||
|
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||||
return Proxy;
|
return Proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,11 +67,14 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
|
|||||||
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
|
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
|
||||||
Settings->bIsLANMatch = bUseLAN;
|
Settings->bIsLANMatch = bUseLAN;
|
||||||
//Settings->bUsesPresence = true;
|
//Settings->bUsesPresence = true;
|
||||||
//Settings->bAllowJoinViaPresence = true;
|
|
||||||
Settings->bAllowInvites = bAllowInvites;
|
Settings->bAllowInvites = bAllowInvites;
|
||||||
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
|
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
|
||||||
Settings->bIsDedicated = bDedicatedServer;
|
Settings->bIsDedicated = bDedicatedServer;
|
||||||
|
|
||||||
|
// Added in 5.6
|
||||||
|
Settings->bAllowJoinViaPresence = bAllowJoinViaPresence;
|
||||||
|
Settings->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
|
||||||
|
|
||||||
FOnlineSessionSetting * fSetting = NULL;
|
FOnlineSessionSetting * fSetting = NULL;
|
||||||
FOnlineSessionSetting ExtraSetting;
|
FOnlineSessionSetting ExtraSetting;
|
||||||
for (int i = 0; i < ExtraSettings.Num(); i++)
|
for (int i = 0; i < ExtraSettings.Num(); i++)
|
||||||
|
|||||||
@@ -337,8 +337,8 @@ public:
|
|||||||
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly = false);
|
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly = false);
|
||||||
|
|
||||||
// Opens the steam overlay to go to the specified user dialog
|
// Opens the steam overlay to go to the specified user dialog
|
||||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (WorldContext = "WorldContextObject"))
|
||||||
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
static bool OpenSteamUserOverlay(UObject* WorldContextObject, const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
|
||||||
|
|
||||||
// Returns if the steam overlay is currently active (this can return false during initial overlay hooking)
|
// Returns if the steam overlay is currently active (this can return false during initial overlay hooking)
|
||||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// 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 "OnlineSubsystemTypes.h"
|
||||||
#include "Engine/Texture.h"
|
#include "Engine/Texture.h"
|
||||||
#include "Engine/Texture2D.h"
|
#include "Engine/Texture2D.h"
|
||||||
#include "TextureResource.h"
|
#include "TextureResource.h"
|
||||||
@@ -237,7 +238,7 @@ bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId U
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType)
|
bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(UObject* WorldContextObject,const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType)
|
||||||
{
|
{
|
||||||
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
|
||||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
|
||||||
@@ -248,13 +249,24 @@ bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId Uni
|
|||||||
|
|
||||||
if (SteamAPI_Init())
|
if (SteamAPI_Init())
|
||||||
{
|
{
|
||||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
|
||||||
if (DialogType == ESteamUserOverlayType::invitetolobby)
|
if (DialogType == ESteamUserOverlayType::invitetolobby)
|
||||||
{
|
{
|
||||||
SteamFriends()->ActivateGameOverlayInviteDialog(id);
|
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
|
||||||
|
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
|
||||||
|
if (SessionInterface.IsValid())
|
||||||
|
{
|
||||||
|
FNamedOnlineSession* CurrentSession = SessionInterface->GetNamedSession(NAME_GameSession);
|
||||||
|
|
||||||
|
if (CurrentSession && CurrentSession->SessionInfo->GetSessionId().IsValid())
|
||||||
|
{
|
||||||
|
uint64 id = *((uint64*)CurrentSession->SessionInfo->GetSessionId().GetBytes());
|
||||||
|
SteamFriends()->ActivateGameOverlayInviteDialog(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||||
FString DialogName = EnumToString("ESteamUserOverlayType", (uint8)DialogType);
|
FString DialogName = EnumToString("ESteamUserOverlayType", (uint8)DialogType);
|
||||||
SteamFriends()->ActivateGameOverlayToUser(TCHAR_TO_ANSI(*DialogName), id);
|
SteamFriends()->ActivateGameOverlayToUser(TCHAR_TO_ANSI(*DialogName), id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user