04-06-2018 08:48 AM
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
// Now that we are sure that everything worked, try to actually get the FriendList
TArray<TSharedRef<FOnlineFriend>> FriendList;
FriendInterface->GetFriendsList(LocalUserNum, ListName, FriendList);
// Iterate over the FriendList and fill in all Data into our Dummy Struct
for (TSharedRef<FOnlineFriend> Friend : FriendList)
{
// Get Presence State
FOnlineUserPresence Presence = Friend->GetPresence();
// Dummy Array Entry
FOculusFriend OculusFriend;
OculusFriend.DisplayName = Friend->GetDisplayName();
OculusFriend.RealName = Friend->GetRealName();
OculusFriend.StatusString = Presence.Status.StatusStr;
OculusFriend.bIsOnline = Presence.bIsOnline;
OculusFriend.bIsPlaying = Presence.bIsPlaying;
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
OculusFriend.bHasVoiceSupport = Presence.bHasVoiceSupport;
OculusFriend.PresenceState = (EOnlinePresenceState::Type)(int32)Presence.Status.State;
OculusFriend.UniqueNetID = Friend->GetUserId();
OculusFriendList.Add(OculusFriend);
}
Friend->GetDisplayName();
andPresence.bIsOnline;
works so at least partially this is working.04-06-2018 09:36 AM
void UGetFriendListCallbackProxy::Activate()
{
if (PlayerControllerWeakPtr.IsValid())
{
IOnlineFriendsPtr FriendInterface = Online::GetFriendsInterface();
if (FriendInterface.IsValid())
{
const ULocalPlayer* LocalPlayer = PlayerControllerWeakPtr->GetLocalPlayer();
// Request the FriendList from the FriendInterface.
FriendInterface->ReadFriendsList(LocalPlayer->GetControllerId(), FriendListTypeToString(FriendListType), OnReadFriendsCompleteDelegate);
return;
}
}
TArray<FOculusFriend> FriendList;
OnFailure.Broadcast(FriendList);
}
// Called once the async call completes
void UGetFriendListCallbackProxy::OnGetFriendListComplete(int32 LocalUserNum, bool bWasSuccessful, const FString& ListName, const FString& ErrorStr)
{
TArray<FOculusFriend> OculusFriendList;
if (bWasSuccessful)
{
IOnlineFriendsPtr FriendInterface = Online::GetFriendsInterface();
if (FriendInterface.IsValid())
{
// Now that we are sure that everything worked, try to actually get the FriendList
TArray<TSharedRef<FOnlineFriend>> FriendList;
FriendInterface->GetFriendsList(LocalUserNum, ListName, FriendList);
// Iterate over the FriendList and fill in all Data into our Dummy Struct
for (TSharedRef<FOnlineFriend> Friend : FriendList)
{
// Get Presence State
FOnlineUserPresence Presence = Friend->GetPresence();
// Dummy Array Entry
FOculusFriend OculusFriend;
OculusFriend.DisplayName = Friend->GetDisplayName();
OculusFriend.RealName = Friend->GetRealName();
OculusFriend.StatusString = Presence.Status.StatusStr;
OculusFriend.bIsOnline = Presence.bIsOnline;
OculusFriend.bIsPlaying = Presence.bIsPlaying;
OculusFriend.bIsPlayingSameGame = Presence.bIsPlayingThisGame;
OculusFriend.bIsJoinable = Presence.bIsJoinable;
OculusFriend.bHasVoiceSupport = Presence.bHasVoiceSupport;
OculusFriend.PresenceState = (EOnlinePresenceState::Type)(int32)Presence.Status.State;
OculusFriend.UniqueNetID = Friend->GetUserId();
OculusFriendList.Add(OculusFriend);
}
OnSuccess.Broadcast(OculusFriendList);
return;
}
}
OnFailure.Broadcast(OculusFriendList);
}
Code is placed in a simple 'UOnlineBlueprintCallProxyBase' child, which Epic uses to create async blueprint nodes.04-11-2018 08:13 AM
04-16-2018 04:32 AM
So you are filling in the Precense here:for (size_t FriendIndex = 0; FriendIndex < UserNum; ++FriendIndex)
PresenceStatus, FriendInviteTokenString));
{
auto Friend = ovr_UserArray_GetElement(UserArray, FriendIndex);
auto FriendId = ovr_User_GetID(Friend);
auto FriendDisplayName = ovr_User_GetOculusID(Friend);
auto FriendPresenceStatus = ovr_User_GetPresenceStatus(Friend);
auto FriendInviteToken = ovr_User_GetInviteToken(Friend);
FString FriendInviteTokenString(UTF8_TO_TCHAR((FriendInviteToken != nullptr) ? FriendInviteToken : ""));
TSharedRef<FOnlineOculusFriend> OnlineFriend(new FOnlineOculusFriend(FriendId, FriendDisplayName, Friend
OutList.Add(FriendId, OnlineFriend);
}
auto FriendPresenceStatus = ovr_User_GetPresenceStatus(Friend);
While "ovr_User_GetPresenceStatus" only returns "Online" "Offline" and "Unknown" and sets "bIsOnline" like this in the Struct Constructor:
Presence.bIsOnline = FriendPresenceStatus == ovrUserPresenceStatus_Online;
04-16-2018 09:12 AM