more changes

This commit is contained in:
Joshua
2024-01-22 15:36:47 -05:00
parent fe461af3b0
commit 3e265f1a64
4 changed files with 134 additions and 49 deletions

View File

@@ -32,32 +32,32 @@ public:
//********* External UI Functions *************// //********* External UI Functions *************//
// Show the UI that handles the Friends list // Show the UI that handles the Friends list
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowFriendsUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result); static void ShowFriendsUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result);
// Show the UI that handles inviting people to your game // Show the UI that handles inviting people to your game
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowInviteUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result); static void ShowInviteUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result);
// Show the UI that shows the leaderboard (doesn't work with steam) // Show the UI that shows the leaderboard (doesn't work with steam)
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowLeaderBoardUI(FString LeaderboardName, EBlueprintResultSwitch &Result); static void ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch &Result);
// Show the UI that shows a web URL // Show the UI that shows a web URL
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", AutoCreateRefTerm = "AllowedDomains")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", AutoCreateRefTerm = "AllowedDomains", WorldContext = "WorldContextObject"))
static void ShowWebURLUI(FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded = false , bool bShowBackground = false, bool bShowCloseButton = false, int32 OffsetX = 0, int32 OffsetY = 0, int32 SizeX = 0, int32 SizeY = 0); static void ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded = false , bool bShowBackground = false, bool bShowCloseButton = false, int32 OffsetX = 0, int32 OffsetY = 0, int32 SizeX = 0, int32 SizeY = 0);
// Show the UI that shows a web URL // Show the UI that shows a web URL
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI") UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (WorldContext = "WorldContextObject"))
static void CloseWebURLUI(); static void CloseWebURLUI(UObject* WorldContextObject);
// Show the UI that shows the profile of a uniquenetid // Show the UI that shows the profile of a uniquenetid
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowProfileUI(const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result); static void ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result);
// Show the UI that shows the account upgrade UI (doesn't work with steam) // Show the UI that shows the account upgrade UI (doesn't work with steam)
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowAccountUpgradeUI(const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result); static void ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result);
}; };

View File

@@ -28,26 +28,26 @@ public:
//********* Identity Functions *************// //********* Identity Functions *************//
// Get the login status of a local player // Get the login status of a local player
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetLoginStatus(const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result); static void GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result);
// Get the auth token for a local player // Get the auth token for a local player
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetPlayerAuthToken(APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result); static void GetPlayerAuthToken(UObject* WorldContextObject, APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result);
// Get a players nickname // Get a players nickname
UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity") UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity", meta = (WorldContext = "WorldContextObject"))
static void GetPlayerNickname(const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname); static void GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname);
//********* User Account Functions *************// //********* User Account Functions *************//
// Get a users account // Get a users account
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetUserAccount(const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result); static void GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result);
// Get all known users accounts // Get all known users accounts
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result")) UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetAllUserAccounts(TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result); static void GetAllUserAccounts(UObject* WorldContextObject, TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result);
// Get a user account access token // Get a user account access token
UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount") UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount")

View File

