From 6f4c0c2ce898dcdf84cb02c0e34e3e740a72c1ae Mon Sep 17 00:00:00 2001 From: puvvadar Date: Mon, 7 Jun 2021 17:12:29 -0700 Subject: [PATCH] Rename interfaces for clarity --- .../Session/ISessionHandlingRequests.h | 20 +++++++++---------- .../Source/MultiplayerSystemComponent.cpp | 12 ++++++----- .../Code/Source/MultiplayerSystemComponent.h | 4 ++-- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Session/ISessionHandlingRequests.h b/Code/Framework/AzFramework/AzFramework/Session/ISessionHandlingRequests.h index 2537842d8a..10c1d1cdd5 100644 --- a/Code/Framework/AzFramework/AzFramework/Session/ISessionHandlingRequests.h +++ b/Code/Framework/AzFramework/AzFramework/Session/ISessionHandlingRequests.h @@ -45,14 +45,14 @@ namespace AzFramework AZStd::string m_playerSessionId; }; - //! ISessionLocalUserRequests - //! Requests made to the local user to manage their connection to a session - class ISessionLocalUserRequests + //! ISessionHandlingClientRequests + //! Requests made to the client to manage their connection to a session + class ISessionHandlingClientRequests { public: - AZ_RTTI(ISessionLocalUserRequests, "{41DE6BD3-72BC-4443-BFF9-5B1B9396657A}"); - ISessionLocalUserRequests() = default; - virtual ~ISessionLocalUserRequests() = default; + AZ_RTTI(ISessionHandlingClientRequests, "{41DE6BD3-72BC-4443-BFF9-5B1B9396657A}"); + ISessionHandlingClientRequests() = default; + virtual ~ISessionHandlingClientRequests() = default; // Request the player join session // @param sessionConnectionConfig The required properties to handle the player join session process @@ -65,12 +65,12 @@ namespace AzFramework //! ISessionProviderRequests //! Requests made to the service providing server/fleet management by the server - class ISessionProviderRequests + class ISessionHandlingProviderRequests { public: - AZ_RTTI(ISessionProviderRequests, "{4F0C17BA-F470-4242-A8CB-EC7EA805257C}"); - ISessionProviderRequests() = default; - virtual ~ISessionProviderRequests() = default; + AZ_RTTI(ISessionHandlingProviderRequests, "{4F0C17BA-F470-4242-A8CB-EC7EA805257C}"); + ISessionHandlingProviderRequests() = default; + virtual ~ISessionHandlingProviderRequests() = default; // Handle the destroy session process virtual void HandleDestroySession() = 0; diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index 44e17c0ef4..336f27e7e4 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -157,6 +157,7 @@ namespace Multiplayer m_networkInterface = AZ::Interface::Get()->CreateNetworkInterface(AZ::Name(MPNetworkInterfaceName), sv_protocol, TrustZone::ExternalClientToServer, *this); m_consoleCommandHandler.Connect(AZ::Interface::Get()->GetConsoleCommandInvokedEvent()); AZ::Interface::Register(this); + AZ::Interface::Register(this); //! Register our gems multiplayer components to assign NetComponentIds RegisterMultiplayerComponents(); @@ -164,6 +165,7 @@ namespace Multiplayer void MultiplayerSystemComponent::Deactivate() { + AZ::Interface::Unregister(this); AZ::Interface::Unregister(this); AzFramework::SessionNotificationBus::Handler::BusDisconnect(); AZ::TickBus::Handler::BusDisconnect(); @@ -195,14 +197,14 @@ namespace Multiplayer bool MultiplayerSystemComponent::OnCreateSessionBegin(const AzFramework::SessionConfig& sessionConfig) { // Check if session manager has a certificate for us and pass it along if so - AZ::CVarFixedString externalCertPath = AZ::CVarFixedString(AZ::Interface::Get()->GetExternalSessionCertificate()); + AZ::CVarFixedString externalCertPath = AZ::CVarFixedString(AZ::Interface::Get()->GetExternalSessionCertificate()); if (!externalCertPath.empty()) { AZ::CVarFixedString commandString = "net_SslExternalCertificateFile " + externalCertPath; AZ::Interface::Get()->PerformCommand(commandString.c_str()); } - AZ::CVarFixedString internalCertPath = AZ::CVarFixedString(AZ::Interface::Get()->GetInternalSessionCertificate()); + AZ::CVarFixedString internalCertPath = AZ::CVarFixedString(AZ::Interface::Get()->GetInternalSessionCertificate()); if (!internalCertPath.empty()) { AZ::CVarFixedString commandString = "net_SslInternalCertificateFile " + internalCertPath; @@ -533,7 +535,7 @@ namespace Multiplayer AzFramework::PlayerConnectionConfig config; config.m_playerConnectionId = aznumeric_cast(connection->GetConnectionId()); config.m_playerSessionId = AZStd::to_string(config.m_playerConnectionId); - AZ::Interface::Get()->ValidatePlayerJoinSession(config); + AZ::Interface::Get()->ValidatePlayerJoinSession(config); } // Hosts will spawn a new default player prefab for the user that just connected @@ -610,7 +612,7 @@ namespace Multiplayer AzFramework::PlayerConnectionConfig config; config.m_playerConnectionId = aznumeric_cast(connection->GetConnectionId()); config.m_playerSessionId = AZStd::to_string(config.m_playerConnectionId); - AZ::Interface::Get()->HandlePlayerLeaveSession(config); + AZ::Interface::Get()->HandlePlayerLeaveSession(config); } } @@ -620,7 +622,7 @@ namespace Multiplayer { if (m_networkInterface->GetConnectionSet().GetConnectionCount() == 0) { - AZ::Interface::Get()->HandleDestroySession(); + AZ::Interface::Get()->HandleDestroySession(); } } } diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h index f6ca670d87..c089b243bd 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h @@ -46,7 +46,7 @@ namespace Multiplayer : public AZ::Component , public AZ::TickBus::Handler , public AzFramework::SessionNotificationBus::Handler - , public AzFramework::ISessionLocalUserRequests + , public AzFramework::ISessionHandlingClientRequests , public AzNetworking::IConnectionListener , public IMultiplayer { @@ -98,7 +98,7 @@ namespace Multiplayer void OnDisconnect(AzNetworking::IConnection* connection, AzNetworking::DisconnectReason reason, AzNetworking::TerminationEndpoint endpoint) override; //! @} - //! ISessionLocalUserRequests interface + //! ISessionHandlingClientRequests interface //! @{ bool RequestPlayerJoinSession(const AzFramework::SessionConnectionConfig& sessionConnectionConfig) override; void RequestPlayerLeaveSession() override;