From 2d8de0369ce52977c75d4dae364ce88e21682f4d Mon Sep 17 00:00:00 2001 From: Norman Lansing Date: Tue, 31 Mar 2026 08:15:28 -0400 Subject: [PATCH] Lesson 68 - JoinGame Callbacks --- .../Portal/WBP_JoinGame.uasset | Bin 36260 -> 36240 bytes .../Private/UI/API/GameSessions/JoinGame.cpp | 6 ++++++ .../Private/UI/Portal/PortalManager.cpp | 5 +++++ .../UI/Portal/Signin/SignInOverlay.cpp | 16 ++++++++++++++++ .../Public/UI/API/GameSessions/JoinGame.h | 2 ++ .../Public/UI/Portal/PortalManager.h | 9 +++++++++ .../Public/UI/Portal/Signin/SignInOverlay.h | 6 ++++++ 7 files changed, 44 insertions(+) diff --git a/Content/DedicatedServers/Portal/WBP_JoinGame.uasset b/Content/DedicatedServers/Portal/WBP_JoinGame.uasset index 6b98dde1399dd1ad4a2c70a28de70250b2a7b3e5..1fed06a1e7e2ab5129f6ebe15414b26b7fc73163 100644 GIT binary patch delta 591 zcmZ27n`r_NNr+uA%&aW<^>(A)>kuiuyvh5_k9h7ski1dPi;*eDVR98?5bGfa28Ni) z7a4^)4ft=RhP-pYC23I*ssJta1r~j;?ZD;12=p%yG*m;hE6XssFix)3(PBDL0~R^2gHR+@hpZ@8SBojB z9xSq6*MsRAgekA*!Q|Bd7VQTzOB=z=|3GGX6PTH=@4+;w8O*#7WVW<`nf?YIOdPF~ za^xm&Hwa)7>7KlhQEsxjp$ji30}Dew#ElGflPe7Kncnt*bZq7~+Q7)v%d`2QaV5v( zd)69E+7l-4w-x8wYyald-RqD4xlf)PY2QBC%zhOJZ#J`!V`2+%U|?92ym^-6UMoho k$p>?VC!eaF!x%dGV7c(-T{YJj(FG^(sa_F?tM4NSA-)#~c*WUE;RE%tpFI4xzPo);sNk>lhl#vs-ijtmS1 zlP@v~b52WPU|7Jwz)-UJEu)ko)3lVyfthNP^_4xCj8nnP`9S6c2$NsMgGoFMELsm_ z#zC0xRXiq(tGP_BR@Gr@N(alHSM^|e3t`%;c`#|^fJN5>nRD~OOnG$=CY@3+vmeM@ z0Acx4suGP_EvaJP+oYz4p>aRmq6sxPn zR8|ibS+DEC^a{e1*8>Jd16Z^l$n0zcGyemb)lFb#zP<<3vSu*zK9D)11KWPv!CrjinrCBvwrlpXBh;(<9MUB!CesE|R}p)&A#C{p0R` zBK5hi&(K$||08_)-StcR z7}Nd@SsLn=dXQt%!rtwd|HS_`OLqRlf9dhASX~No2*jQCq&l84% zIGg8`tEX?uzT>8GcasQ*HUHO2Th8@5lLc(W>$fd$T+3@xU;k4g^o&MG`PJI{&#IzT z*Hl@Z+IS!@q{;E1UEJg5uP^wwT4g5xXK2}H>FlOtw3;o*us=916-PjXUwNIGotgL7 z&Sgz0Z}hWkf5oFK=WY3P#Ad^}6|bfM$X*z5euP7bV_{l{w3w<@C=k ze;gNy!_4SI*Q!_ivwxDdu_WwVe0%kG+n~#DR;nJl$D!ojX}(5xLVbn(dD+!$U%lea zEKxW-Px<%$_N|5XSmIy*M_8zV>2i@Rm#_cnSetText(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); };