mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-23 16:34:07 +00:00
Added extra execution outputs to "Get Steam Avatar" node
Added in CriErrUA's pull request for equivilant nodes for uniquenetids and then optimized it. Former-commit-id: 224fcd8a032efaa49f4288837ab1173823cb51f4
This commit is contained in:
@@ -62,8 +62,8 @@ public:
|
||||
static void IsAFriend(APlayerController *PlayerController, const FBPUniqueNetId UniqueNetId, bool &IsFriend);
|
||||
|
||||
// Get a texture of a valid friends avatar, STEAM ONLY, Returns invalid texture if the subsystem hasn't loaded that size of avatar yet
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static UTexture2D * GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, SteamAvatarSize AvatarSize = SteamAvatarSize::SteamAvatar_Medium);
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (ExpandEnumAsExecs = "Result"))
|
||||
static UTexture2D * GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize = SteamAvatarSize::SteamAvatar_Medium);
|
||||
|
||||
// Preloads the avatar and name of a steam friend, return whether it is already available or not, STEAM ONLY, Takes time to actually load everything after this is called.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
|
@@ -82,6 +82,19 @@ enum class EBlueprintResultSwitch : uint8
|
||||
OnFailure
|
||||
};
|
||||
|
||||
// This makes a lot of the blueprint functions cleaner
|
||||
UENUM()
|
||||
enum class EBlueprintAsyncResultSwitch : uint8
|
||||
{
|
||||
// On Success
|
||||
OnSuccess,
|
||||
|
||||
// Still loading
|
||||
AsyncLoading,
|
||||
// On Failure
|
||||
OnFailure
|
||||
};
|
||||
|
||||
// This is to define server type searches
|
||||
UENUM(BlueprintType)
|
||||
enum class EBPServerPresenceSearchType : uint8
|
||||
|
@@ -76,12 +76,13 @@ bool UAdvancedFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId Unique
|
||||
return false;
|
||||
}
|
||||
|
||||
UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, SteamAvatarSize AvatarSize)
|
||||
UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
|
||||
{
|
||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
|
||||
{
|
||||
UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetSteamFriendAvatar Had a bad UniqueNetId!"));
|
||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -106,7 +107,10 @@ UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId
|
||||
}
|
||||
|
||||
if (Picture == -1)
|
||||
{
|
||||
Result = EBlueprintAsyncResultSwitch::AsyncLoading;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SteamUtils()->GetImageSize(Picture, &Width, &Height);
|
||||
|
||||
@@ -150,6 +154,7 @@ UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId
|
||||
|
||||
Avatar->UpdateResource();
|
||||
|
||||
Result = EBlueprintAsyncResultSwitch::OnSuccess;
|
||||
return Avatar;
|
||||
}
|
||||
else
|
||||
@@ -157,11 +162,13 @@ UTexture2D * UAdvancedFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId
|
||||
UE_LOG(AdvancedFriendsLog, Warning, TEXT("Bad Height / Width with steam avatar!"));
|
||||
}
|
||||
|
||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
UE_LOG(AdvancedFriendsLog, Warning, TEXT("STEAM Couldn't be verified as initialized"));
|
||||
Result = EBlueprintAsyncResultSwitch::OnFailure;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -361,26 +361,16 @@ void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *Playe
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool UAdvancedSessionsLibrary::IsValidUniqueNetID(const FBPUniqueNetId &UniqueNetId)
|
||||
{
|
||||
return UniqueNetId.IsValid();
|
||||
}
|
||||
|
||||
bool UAdvancedSessionsLibrary::EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A, const FBPUniqueNetId &B)
|
||||
{
|
||||
if (A.IsValid() && B.IsValid())
|
||||
{
|
||||
return (A.GetUniqueNetId()->GetSize() == B.GetUniqueNetId()->GetSize()) &&
|
||||
(FMemory::Memcmp(A.GetUniqueNetId()->GetBytes(), B.GetUniqueNetId()->GetBytes(), A.GetUniqueNetId()->GetSize()) == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return ((A.IsValid() && B.IsValid()) && (*A.GetUniqueNetId() == *B.GetUniqueNetId()));
|
||||
}
|
||||
|
||||
|
||||
void UAdvancedSessionsLibrary::SetPlayerName(APlayerController *PlayerController, FString PlayerName)
|
||||
{
|
||||
if (!PlayerController)
|
||||
|
Reference in New Issue
Block a user