Move multiplayer session interface out of AzFramework library (#7338)

Signed-off-by: onecent1101 <liug@amazon.com>
This commit is contained in:
Vincent Liu
2022-02-03 11:53:00 -08:00
committed by GitHub
parent 58f4a5259a
commit 74a876ae3b
65 changed files with 368 additions and 368 deletions
@@ -69,7 +69,7 @@ namespace AWSGameLift
}
}
bool ValidateAcceptMatchRequest(const AzFramework::AcceptMatchRequest& AcceptMatchRequest)
bool ValidateAcceptMatchRequest(const Multiplayer::AcceptMatchRequest& AcceptMatchRequest)
{
auto gameliftAcceptMatchRequest = azrtti_cast<const AWSGameLiftAcceptMatchRequest*>(&AcceptMatchRequest);
bool isValid = gameliftAcceptMatchRequest &&
@@ -26,6 +26,6 @@ namespace AWSGameLift
void AcceptMatch(const AWSGameLiftAcceptMatchRequest& AcceptMatchRequest);
// Validate AcceptMatchRequest and check required request parameters
bool ValidateAcceptMatchRequest(const AzFramework::AcceptMatchRequest& AcceptMatchRequest);
bool ValidateAcceptMatchRequest(const Multiplayer::AcceptMatchRequest& AcceptMatchRequest);
} // namespace AcceptMatchActivity
} // namespace AWSGameLift
@@ -99,7 +99,7 @@ namespace AWSGameLift
return result;
}
bool ValidateCreateSessionRequest(const AzFramework::CreateSessionRequest& createSessionRequest)
bool ValidateCreateSessionRequest(const Multiplayer::CreateSessionRequest& createSessionRequest)
{
auto gameliftCreateSessionRequest = azrtti_cast<const AWSGameLiftCreateSessionRequest*>(&createSessionRequest);
@@ -25,7 +25,7 @@ namespace AWSGameLift
AZStd::string CreateSession(const AWSGameLiftCreateSessionRequest& createSessionRequest);
// Validate CreateSessionRequest and check required request parameters
bool ValidateCreateSessionRequest(const AzFramework::CreateSessionRequest& createSessionRequest);
bool ValidateCreateSessionRequest(const Multiplayer::CreateSessionRequest& createSessionRequest);
} // namespace CreateSessionActivity
} // namespace AWSGameLift
@@ -87,7 +87,7 @@ namespace AWSGameLift
return result;
}
bool ValidateCreateSessionOnQueueRequest(const AzFramework::CreateSessionRequest& createSessionRequest)
bool ValidateCreateSessionOnQueueRequest(const Multiplayer::CreateSessionRequest& createSessionRequest)
{
auto gameliftCreateSessionOnQueueRequest =
azrtti_cast<const AWSGameLiftCreateSessionOnQueueRequest*>(&createSessionRequest);
@@ -26,7 +26,7 @@ namespace AWSGameLift
AZStd::string CreateSessionOnQueue(const AWSGameLiftCreateSessionOnQueueRequest& createSessionOnQueueRequest);
// Validate CreateSessionOnQueueRequest and check required request parameters
bool ValidateCreateSessionOnQueueRequest(const AzFramework::CreateSessionRequest& createSessionRequest);
bool ValidateCreateSessionOnQueueRequest(const Multiplayer::CreateSessionRequest& createSessionRequest);
} // namespace CreateSessionOnQueueActivity
} // namespace AWSGameLift
@@ -39,10 +39,10 @@ namespace AWSGameLift
return request;
}
AzFramework::SessionConnectionConfig BuildSessionConnectionConfig(
Multiplayer::SessionConnectionConfig BuildSessionConnectionConfig(
const Aws::GameLift::Model::CreatePlayerSessionOutcome& createPlayerSessionOutcome)
{
AzFramework::SessionConnectionConfig sessionConnectionConfig;
Multiplayer::SessionConnectionConfig sessionConnectionConfig;
auto createPlayerSessionResult = createPlayerSessionOutcome.GetResult();
// TODO: AWSNativeSDK needs to be updated to support this attribute, and it is a must have for TLS certificate enabled fleet
//sessionConnectionConfig.m_dnsName = createPlayerSessionResult.GetPlayerSession().GetDnsName().c_str();
@@ -95,10 +95,10 @@ namespace AWSGameLift
bool result = false;
if (createPlayerSessionOutcome.IsSuccess())
{
auto clientRequestHandler = AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Get();
auto clientRequestHandler = AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Get();
if (clientRequestHandler)
{
AzFramework::SessionConnectionConfig sessionConnectionConfig =
Multiplayer::SessionConnectionConfig sessionConnectionConfig =
BuildSessionConnectionConfig(createPlayerSessionOutcome);
AZ_TracePrintf(AWSGameLiftJoinSessionActivityName,
@@ -114,7 +114,7 @@ namespace AWSGameLift
return result;
}
bool ValidateJoinSessionRequest(const AzFramework::JoinSessionRequest& joinSessionRequest)
bool ValidateJoinSessionRequest(const Multiplayer::JoinSessionRequest& joinSessionRequest)
{
auto gameliftJoinSessionRequest = azrtti_cast<const AWSGameLiftJoinSessionRequest*>(&joinSessionRequest);
@@ -8,7 +8,7 @@
#pragma once
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Request/AWSGameLiftJoinSessionRequest.h>
@@ -31,7 +31,7 @@ namespace AWSGameLift
const AWSGameLiftJoinSessionRequest& joinSessionRequest);
// Build session connection config by using CreatePlayerSessionOutcome
AzFramework::SessionConnectionConfig BuildSessionConnectionConfig(
Multiplayer::SessionConnectionConfig BuildSessionConnectionConfig(
const Aws::GameLift::Model::CreatePlayerSessionOutcome& createPlayerSessionOutcome);
// Create CreatePlayerSessionRequest and make a CreatePlayerSession call through GameLift client
@@ -43,7 +43,7 @@ namespace AWSGameLift
const Aws::GameLift::Model::CreatePlayerSessionOutcome& createPlayerSessionOutcome);
// Validate JoinSessionRequest and check required request parameters
bool ValidateJoinSessionRequest(const AzFramework::JoinSessionRequest& joinSessionRequest);
bool ValidateJoinSessionRequest(const Multiplayer::JoinSessionRequest& joinSessionRequest);
} // namespace JoinSessionActivity
} // namespace AWSGameLift
@@ -8,7 +8,7 @@
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/ISessionHandlingRequests.h>
#include <Multiplayer/Session/ISessionHandlingRequests.h>
#include <Activity/AWSGameLiftLeaveSessionActivity.h>
@@ -18,7 +18,7 @@ namespace AWSGameLift
{
void LeaveSession()
{
auto clientRequestHandler = AZ::Interface<AzFramework::ISessionHandlingClientRequests>::Get();
auto clientRequestHandler = AZ::Interface<Multiplayer::ISessionHandlingClientRequests>::Get();
if (clientRequestHandler)
{
AZ_TracePrintf(AWSGameLiftLeaveSessionActivityName, "Requesting player to leave the current session ...");
@@ -8,7 +8,7 @@
#include <AzCore/Interface/Interface.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzFramework/Session/SessionConfig.h>
#include <Multiplayer/Session/SessionConfig.h>
#include <Activity/AWSGameLiftSearchSessionsActivity.h>
#include <AWSGameLiftSessionConstants.h>
@@ -67,10 +67,10 @@ namespace AWSGameLift
return request;
}
AzFramework::SearchSessionsResponse SearchSessions(
Multiplayer::SearchSessionsResponse SearchSessions(
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest)
{
AzFramework::SearchSessionsResponse response;
Multiplayer::SearchSessionsResponse response;
auto gameliftClient = AZ::Interface<IAWSGameLiftInternalRequests>::Get()->GetGameLiftClient();
if (!gameliftClient)
@@ -98,15 +98,15 @@ namespace AWSGameLift
return response;
}
AzFramework::SearchSessionsResponse ParseResponse(
Multiplayer::SearchSessionsResponse ParseResponse(
const Aws::GameLift::Model::SearchGameSessionsResult& gameLiftSearchSessionsResult)
{
AzFramework::SearchSessionsResponse response;
Multiplayer::SearchSessionsResponse response;
response.m_nextToken = gameLiftSearchSessionsResult.GetNextToken().c_str();
for (const Aws::GameLift::Model::GameSession& gameSession : gameLiftSearchSessionsResult.GetGameSessions())
{
AzFramework::SessionConfig session;
Multiplayer::SessionConfig session;
session.m_creationTime = gameSession.GetCreationTime().Millis();
session.m_creatorId = gameSession.GetCreatorId().c_str();
session.m_currentPlayer = gameSession.GetCurrentPlayerSessionCount();
@@ -133,7 +133,7 @@ namespace AWSGameLift
return response;
};
bool ValidateSearchSessionsRequest(const AzFramework::SearchSessionsRequest& searchSessionsRequest)
bool ValidateSearchSessionsRequest(const Multiplayer::SearchSessionsRequest& searchSessionsRequest)
{
auto gameliftSearchSessionsRequest = azrtti_cast<const AWSGameLiftSearchSessionsRequest*>(&searchSessionsRequest);
if (gameliftSearchSessionsRequest &&
@@ -25,14 +25,14 @@ namespace AWSGameLift
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest);
// Create SearchGameSessionsRequest and make a SeachGameSessions call through GameLift client
AzFramework::SearchSessionsResponse SearchSessions(
Multiplayer::SearchSessionsResponse SearchSessions(
const AWSGameLiftSearchSessionsRequest& searchSessionsRequest);
// Convert from Aws::GameLift::Model::SearchGameSessionsResult to AzFramework::SearchSessionsResponse.
AzFramework::SearchSessionsResponse ParseResponse(
// Convert from Aws::GameLift::Model::SearchGameSessionsResult to Multiplayer::SearchSessionsResponse.
Multiplayer::SearchSessionsResponse ParseResponse(
const Aws::GameLift::Model::SearchGameSessionsResult& gameLiftSearchSessionsResult);
// Validate SearchSessionsRequest and check required request parameters
bool ValidateSearchSessionsRequest(const AzFramework::SearchSessionsRequest& searchSessionsRequest);
bool ValidateSearchSessionsRequest(const Multiplayer::SearchSessionsRequest& searchSessionsRequest);
} // namespace SearchSessionsActivity
} // namespace AWSGameLift
@@ -110,7 +110,7 @@ namespace AWSGameLift
return result;
}
bool ValidateStartMatchmakingRequest(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest)
bool ValidateStartMatchmakingRequest(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest)
{
auto gameliftStartMatchmakingRequest = azrtti_cast<const AWSGameLiftStartMatchmakingRequest*>(&startMatchmakingRequest);
bool isValid = gameliftStartMatchmakingRequest &&
@@ -26,6 +26,6 @@ namespace AWSGameLift
AZStd::string StartMatchmaking(const AWSGameLiftStartMatchmakingRequest& startMatchmakingRequest);
// Validate StartMatchmakingRequest and check required request parameters
bool ValidateStartMatchmakingRequest(const AzFramework::StartMatchmakingRequest& startMatchmakingRequest);
bool ValidateStartMatchmakingRequest(const Multiplayer::StartMatchmakingRequest& startMatchmakingRequest);
} // namespace StartMatchmakingActivity
} // namespace AWSGameLift
@@ -59,7 +59,7 @@ namespace AWSGameLift
}
}
bool ValidateStopMatchmakingRequest(const AzFramework::StopMatchmakingRequest& StopMatchmakingRequest)
bool ValidateStopMatchmakingRequest(const Multiplayer::StopMatchmakingRequest& StopMatchmakingRequest)
{
auto gameliftStopMatchmakingRequest = azrtti_cast<const AWSGameLiftStopMatchmakingRequest*>(&StopMatchmakingRequest);
bool isValid = gameliftStopMatchmakingRequest && (!gameliftStopMatchmakingRequest->m_ticketId.empty());
@@ -26,6 +26,6 @@ namespace AWSGameLift
void StopMatchmaking(const AWSGameLiftStopMatchmakingRequest& stopMatchmakingRequest);
// Validate StopMatchmakingRequest and check required request parameters
bool ValidateStopMatchmakingRequest(const AzFramework::StopMatchmakingRequest& stopMatchmakingRequest);
bool ValidateStopMatchmakingRequest(const Multiplayer::StopMatchmakingRequest& stopMatchmakingRequest);
} // namespace StopMatchmakingActivity
} // namespace AWSGameLift