mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-22 07:54:25 +00:00
fix a bug in the overlays
This commit is contained in:
@@ -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