[LYN-7530] Fix matchmaking request type typo and add more matchmaking notifications (#4774)
* [LYN-7530] Fix matchmaking request type typo and add more matchmaking notifications Signed-off-by: onecent1101 <liug@amazon.com>
This commit is contained in:
+11
-5
@@ -97,6 +97,7 @@ namespace AWSGameLift
|
||||
AZ_TracePrintf(AWSGameLiftClientLocalTicketTrackerName,
|
||||
"Matchmaking ticket %s is complete.", ticket.GetTicketId().c_str());
|
||||
RequestPlayerJoinMatch(ticket, playerId);
|
||||
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchComplete);
|
||||
m_status = TicketTrackerStatus::Idle;
|
||||
return;
|
||||
}
|
||||
@@ -104,25 +105,28 @@ namespace AWSGameLift
|
||||
ticket.GetStatus() == Aws::GameLift::Model::MatchmakingConfigurationStatus::FAILED ||
|
||||
ticket.GetStatus() == Aws::GameLift::Model::MatchmakingConfigurationStatus::CANCELLED)
|
||||
{
|
||||
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, "Matchmaking ticket %s is not complete, %s",
|
||||
ticket.GetTicketId().c_str(), ticket.GetStatusReason().c_str());
|
||||
AZ_Warning(AWSGameLiftClientLocalTicketTrackerName, false, "Matchmaking ticket %s is not complete, %s",
|
||||
ticket.GetTicketId().c_str(), ticket.GetStatusMessage().c_str());
|
||||
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchFailure);
|
||||
m_status = TicketTrackerStatus::Idle;
|
||||
return;
|
||||
}
|
||||
else if (ticket.GetStatus() == Aws::GameLift::Model::MatchmakingConfigurationStatus::REQUIRES_ACCEPTANCE)
|
||||
{
|
||||
// broadcast acceptance requires to player
|
||||
AzFramework::MatchAcceptanceNotificationBus::Broadcast(&AzFramework::MatchAcceptanceNotifications::OnMatchAcceptance);
|
||||
AZ_TracePrintf(AWSGameLiftClientLocalTicketTrackerName, "Matchmaking ticket %s is pending on acceptance, %s.",
|
||||
ticket.GetTicketId().c_str(), ticket.GetStatusMessage().c_str());
|
||||
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchAcceptance);
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_TracePrintf(AWSGameLiftClientLocalTicketTrackerName, "Matchmaking ticket %s is processing, %s.",
|
||||
ticket.GetTicketId().c_str(), ticket.GetStatusReason().c_str());
|
||||
ticket.GetTicketId().c_str(), ticket.GetStatusMessage().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, "Unable to find expected ticket with id %s", ticketId.c_str());
|
||||
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchError);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -130,11 +134,13 @@ namespace AWSGameLift
|
||||
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, AWSGameLiftErrorMessageTemplate,
|
||||
describeMatchmakingOutcome.GetError().GetExceptionName().c_str(),
|
||||
describeMatchmakingOutcome.GetError().GetMessage().c_str());
|
||||
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Error(AWSGameLiftClientLocalTicketTrackerName, false, AWSGameLiftClientMissingErrorMessage);
|
||||
AzFramework::MatchmakingNotificationBus::Broadcast(&AzFramework::MatchmakingNotifications::OnMatchError);
|
||||
}
|
||||
m_waitEvent.try_acquire_for(AZStd::chrono::milliseconds(m_pollingPeriodInMS));
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
#include <AzCore/std/parallel/mutex.h>
|
||||
#include <AzCore/std/parallel/thread.h>
|
||||
|
||||
#include <Request/IAWSGameLiftRequests.h>
|
||||
#include <Request/AWSGameLiftMatchmakingRequestBus.h>
|
||||
|
||||
#include <aws/gamelift/model/MatchmakingTicket.h>
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <AWSCoreBus.h>
|
||||
#include <Credential/AWSCredentialBus.h>
|
||||
#include <Framework/AWSApiJobConfig.h>
|
||||
#include <ResourceMapping/AWSResourceMappingBus.h>
|
||||
|
||||
#include <AWSGameLiftClientManager.h>
|
||||
@@ -75,7 +76,15 @@ namespace AWSGameLift
|
||||
bool AWSGameLiftClientManager::ConfigureGameLiftClient(const AZStd::string& region)
|
||||
{
|
||||
AZ::Interface<IAWSGameLiftInternalRequests>::Get()->SetGameLiftClient(nullptr);
|
||||
|
||||
Aws::Client::ClientConfiguration clientConfig;
|
||||
AWSCore::AwsApiJobConfig* defaultConfig = nullptr;
|
||||
AWSCore::AWSCoreRequestBus::BroadcastResult(defaultConfig, &AWSCore::AWSCoreRequests::GetDefaultConfig);
|
||||
if (defaultConfig)
|
||||
{
|
||||
clientConfig = defaultConfig->GetClientConfiguration();
|
||||
}
|
||||
|
||||
// Set up client endpoint or region
|
||||
AZStd::string localEndpoint = "";
|
||||
#if defined(AWSGAMELIFT_DEV)
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/std/smart_ptr/shared_ptr.h>
|
||||
#include <AzFramework/Matchmaking/MatchmakingNotifications.h>
|
||||
|
||||
#include <Request/IAWSGameLiftRequests.h>
|
||||
#include <Request/AWSGameLiftRequestBus.h>
|
||||
#include <Request/AWSGameLiftSessionRequestBus.h>
|
||||
#include <Request/AWSGameLiftMatchmakingRequestBus.h>
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
@@ -23,22 +26,37 @@ namespace AWSGameLift
|
||||
struct AWSGameLiftStartMatchmakingRequest;
|
||||
struct AWSGameLiftStopMatchmakingRequest;
|
||||
|
||||
// MatchAcceptanceNotificationBus EBus handler for scripting
|
||||
class AWSGameLiftMatchAcceptanceNotificationBusHandler
|
||||
: public AzFramework::MatchAcceptanceNotificationBus::Handler
|
||||
// MatchmakingNotificationBus EBus handler for scripting
|
||||
class AWSGameLiftMatchmakingNotificationBusHandler
|
||||
: public AzFramework::MatchmakingNotificationBus::Handler
|
||||
, public AZ::BehaviorEBusHandler
|
||||
{
|
||||
public:
|
||||
AZ_EBUS_BEHAVIOR_BINDER(
|
||||
AWSGameLiftMatchAcceptanceNotificationBusHandler,
|
||||
AWSGameLiftMatchmakingNotificationBusHandler,
|
||||
"{CBE057D3-F5CE-46D3-B02D-8A6A1446B169}",
|
||||
AZ::SystemAllocator,
|
||||
OnMatchAcceptance);
|
||||
OnMatchAcceptance, OnMatchComplete, OnMatchError, OnMatchFailure);
|
||||
|
||||
void OnMatchAcceptance() override
|
||||
{
|
||||
Call(FN_OnMatchAcceptance);
|
||||
}
|
||||
|
||||
void OnMatchComplete() override
|
||||
{
|
||||
Call(FN_OnMatchComplete);
|
||||
}
|
||||
|
||||
void OnMatchError() override
|
||||
{
|
||||
Call(FN_OnMatchError);
|
||||
}
|
||||
|
||||
void OnMatchFailure() override
|
||||
{
|
||||
Call(FN_OnMatchFailure);
|
||||
}
|
||||
};
|
||||
|
||||
// MatchmakingAsyncRequestNotificationBus EBus handler for scripting
|
||||
|
||||
+18
-17
@@ -65,13 +65,6 @@ namespace AWSGameLift
|
||||
->Event("CreatePlayerId", &AWSGameLiftRequestBus::Events::CreatePlayerId,
|
||||
{ { { "IncludeBrackets", "" },
|
||||
{ "IncludeDashes", "" } } });
|
||||
|
||||
behaviorContext->EBus<AWSGameLiftMatchmakingEventRequestBus>("AWSGameLiftMatchmakingEventRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("StartPolling", &AWSGameLiftMatchmakingEventRequestBus::Events::StartPolling,
|
||||
{ { { "TicketId", "" },
|
||||
{ "PlayerId", "" } } })
|
||||
->Event("StopPolling", &AWSGameLiftMatchmakingEventRequestBus::Events::StopPolling);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +121,7 @@ namespace AWSGameLift
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AWSGameLiftMatchmakingAsyncRequestBus>("AWSGameLiftMatchmakingAsyncRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
|
||||
->Event("AcceptMatchAsync", &AWSGameLiftMatchmakingAsyncRequestBus::Events::AcceptMatchAsync,
|
||||
{ { { "AcceptMatchRequest", "" } } })
|
||||
->Event("StartMatchmakingAsync", &AWSGameLiftMatchmakingAsyncRequestBus::Events::StartMatchmakingAsync,
|
||||
@@ -137,20 +130,28 @@ namespace AWSGameLift
|
||||
{ { { "StopMatchmakingRequest", "" } } });
|
||||
|
||||
behaviorContext->EBus<AzFramework::MatchmakingAsyncRequestNotificationBus>("AWSGameLiftMatchmakingAsyncRequestNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
|
||||
->Handler<AWSGameLiftMatchmakingAsyncRequestNotificationBusHandler>();
|
||||
|
||||
behaviorContext->EBus<AWSGameLiftMatchmakingRequestBus>("AWSGameLiftMatchmakingRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Event("AcceptMatch", &AWSGameLiftMatchmakingRequestBus::Events::AcceptMatch, { { { "AcceptMatchRequest", "" } } })
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
|
||||
->Event("AcceptMatch", &AWSGameLiftMatchmakingRequestBus::Events::AcceptMatch,
|
||||
{ { { "AcceptMatchRequest", "" } } })
|
||||
->Event("StartMatchmaking", &AWSGameLiftMatchmakingRequestBus::Events::StartMatchmaking,
|
||||
{ { { "StartMatchmakingRequest", "" } } })
|
||||
->Event("StopMatchmaking", &AWSGameLiftMatchmakingRequestBus::Events::StopMatchmaking,
|
||||
{ { { "StopMatchmakingRequest", "" } } });
|
||||
|
||||
behaviorContext->EBus<AzFramework::MatchAcceptanceNotificationBus>("AWSGameLiftMatchAcceptanceNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Handler<AWSGameLiftMatchAcceptanceNotificationBusHandler>();
|
||||
behaviorContext->EBus<AWSGameLiftMatchmakingEventRequestBus>("AWSGameLiftMatchmakingEventRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
|
||||
->Event("StartPolling", &AWSGameLiftMatchmakingEventRequestBus::Events::StartPolling,
|
||||
{ { { "TicketId", "" },
|
||||
{ "PlayerId", "" } } })
|
||||
->Event("StopPolling", &AWSGameLiftMatchmakingEventRequestBus::Events::StopPolling);
|
||||
|
||||
behaviorContext->EBus<AzFramework::MatchmakingNotificationBus>("AWSGameLiftMatchmakingNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Matchmaking")
|
||||
->Handler<AWSGameLiftMatchmakingNotificationBusHandler>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ namespace AWSGameLift
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->EBus<AWSGameLiftSessionAsyncRequestBus>("AWSGameLiftSessionAsyncRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Session")
|
||||
->Event("CreateSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::CreateSessionAsync,
|
||||
{ { { "CreateSessionRequest", "" } } })
|
||||
->Event("JoinSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::JoinSessionAsync, { { { "JoinSessionRequest", "" } } })
|
||||
@@ -175,11 +176,11 @@ namespace AWSGameLift
|
||||
->Event("LeaveSessionAsync", &AWSGameLiftSessionAsyncRequestBus::Events::LeaveSessionAsync);
|
||||
|
||||
behaviorContext->EBus<AzFramework::SessionAsyncRequestNotificationBus>("AWSGameLiftSessionAsyncRequestNotificationBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Session")
|
||||
->Handler<AWSGameLiftSessionAsyncRequestNotificationBusHandler>();
|
||||
|
||||
behaviorContext->EBus<AWSGameLiftSessionRequestBus>("AWSGameLiftSessionRequestBus")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift")
|
||||
->Attribute(AZ::Script::Attributes::Category, "AWSGameLift/Session")
|
||||
->Event("CreateSession", &AWSGameLiftSessionRequestBus::Events::CreateSession, { { { "CreateSessionRequest", "" } } })
|
||||
->Event("JoinSession", &AWSGameLiftSessionRequestBus::Events::JoinSession, { { { "JoinSessionRequest", "" } } })
|
||||
->Event("SearchSessions", &AWSGameLiftSessionRequestBus::Events::SearchSessions, { { { "SearchSessionsRequest", "" } } })
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace Aws
|
||||
|
||||
namespace AWSGameLift
|
||||
{
|
||||
//! IAWSGameLiftRequests
|
||||
//! IAWSGameLiftInternalRequests
|
||||
//! GameLift Gem internal interface which is used to fetch gem global GameLift client
|
||||
class IAWSGameLiftInternalRequests
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user