3 Commits

Author SHA1 Message Date
mordentral
525e6411a6 Added OpenSteamUserOverlay to the AdvancedSteamFriendsLibrary
Former-commit-id: d68e0533494ae204e8d7583601308fcd8f95e64a
2019-01-15 12:56:03 -05:00
mordentral
6b4ac8d00c Adding extended comment to create advanced session, thanks rumbleball
Former-commit-id: a0a869c888e5da22a5fa730f6f57073df8ef539c
2018-12-05 09:49:57 -05:00
mordentral
50752d2a95 Locking 4.20
Former-commit-id: c5f97212cf5ea990d183c5e49970c9c1d1b50cec
2018-11-07 14:13:44 -05:00
3 changed files with 75 additions and 7 deletions

View File

@@ -18,7 +18,13 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// 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 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 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.
*/
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 bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true);

View File

@@ -246,6 +246,41 @@ enum class SteamAvatarSize : uint8
SteamAvatar_Large = 3
};
UENUM(Blueprintable)
enum class ESteamUserOverlayType : uint8
{
/*Opens the overlay web browser to the specified user or groups profile.*/
steamid,
/*Opens a chat window to the specified user, or joins the group chat.*/
chat,
/*Opens a window to a Steam Trading session that was started with the ISteamEconomy / StartTrade Web API.*/
jointrade,
/*Opens the overlay web browser to the specified user's stats.*/
stats,
/*Opens the overlay web browser to the specified user's achievements.*/
achievements,
/*Opens the overlay in minimal mode prompting the user to add the target user as a friend.*/
friendadd,
/*Opens the overlay in minimal mode prompting the user to remove the target friend.*/
friendremove,
/*Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.*/
friendrequestaccept,
/*Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.*/
friendrequestignore
};
static FString EnumToString(const FString& enumName, uint8 value)
{
const UEnum* EnumPtr = FindObject<UEnum>(ANY_PACKAGE, *enumName, true);
if (!EnumPtr)
return FString();
FString EnumName = EnumPtr->GetNameStringByIndex(value);
return EnumName;
}
USTRUCT(BlueprintType, Category = "Online|SteamAPI|SteamGroups")
struct FBPSteamGroupInfo
{
@@ -283,6 +318,10 @@ public:
// 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")
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly = false);
// Opens the steam overlay to go to the specified user dialog
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
static bool OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")

View File

@@ -11,7 +11,7 @@ DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
return 0;
@@ -91,7 +91,7 @@ void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamFriendGamePlayed Had a bad UniqueNetId!"));
Result = EBlueprintResultSwitch::OnFailure;
@@ -133,7 +133,7 @@ int32 UAdvancedSteamFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId Uni
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
return 0;
@@ -154,7 +154,7 @@ FString UAdvancedSteamFriendsLibrary::GetSteamPersonaName(const FBPUniqueNetId U
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamPersonaName Had a bad UniqueNetId!"));
return FString(TEXT(""));
@@ -199,7 +199,7 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri
bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("RequestSteamFriendInfo Had a bad UniqueNetId!"));
return false;
@@ -217,10 +217,33 @@ bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId U
return false;
}
bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Had a bad UniqueNetId!"));
return false;
}
if (SteamAPI_Init())
{
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
FString DialogName = EnumToString("ESteamUserOverlayType", (uint8)DialogType);
SteamFriends()->ActivateGameOverlayToUser(TCHAR_TO_ANSI(*DialogName), id);
return true;
}
#endif
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
return false;
}
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamFriendAvatar Had a bad UniqueNetId!"));
Result = EBlueprintAsyncResultSwitch::OnFailure;