Source/RnD/Network/NWGameInstance.cpp
// when reading friend list from the online subsystem is finished, get it and store it then call blueprint to show it on UMG

when reading friend list from the online subsystem is finished, get it and store it then call blueprint to show it on UMG
when reading friend list from the online subsystem is finished get it and store it then call blueprint to show it on UMG
void UNWGameInstance::OnReadFriendsListCompleted(int32 LocalUserNum, bool bWasSuccessful, const FString & ListName, const FString & ErrorString)
{
	if (bWasSuccessful)
	{
		IOnlineSubsystem* const OnlineSub = IOnlineSubsystem::Get(FName("Steam"));
		if (OnlineSub)
		{
			IOnlineFriendsPtr FriendsInterface = OnlineSub->GetFriendsInterface();
			if (FriendsInterface.IsValid())
			{
				TArray< TSharedRef<FOnlineFriend> > FriendList;
				FriendsInterface->GetFriendsList(LocalUserNum, ListName, FriendList);
				TArray<FSteamFriendInfo> BPFriendsList;
				for (TSharedRef<FOnlineFriend> Friend : FriendList)
				{
					FSteamFriendInfo TempSteamFriendInfo;
					TempSteamFriendInfo.PlayerUniqueNetID.SetUniqueNetId(Friend->GetUserId());
					TempSteamFriendInfo.PlayerAvatar = GetSteamAvatar(TempSteamFriendInfo.PlayerUniqueNetID);
					TempSteamFriendInfo.PlayerName = Friend->GetDisplayName();
					BPFriendsList.Add(TempSteamFriendInfo);
				}
				OnGetSteamFriendRequestCompleteUMG(BPFriendsList);
			}
		}
	}
	else
		ShowErrorMessageUMG(FText::FromString(ErrorString));
}
void UNWGameInstance :: OnReadFriendsListCompleted ( int32 LocalUserNum , bool bWasSuccessful , const FString & ListName , const FString & ErrorString ) { if ( bWasSuccessful ) { IOnlineSubsystem * const OnlineSub = IOnlineSubsystem :: Get ( FName ( " " ) ) ; if ( OnlineSub ) { IOnlineFriendsPtr FriendsInterface = OnlineSub -> GetFriendsInterface ( ) ; if ( FriendsInterface . IsValid ( ) ) { TArray < TSharedRef < FOnlineFriend > > FriendList ; FriendsInterface -> GetFriendsList ( LocalUserNum , ListName , FriendList ) ; TArray < FSteamFriendInfo > BPFriendsList ; for ( TSharedRef < FOnlineFriend > Friend : FriendList ) { FSteamFriendInfo TempSteamFriendInfo ; TempSteamFriendInfo . PlayerUniqueNetID . SetUniqueNetId ( Friend -> GetUserId ( ) ) ; TempSteamFriendInfo . PlayerAvatar = GetSteamAvatar ( TempSteamFriendInfo . PlayerUniqueNetID ) ; TempSteamFriendInfo . PlayerName = Friend -> GetDisplayName ( ) ; BPFriendsList . Add ( TempSteamFriendInfo ) ; } OnGetSteamFriendRequestCompleteUMG ( BPFriendsList ) ; } } } else ShowErrorMessageUMG ( FText :: FromString ( ErrorString ) ) ; }
when reading friend list from the online subsystem is finished, get it and store it then call blueprint to show it on UMG
when reading friend list from the online subsystem is finished get it and store it then call blueprint to show it on UMG
//get the steam online subsystem
 //check if the online subsystem is valid
 //GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Emerald, TEXT("Found Steam Online"));
 //get Friends interface
 //if the Friends Interface is valid
 //get a list on all online players and store them in the FriendList
 /*EFriendsLists::ToString((EFriendsLists::Default)),*/ //GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Emerald, *FString::Printf(TEXT("Number of friends found is: %d"), FriendList.Num()));
 //for each loop to convert the FOnlineFriend array into the cuteom BP struct
 //temp FSteamFriendInfo variable to add to the array
 //get the friend's User ID
 //get the friend's avatar as texture 2D and store it
 //get the friend's display name
 //add the temp variable to the 
 //call blueprint to show the info on UMG
