Hello, I am trying to set up a structure where I can receive lobby invitations in the game, but I cannot do this because I cannot find a source. https://learn.microsoft.com/en-us/gaming/playfab/features/multiplayer/lobby/lobby-invites, unfortunately this source is not very descriptive. My code is stuck like this, can you help me?
#include "PFLobbyFunctions.h"
PFLobbyFunctions::PFLobbyFunctions()
{
AllowInvitations2();
}
PFLobbyFunctions::~PFLobbyFunctions()
{
free(entity);
}
void PFLobbyFunctions::Init()
{
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
UE_LOG(LogTemp, Log, TEXT("BAŞLATILDI"));
Sessions->AddOnSessionInviteReceivedDelegate_Handle(FOnSessionInviteReceivedDelegate::CreateRaw(this, &PFLobbyFunctions::OnSessionInviteReceived));
}
else
{
UE_LOG(LogTemp, Log, TEXT("Başlatılmadı 11"));
}
}
else
{
UE_LOG(LogTemp, Log, TEXT("Başlatılmadı 22"));
}
}
void PFLobbyFunctions::OnSessionInviteReceived(const FUniqueNetId& UserId, const FUniqueNetId& FriendId, const FString& InviteText, const FOnlineSessionSearchResult& FriendSearchResult)
{
// Davet alındığında yapılacak işlemler
// FString SessionId = FriendSearchResult.GetSessionIdStr();
UE_LOG(LogTemp, Log, TEXT("Davet alındı. Session ID"));
}
void PFLobbyFunctions::AllowInvitations2() {
entity = (PFEntityKey*)malloc(sizeof(PFEntityKey));
entity->id = "9435B3270D470754";
entity->type = "title_player_account";
HRESULT hr = PFMultiplayerStartListeningForLobbyInvites(Lobbyhandle, entity);
if (FAILED(hr)) {
UE_LOG(LogTemp, Error, TEXT("HATAA %s"), ANSI_TO_TCHAR(PFMultiplayerGetErrorMessage(hr)));
}
else {
UE_LOG(LogTemp, Error, TEXT("HATA YOK"));
}
}