@@ -6,9 +6,17 @@
//General Log //General Log
DEFINE_LOG_CATEGORY(AdvancedExternalUILog); DEFINE_LOG_CATEGORY(AdvancedExternalUILog);
void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result) void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result)
{ {
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {
@@ -21,10 +29,17 @@ void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(const FBPUniqueNetId Playe
Result = EBlueprintResultSwitch::OnSuccess; Result = EBlueprintResultSwitch::OnSuccess;
} }
void UAdvancedExternalUILibrary::ShowProfileUI(const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result) void UAdvancedExternalUILibrary::ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result)
{ {
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {
@@ -39,9 +54,16 @@ void UAdvancedExternalUILibrary::ShowProfileUI(const FBPUniqueNetId PlayerViewin
void UAdvancedExternalUILibrary::ShowWebURLUI(FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded, bool bShowBackground, bool bShowCloseButton, int32 OffsetX, int32 OffsetY, int32 SizeX, int32 SizeY) void UAdvancedExternalUILibrary::ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded, bool bShowBackground, bool bShowCloseButton, int32 OffsetX, int32 OffsetY, int32 SizeX, int32 SizeY)
{ {
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {
@@ -67,9 +89,15 @@ void UAdvancedExternalUILibrary::ShowWebURLUI(FString URLToShow, EBlueprintResul
Result = EBlueprintResultSwitch::OnSuccess; Result = EBlueprintResultSwitch::OnSuccess;
} }
void UAdvancedExternalUILibrary::CloseWebURLUI() void UAdvancedExternalUILibrary::CloseWebURLUI(UObject* WorldContextObject)
{ {
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {
@@ -80,9 +108,16 @@ void UAdvancedExternalUILibrary::CloseWebURLUI()
ExternalUIInterface->CloseWebURL(); ExternalUIInterface->CloseWebURL();
} }
void UAdvancedExternalUILibrary::ShowLeaderBoardUI(FString LeaderboardName, EBlueprintResultSwitch &Result) void UAdvancedExternalUILibrary::ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch &Result)
{ {
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {
@@ -97,7 +132,7 @@ void UAdvancedExternalUILibrary::ShowLeaderBoardUI(FString LeaderboardName, EBlu
} }
void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result) void UAdvancedExternalUILibrary::ShowInviteUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result)
{ {
if (!PlayerController) if (!PlayerController)
{ {
@@ -106,7 +141,14 @@ void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerControlle
return; return;
} }
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {
@@ -128,7 +170,7 @@ void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerControlle
Result = EBlueprintResultSwitch::OnSuccess; Result = EBlueprintResultSwitch::OnSuccess;
} }
void UAdvancedExternalUILibrary::ShowFriendsUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result) void UAdvancedExternalUILibrary::ShowFriendsUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result)
{ {
if (!PlayerController) if (!PlayerController)
{ {
@@ -137,7 +179,14 @@ void UAdvancedExternalUILibrary::ShowFriendsUI(APlayerController *PlayerControll
return; return;
} }
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid()) if (!ExternalUIInterface.IsValid())
{ {

View File

@@ -5,7 +5,7 @@
DEFINE_LOG_CATEGORY(AdvancedIdentityLog); DEFINE_LOG_CATEGORY(AdvancedIdentityLog);
void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result) void UAdvancedIdentityLibrary::GetPlayerAuthToken(UObject* WorldContextObject, APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result)
{ {
if (!PlayerController) if (!PlayerController)
{ {
@@ -23,7 +23,14 @@ void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerCont
return; return;
} }
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid()) if (!IdentityInterface.IsValid())
{ {
@@ -36,15 +43,21 @@ void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerCont
Result = EBlueprintResultSwitch::OnSuccess; Result = EBlueprintResultSwitch::OnSuccess;
} }
void UAdvancedIdentityLibrary::GetPlayerNickname(const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname) void UAdvancedIdentityLibrary::GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname)
{ {
if (!UniqueNetID.IsValid()) if (!UniqueNetID.IsValid())
{ {
UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetPlayerNickname was passed a bad player uniquenetid!")); UE_LOG(AdvancedIdentityLog, Warning, TEXT("GetPlayerNickname was passed a bad player uniquenetid!"));
return; return;
} }
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid()) if (!IdentityInterface.IsValid())
{ {
@@ -55,7 +68,7 @@ void UAdvancedIdentityLibrary::GetPlayerNickname(const FBPUniqueNetId & UniqueNe
} }
void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result) void UAdvancedIdentityLibrary::GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result)
{ {
if (!UniqueNetID.IsValid()) if (!UniqueNetID.IsValid())
{ {
@@ -64,7 +77,14 @@ void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID
return; return;
} }
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(); UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid()) if (!IdentityInterface.IsValid())
{ {
@@ -78,9 +98,17 @@ void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID
} }
void UAdvancedIdentityLibrary::GetAllUserAccounts(TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result) void UAdvancedIdentityLibrary::GetAllUserAccounts(UObject* WorldContextObject, TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result)
{ {
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid()) if (!IdentityInterface.IsValid())
{ {
@@ -99,9 +127,17 @@ void UAdvancedIdentityLibrary::GetAllUserAccounts(TArray<FBPUserOnlineAccount> &
Result = EBlueprintResultSwitch::OnSuccess; Result = EBlueprintResultSwitch::OnSuccess;
} }
void UAdvancedIdentityLibrary::GetUserAccount(const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result) void UAdvancedIdentityLibrary::GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result)
{ {
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if(!UniqueNetId.IsValid()) if(!UniqueNetId.IsValid())
{ {