ui updates
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,12 +2,11 @@
|
||||
|
||||
|
||||
#include "MainMenuWidget.h"
|
||||
|
||||
#include "ConfirmModalWidget.h"
|
||||
#include "Components/Button.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
||||
#include "NakedDesire/UI/TextButton.h"
|
||||
#include "Widgets/CommonActivatableWidgetContainer.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "MainMenu"
|
||||
@@ -29,13 +28,14 @@ void UMainMenuWidget::NativeOnActivated()
|
||||
if (const USaveSubsystem* SaveSubsystem = GameInstance->GetSubsystem<USaveSubsystem>())
|
||||
bHasSave = SaveSubsystem->DoesSaveExist();
|
||||
}
|
||||
|
||||
ContinueButton->SetIsEnabled(bHasSave);
|
||||
|
||||
ContinueButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnContinueClicked);
|
||||
NewGameButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnNewGameClicked);
|
||||
SettingsButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnSettingsClicked);
|
||||
CreditsButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnCreditsClicked);
|
||||
QuitButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnQuitClicked);
|
||||
ContinueButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnContinueClicked);
|
||||
NewGameButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnNewGameClicked);
|
||||
SettingsButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnSettingsClicked);
|
||||
CreditsButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnCreditsClicked);
|
||||
QuitButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnQuitClicked);
|
||||
}
|
||||
|
||||
void UMainMenuWidget::OnContinueClicked()
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "CommonActivatableWidget.h"
|
||||
#include "MainMenuWidget.generated.h"
|
||||
|
||||
class UTextButton;
|
||||
class UButton;
|
||||
class UCommonActivatableWidgetStack;
|
||||
class UConfirmModalWidget;
|
||||
@@ -26,19 +27,19 @@ protected:
|
||||
|
||||
private:
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> ContinueButton;
|
||||
TObjectPtr<UTextButton> ContinueButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> NewGameButton;
|
||||
TObjectPtr<UTextButton> NewGameButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> SettingsButton;
|
||||
TObjectPtr<UTextButton> SettingsButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> CreditsButton;
|
||||
TObjectPtr<UTextButton> CreditsButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> QuitButton;
|
||||
TObjectPtr<UTextButton> QuitButton;
|
||||
|
||||
// Stack the confirm popup / credits / settings screens are pushed onto.
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
|
||||
@@ -2,23 +2,22 @@
|
||||
|
||||
|
||||
#include "SettingsScreenWidget.h"
|
||||
|
||||
#include "AudioSettingsTab.h"
|
||||
#include "GameplaySettingsTab.h"
|
||||
#include "GraphicsSettingsTab.h"
|
||||
#include "Components/Button.h"
|
||||
#include "Components/WidgetSwitcher.h"
|
||||
#include "NakedDesire/Global/NakedDesireUserSettings.h"
|
||||
#include "NakedDesire/UI/TextButton.h"
|
||||
|
||||
void USettingsScreenWidget::NativeOnActivated()
|
||||
{
|
||||
Super::NativeOnActivated();
|
||||
|
||||
GameplayTabButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::ShowGameplayTab);
|
||||
AudioTabButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::ShowAudioTab);
|
||||
GraphicsTabButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::ShowGraphicsTab);
|
||||
ApplyButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::OnApplyClicked);
|
||||
BackButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::OnBackClicked);
|
||||
GameplayTabButton->OnClicked().AddUObject(this, &USettingsScreenWidget::ShowGameplayTab);
|
||||
AudioTabButton->OnClicked().AddUObject(this, &USettingsScreenWidget::ShowAudioTab);
|
||||
GraphicsTabButton->OnClicked().AddUObject(this, &USettingsScreenWidget::ShowGraphicsTab);
|
||||
ApplyButton->OnClicked().AddUObject(this, &USettingsScreenWidget::OnApplyClicked);
|
||||
BackButton->OnClicked().AddUObject(this, &USettingsScreenWidget::OnBackClicked);
|
||||
|
||||
// Pull live values into every tab so the controls reflect the current state.
|
||||
GameplayTab->RefreshFromSettings();
|
||||
@@ -39,16 +38,25 @@ void USettingsScreenWidget::NativeOnDeactivated()
|
||||
void USettingsScreenWidget::ShowGameplayTab()
|
||||
{
|
||||
TabSwitcher->SetActiveWidget(GameplayTab);
|
||||
GameplayTabButton->SetIsActive(true);
|
||||
AudioTabButton->SetIsActive(false);
|
||||
GraphicsTabButton->SetIsActive(false);
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::ShowAudioTab()
|
||||
{
|
||||
TabSwitcher->SetActiveWidget(AudioTab);
|
||||
GameplayTabButton->SetIsActive(false);
|
||||
AudioTabButton->SetIsActive(true);
|
||||
GraphicsTabButton->SetIsActive(false);
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::ShowGraphicsTab()
|
||||
{
|
||||
TabSwitcher->SetActiveWidget(GraphicsTab);
|
||||
GameplayTabButton->SetIsActive(false);
|
||||
AudioTabButton->SetIsActive(false);
|
||||
GraphicsTabButton->SetIsActive(true);
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::OnApplyClicked()
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "CommonActivatableWidget.h"
|
||||
#include "SettingsScreenWidget.generated.h"
|
||||
|
||||
class UButton;
|
||||
class UTextButton;
|
||||
class UWidgetSwitcher;
|
||||
class UGameplaySettingsTab;
|
||||
class UAudioSettingsTab;
|
||||
@@ -29,19 +29,19 @@ private:
|
||||
TObjectPtr<UWidgetSwitcher> TabSwitcher;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> GameplayTabButton;
|
||||
TObjectPtr<UTextButton> GameplayTabButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> AudioTabButton;
|
||||
TObjectPtr<UTextButton> AudioTabButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> GraphicsTabButton;
|
||||
TObjectPtr<UTextButton> GraphicsTabButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> ApplyButton;
|
||||
TObjectPtr<UTextButton> ApplyButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UButton> BackButton;
|
||||
TObjectPtr<UTextButton> BackButton;
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UGameplaySettingsTab> GameplayTab;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
|
||||
#include "TextButton.h"
|
||||
|
||||
#include "CommonTextBlock.h"
|
||||
|
||||
void UTextButton::SetIsActive(const bool Value)
|
||||
{
|
||||
IsActive = Value;
|
||||
|
||||
GetSingleMaterialStyleMID()->SetScalarParameterValue(TEXT("Selected"), Value ? 1.0f : 0.0f);
|
||||
}
|
||||
|
||||
void UTextButton::NativePreConstruct()
|
||||
{
|
||||
Super::NativePreConstruct();
|
||||
|
||||
TextBlock->SetText(Text);
|
||||
}
|
||||
|
||||
void UTextButton::NativeOnCurrentTextStyleChanged()
|
||||
{
|
||||
Super::NativeOnCurrentTextStyleChanged();
|
||||
|
||||
TextBlock->SetStyle(GetCurrentTextStyleClass());
|
||||
}
|
||||
|
||||
void UTextButton::NativeOnHovered()
|
||||
{
|
||||
Super::NativeOnHovered();
|
||||
|
||||
GetSingleMaterialStyleMID()->SetScalarParameterValue(TEXT("Hovered"), 1.0f);
|
||||
}
|
||||
|
||||
void UTextButton::NativeOnUnhovered()
|
||||
{
|
||||
Super::NativeOnUnhovered();
|
||||
|
||||
GetSingleMaterialStyleMID()->SetScalarParameterValue(TEXT("Hovered"), 0.0f);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "CommonButtonBase.h"
|
||||
#include "TextButton.generated.h"
|
||||
|
||||
class UCommonTextBlock;
|
||||
|
||||
UCLASS(Abstract)
|
||||
class NAKEDDESIRE_API UTextButton : public UCommonButtonBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(meta = (BindWidget))
|
||||
TObjectPtr<UCommonTextBlock> TextBlock;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "UI")
|
||||
FText Text = FText::FromString(TEXT("Button"));
|
||||
|
||||
public:
|
||||
void SetIsActive(bool Value);
|
||||
|
||||
protected:
|
||||
virtual void NativePreConstruct() override;
|
||||
virtual void NativeOnCurrentTextStyleChanged() override;
|
||||
virtual void NativeOnHovered() override;
|
||||
virtual void NativeOnUnhovered() override;
|
||||
|
||||
private:
|
||||
bool IsActive = false;
|
||||
};
|
||||
Reference in New Issue
Block a user