You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb dominik.peacock #jira UE-168182 #preflight 63c6cf3c02024f93d8635de3 [CL 23739781 by jason walter in ue5-main branch]
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ConcertServerUtil.h"
|
|
#include "ConcertMessageData.h"
|
|
#include "IConcertSession.h"
|
|
#include "IConcertServer.h"
|
|
|
|
namespace ConcertUtil::Private
|
|
{
|
|
static TOptional<TPair<FConcertSessionClientInfo, TSharedPtr<IConcertServerSession>>> FindByClient(IConcertServer& Server, const FGuid& ClientEndpointId)
|
|
{
|
|
for (const TSharedPtr<IConcertServerSession>& ServerSession : Server.GetLiveSessions())
|
|
{
|
|
for (const FConcertSessionClientInfo& ClientInfo : ServerSession->GetSessionClients())
|
|
{
|
|
if (ClientEndpointId == ClientInfo.ClientEndpointId)
|
|
{
|
|
return {{ ClientInfo, ServerSession }};
|
|
}
|
|
}
|
|
}
|
|
|
|
return {};
|
|
}
|
|
}
|
|
/*
|
|
TOptional<FConcertSessionClientInfo> ConcertUtil::GetConnectedClientInfo(IConcertServer& Server, const FGuid& ClientEndpointId)
|
|
{
|
|
const TOptional<TPair<FConcertSessionClientInfo, TSharedPtr<IConcertServerSession>>> Result = Private::FindByClient(Server, ClientEndpointId);
|
|
return Result
|
|
? Result->Key
|
|
: TOptional<FConcertSessionClientInfo>();
|
|
}
|
|
*/
|
|
|
|
TArray<FConcertSessionClientInfo> ConcertUtil::GetSessionClients(IConcertServer& Server, const FGuid& SessionId)
|
|
{
|
|
TSharedPtr<IConcertServerSession> ServerSession = Server.GetLiveSession(SessionId);
|
|
if (ServerSession)
|
|
{
|
|
return ServerSession->GetSessionClients();
|
|
}
|
|
return TArray<FConcertSessionClientInfo>();
|
|
}
|
|
|
|
|
|
TSharedPtr<IConcertServerSession> ConcertUtil::GetLiveSessionClientConnectedTo(IConcertServer& Server, const FGuid& ClientEndpointId)
|
|
{
|
|
const TOptional<TPair<FConcertSessionClientInfo, TSharedPtr<IConcertServerSession>>> Result = Private::FindByClient(Server, ClientEndpointId);
|
|
return Result
|
|
? Result->Value
|
|
: TSharedPtr<IConcertServerSession>();
|
|
}
|
|
|
|
|