diff --git a/Content/DedicatedServers/Portal/WBP_JoinGame.uasset b/Content/DedicatedServers/Portal/WBP_JoinGame.uasset index 6b98dde1..1fed06a1 100644 Binary files a/Content/DedicatedServers/Portal/WBP_JoinGame.uasset and b/Content/DedicatedServers/Portal/WBP_JoinGame.uasset differ diff --git a/Source/DedicatedServers/Private/UI/API/GameSessions/JoinGame.cpp b/Source/DedicatedServers/Private/UI/API/GameSessions/JoinGame.cpp index b606d3df..dbdfe37d 100644 --- a/Source/DedicatedServers/Private/UI/API/GameSessions/JoinGame.cpp +++ b/Source/DedicatedServers/Private/UI/API/GameSessions/JoinGame.cpp @@ -2,3 +2,9 @@ #include "UI/API/GameSessions/JoinGame.h" +#include "Components/TextBlock.h" + +void UJoinGame::SetStatusMessage(const FString& Message) const +{ + TextBlock_StatusMessage->SetText(FText::FromString(Message)); +} diff --git a/Source/DedicatedServers/Private/UI/Portal/PortalManager.cpp b/Source/DedicatedServers/Private/UI/Portal/PortalManager.cpp index 5723e91b..57d091a7 100644 --- a/Source/DedicatedServers/Private/UI/Portal/PortalManager.cpp +++ b/Source/DedicatedServers/Private/UI/Portal/PortalManager.cpp @@ -2,3 +2,8 @@ #include "UI/Portal/PortalManager.h" + +void UPortalManager::JoinGameSession() +{ + BroadcastJoinGameSessionMessage.Broadcast(TEXT("Searching for Game Session...")); +} diff --git a/Source/DedicatedServers/Private/UI/Portal/Signin/SignInOverlay.cpp b/Source/DedicatedServers/Private/UI/Portal/Signin/SignInOverlay.cpp index f7e446ce..a21b286c 100644 --- a/Source/DedicatedServers/Private/UI/Portal/Signin/SignInOverlay.cpp +++ b/Source/DedicatedServers/Private/UI/Portal/Signin/SignInOverlay.cpp @@ -13,4 +13,20 @@ void USignInOverlay::NativeConstruct() check(PortalManagerClass); PortalManager = NewObject(PortalManagerClass); + + JoinGameWidget->Button_JoinGame->OnClicked.AddDynamic(this, &USignInOverlay::OnJoinGameButtonClicked); +} + +void USignInOverlay::OnJoinGameButtonClicked() +{ + check (IsValid(PortalManager)); + + PortalManager->BroadcastJoinGameSessionMessage.AddDynamic(this, &USignInOverlay::UpdateJoinGameStatusMessage); + PortalManager->JoinGameSession(); + JoinGameWidget->Button_JoinGame->SetIsEnabled(false); +} + +void USignInOverlay::UpdateJoinGameStatusMessage(const FString& StatusMessage) +{ + JoinGameWidget->SetStatusMessage(StatusMessage); } diff --git a/Source/DedicatedServers/Public/UI/API/GameSessions/JoinGame.h b/Source/DedicatedServers/Public/UI/API/GameSessions/JoinGame.h index b8db1ad0..188d7a88 100644 --- a/Source/DedicatedServers/Public/UI/API/GameSessions/JoinGame.h +++ b/Source/DedicatedServers/Public/UI/API/GameSessions/JoinGame.h @@ -24,4 +24,6 @@ public: UPROPERTY(meta = (BindWidget)) TObjectPtr TextBlock_StatusMessage; + + void SetStatusMessage(const FString& Message) const; }; diff --git a/Source/DedicatedServers/Public/UI/Portal/PortalManager.h b/Source/DedicatedServers/Public/UI/Portal/PortalManager.h index 549d2299..bc8767f3 100644 --- a/Source/DedicatedServers/Public/UI/Portal/PortalManager.h +++ b/Source/DedicatedServers/Public/UI/Portal/PortalManager.h @@ -6,6 +6,8 @@ #include "UI/HTTP/HTTPRequestManager.h" #include "PortalManager.generated.h" +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBroadcastJoinGameSessionMessage, const FString&, StatusMessage); + /** * */ @@ -13,4 +15,11 @@ UCLASS() class DEDICATEDSERVERS_API UPortalManager : public UHTTPRequestManager { GENERATED_BODY() + +public: + + UPROPERTY(BlueprintAssignable) + FBroadcastJoinGameSessionMessage BroadcastJoinGameSessionMessage; + + void JoinGameSession(); }; diff --git a/Source/DedicatedServers/Public/UI/Portal/Signin/SignInOverlay.h b/Source/DedicatedServers/Public/UI/Portal/Signin/SignInOverlay.h index b162cece..6d465d6a 100644 --- a/Source/DedicatedServers/Public/UI/Portal/Signin/SignInOverlay.h +++ b/Source/DedicatedServers/Public/UI/Portal/Signin/SignInOverlay.h @@ -34,4 +34,10 @@ private: UPROPERTY() TObjectPtr PortalManager; + + UFUNCTION() + void OnJoinGameButtonClicked(); + + UFUNCTION() + void UpdateJoinGameStatusMessage(const FString& StatusMessage); };