Lesson 56 - API Test HUD
This commit is contained in:
@@ -18,7 +18,8 @@ public class DedicatedServers : ModuleRules
|
||||
PrivateDependencyModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"SlateCore",
|
||||
"UMG"
|
||||
});
|
||||
|
||||
// Adds in the plugin for GameLiftServerSDK if it is the server build.
|
||||
|
||||
18
Source/DedicatedServers/Private/UI/APITest/APITestHUD.cpp
Normal file
18
Source/DedicatedServers/Private/UI/APITest/APITestHUD.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UI/APITest/APITestHUD.h"
|
||||
|
||||
#include "UI/APITest/APITestOverlay.h"
|
||||
|
||||
void AAPITestHUD::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
APlayerController* PlayerController = GetOwningPlayerController();
|
||||
if (IsValid(PlayerController) && APITestOverlayClass)
|
||||
{
|
||||
APITestOverlay = CreateWidget<UAPITestOverlay>(PlayerController, APITestOverlayClass);
|
||||
APITestOverlay->AddToViewport();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UI/APITest/APITestOverlay.h"
|
||||
31
Source/DedicatedServers/Public/UI/APITest/APITestHUD.h
Normal file
31
Source/DedicatedServers/Public/UI/APITest/APITestHUD.h
Normal file
@@ -0,0 +1,31 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
class UAPITestOverlay;
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/HUD.h"
|
||||
#include "APITestHUD.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class DEDICATEDSERVERS_API AAPITestHUD : public AHUD
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
TSubclassOf<UAPITestOverlay> APITestOverlayClass;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
UPROPERTY()
|
||||
TObjectPtr<UAPITestOverlay> APITestOverlay;
|
||||
};
|
||||
16
Source/DedicatedServers/Public/UI/APITest/APITestOverlay.h
Normal file
16
Source/DedicatedServers/Public/UI/APITest/APITestOverlay.h
Normal file
@@ -0,0 +1,16 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "APITestOverlay.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class DEDICATEDSERVERS_API UAPITestOverlay : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
Reference in New Issue
Block a user