3 Commits

Author SHA1 Message Date
Norman Lansing
9fb60888ba Lesson 67 - Portal Setup 2026-03-22 17:18:22 -04:00
Norman Lansing
acc105c84d WBP_ListFleetsBox to make it larger, and to allow sizing changes 2026-03-18 06:58:22 -04:00
Norman Lansing
d9eb52c047 Lesson 66 - Displaying Fleet Data 2026-03-17 07:16:52 -04:00
19 changed files with 182 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/API/GameSessions/JoinGame.h"

View File

@@ -5,7 +5,11 @@
#include "Components/Button.h" #include "Components/Button.h"
#include "Components/ScrollBox.h"
#include "Components/TextBlock.h"
#include "UI/API/ListFleets/FleetId.h"
#include "UI/API/ListFleets/ListFleetsBox.h" #include "UI/API/ListFleets/ListFleetsBox.h"
#include "UI/HTTP/HTTPRequestTypes.h"
void UAPITestOverlay::NativeConstruct() void UAPITestOverlay::NativeConstruct()
@@ -31,13 +35,26 @@ void UAPITestOverlay::ListFleetsButtonClicked()
void UAPITestOverlay::OnListFleetsResponseReceived(const FDS_ListFleetsResponse& ListFleetResponse, bool bWasSuccessful) void UAPITestOverlay::OnListFleetsResponseReceived(const FDS_ListFleetsResponse& ListFleetResponse, bool bWasSuccessful)
{ {
if (APITestManager->OnListFleetsResponseReceived.IsAlreadyBound(this, &UAPITestOverlay::OnListFleetsResponseReceived))
{
APITestManager->OnListFleetsResponseReceived.RemoveDynamic(this, &UAPITestOverlay::OnListFleetsResponseReceived);
}
check(FleetIdWidgetClass);
ListFleetsBox->ScrollBox_ListFleets->ClearChildren();
if (bWasSuccessful) if (bWasSuccessful)
{ {
for (const FString& FleetId : ListFleetResponse.FleetIds)
{
UFleetId* FleetIdWidget = CreateWidget<UFleetId>(this, FleetIdWidgetClass);
FleetIdWidget->TextBlock_FleetId->SetText(FText::FromString(FleetId));
ListFleetsBox->ScrollBox_ListFleets->AddChild(FleetIdWidget);
}
} }
else else
{ {
UFleetId* FleetIdWidget = CreateWidget<UFleetId>(this, FleetIdWidgetClass);
FleetIdWidget->TextBlock_FleetId->SetText(FText::FromString("Something went wrong!"));
ListFleetsBox->ScrollBox_ListFleets->AddChild(FleetIdWidget);
} }
ListFleetsBox->Button_ListFleets->SetIsEnabled(true); ListFleetsBox->Button_ListFleets->SetIsEnabled(true);
} }

View File

@@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/Portal/PortalHUD.h"
#include "UI/Portal/SignIn/SignInOverlay.h"
#include "Blueprint/UserWidget.h"
void APortalHUD::BeginPlay()
{
Super::BeginPlay();
APlayerController* OwningPlayerController = GetOwningPlayerController();
SignInOverlay = CreateWidget<USignInOverlay>(OwningPlayerController, SignInOverlayClass);
if (IsValid(SignInOverlay))
{
SignInOverlay->AddToViewport();
}
const FInputModeGameAndUI InputModeData;
OwningPlayerController->SetInputMode(InputModeData);
OwningPlayerController->SetShowMouseCursor(true);
}

View File

@@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/Portal/PortalManager.h"

View File

@@ -0,0 +1,14 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/Portal/SignIn/SignInOverlay.h"
#include "UI/Portal/PortalManager.h"
void USignInOverlay::NativeConstruct()
{
Super::NativeConstruct();
check(PortalManagerClass);
PortalManager = NewObject<UPortalManager>(PortalManagerClass);
}

View File

@@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "JoinGame.generated.h"
class UButton;
class UTextBlock;
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API UJoinGame : public UUserWidget
{
GENERATED_BODY()
public:
UPROPERTY(meta = (BindWidget))
TObjectPtr<UButton> Button_JoinGame;
UPROPERTY(meta = (BindWidget))
TObjectPtr<UTextBlock> TextBlock_StatusMessage;
};

View File

@@ -18,6 +18,6 @@ class DEDICATEDSERVERS_API UFleetId : public UUserWidget
public: public:
UPROPERTY(meta = (BindWidget)) UPROPERTY(meta = (BindWidget), BlueprintReadWrite)
TObjectPtr<UTextBlock> TextBlock_FleetId; TObjectPtr<UTextBlock> TextBlock_FleetId;
}; };

View File

@@ -8,7 +8,9 @@
class UAPITestManager; class UAPITestManager;
class UListFleetsBox; class UListFleetsBox;
class FDS_ListFleetsResponse; struct FDS_ListFleetsResponse;
class UFleetId;
/** /**
* *
*/ */
@@ -22,6 +24,9 @@ public:
UPROPERTY(EditDefaultsOnly) UPROPERTY(EditDefaultsOnly)
TSubclassOf<UAPITestManager> APITestManagerClass; TSubclassOf<UAPITestManager> APITestManagerClass;
UPROPERTY(EditDefaultsOnly)
TSubclassOf<UFleetId> FleetIdWidgetClass;
protected: protected:
virtual void NativeConstruct() override; virtual void NativeConstruct() override;

View File

@@ -0,0 +1,32 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "PortalHUD.generated.h"
class USignInOverlay;
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API APortalHUD : public AHUD
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly)
TSubclassOf<USignInOverlay> SignInOverlayClass;
protected:
virtual void BeginPlay() override;
private:
UPROPERTY()
TObjectPtr<USignInOverlay> SignInOverlay;
};

View File

@@ -0,0 +1,16 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UI/HTTP/HTTPRequestManager.h"
#include "PortalManager.generated.h"
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API UPortalManager : public UHTTPRequestManager
{
GENERATED_BODY()
};

View File

@@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "SignInOverlay.generated.h"
class UJoinGame;
class UPortalManager;
/**
*
*/
UCLASS()
class DEDICATEDSERVERS_API USignInOverlay : public UUserWidget
{
GENERATED_BODY()
public:
UPROPERTY(meta = (BindWidget))
TObjectPtr<UJoinGame> JoinGameWidget;
UPROPERTY(EditDefaultsOnly)
TSubclassOf<UPortalManager> PortalManagerClass;
protected:
virtual void NativeConstruct() override;
private:
UPROPERTY()
TObjectPtr<UPortalManager> PortalManager;
};