Create SaveGameEntryUserWidget

This commit is contained in:
baz 2024-05-27 01:03:55 +01:00
parent 3a67e84072
commit 15fdc538e5
2 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,43 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "../UI/SaveGameEntryUserWidget.h"
void USaveGameEntryUserWidget::NativeConstruct()
{
Super::NativeConstruct();
if (LoadSaveButton)
{
LoadSaveButton->OnClicked.AddUniqueDynamic(this, &USaveGameEntryUserWidget::LoadSaveButtonOnClicked);
LoadSaveButton->OnClicked.AddUniqueDynamic(this, &USaveGameEntryUserWidget::PlayClickedSound);
LoadSaveButton->OnHovered.AddUniqueDynamic(this, &USaveGameEntryUserWidget::LoadSaveButtonHoveredDelegate);
LoadSaveButton->OnHovered.AddUniqueDynamic(this, &USaveGameEntryUserWidget::PlayHoveredSound);
LoadSaveButton->OnUnhovered.AddUniqueDynamic(this, &USaveGameEntryUserWidget::LoadSaveButtonUnhoveredDelegate);
LoadSaveButton->OnUnhovered.AddUniqueDynamic(this, &USaveGameEntryUserWidget::PlayUnhoveredSound);
}
}
void USaveGameEntryUserWidget::SetSaveInfo()
{
}
void USaveGameEntryUserWidget::LoadSaveButtonOnClicked()
{
}
void USaveGameEntryUserWidget::LoadSaveButtonHoveredDelegate()
{
SetTextBlockHovered(PlayerNameTextBlock);
SetTextBlockHovered(CurrentLevelTextBlock);
SetTextBlockHovered(DateTimeSavedTextBlock);
}
void USaveGameEntryUserWidget::LoadSaveButtonUnhoveredDelegate()
{
SetTextBlockUnhovered(PlayerNameTextBlock);
SetTextBlockUnhovered(CurrentLevelTextBlock);
SetTextBlockUnhovered(DateTimeSavedTextBlock);
}

View File

@ -0,0 +1,47 @@
// 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 "SaveGameEntryUserWidget.generated.h"
/**
*
*/
UCLASS()
class NAKATOMI_API USaveGameEntryUserWidget : public UNakatomiInteractiveWidget
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UButton* LoadSaveButton;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* PlayerNameTextBlock;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* CurrentLevelTextBlock;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* DateTimeSavedTextBlock;
public:
virtual void NativeConstruct() override;
UFUNCTION()
void SetSaveInfo();
private:
UFUNCTION()
void LoadSaveButtonOnClicked();
UFUNCTION()
void LoadSaveButtonHoveredDelegate();
UFUNCTION()
void LoadSaveButtonUnhoveredDelegate();
};