Create LoadGameUserWidget

This commit is contained in:
baz 2024-05-23 23:27:23 +01:00
parent 82d2c21721
commit 0a302a8efa
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,26 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "../UI/LoadGameUserWidget.h"
void ULoadGameUserWidget::NativeConstruct()
{
Super::NativeConstruct();
if (CancelButton)
{
CancelButton->OnClicked.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonOnClicked);
CancelButton->OnClicked.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayClickedSound);
CancelButton->OnHovered.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonHoveredDelegate);
CancelButton->OnHovered.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayHoveredSound);
CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonUnhoveredDelegate);
CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayUnhoveredSound);
}
}
void ULoadGameUserWidget::CancelButtonOnClicked()
{
ReturnToPreviousScreen();
}

View File

@ -0,0 +1,41 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "NakatomiInteractiveWidget.h"
#include "Components/Button.h"
#include "Components/ScrollBox.h"
#include "LoadGameUserWidget.generated.h"
/**
*
*/
UCLASS()
class NAKATOMI_API ULoadGameUserWidget : public UNakatomiInteractiveWidget
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UButton* CancelButton;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* CancelButtonTextBlock;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UScrollBox* SavedGamesScrollBox;
public:
virtual void NativeConstruct() override;
private:
UFUNCTION()
void CancelButtonOnClicked();
UFUNCTION()
void CancelButtonHoveredDelegate() { SetTextBlockHovered(CancelButtonTextBlock); }
UFUNCTION()
void CancelButtonUnhoveredDelegate() { SetTextBlockUnhovered(CancelButtonTextBlock); }
};