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 "MainMenuWidget.h"
|
||||||
|
|
||||||
#include "ConfirmModalWidget.h"
|
#include "ConfirmModalWidget.h"
|
||||||
#include "Components/Button.h"
|
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "Kismet/KismetSystemLibrary.h"
|
#include "Kismet/KismetSystemLibrary.h"
|
||||||
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
||||||
|
#include "NakedDesire/UI/TextButton.h"
|
||||||
#include "Widgets/CommonActivatableWidgetContainer.h"
|
#include "Widgets/CommonActivatableWidgetContainer.h"
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "MainMenu"
|
#define LOCTEXT_NAMESPACE "MainMenu"
|
||||||
@@ -29,13 +28,14 @@ void UMainMenuWidget::NativeOnActivated()
|
|||||||
if (const USaveSubsystem* SaveSubsystem = GameInstance->GetSubsystem<USaveSubsystem>())
|
if (const USaveSubsystem* SaveSubsystem = GameInstance->GetSubsystem<USaveSubsystem>())
|
||||||
bHasSave = SaveSubsystem->DoesSaveExist();
|
bHasSave = SaveSubsystem->DoesSaveExist();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContinueButton->SetIsEnabled(bHasSave);
|
ContinueButton->SetIsEnabled(bHasSave);
|
||||||
|
|
||||||
ContinueButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnContinueClicked);
|
ContinueButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnContinueClicked);
|
||||||
NewGameButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnNewGameClicked);
|
NewGameButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnNewGameClicked);
|
||||||
SettingsButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnSettingsClicked);
|
SettingsButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnSettingsClicked);
|
||||||
CreditsButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnCreditsClicked);
|
CreditsButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnCreditsClicked);
|
||||||
QuitButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OnQuitClicked);
|
QuitButton->OnClicked().AddUObject(this, &UMainMenuWidget::OnQuitClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMainMenuWidget::OnContinueClicked()
|
void UMainMenuWidget::OnContinueClicked()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "CommonActivatableWidget.h"
|
#include "CommonActivatableWidget.h"
|
||||||
#include "MainMenuWidget.generated.h"
|
#include "MainMenuWidget.generated.h"
|
||||||
|
|
||||||
|
class UTextButton;
|
||||||
class UButton;
|
class UButton;
|
||||||
class UCommonActivatableWidgetStack;
|
class UCommonActivatableWidgetStack;
|
||||||
class UConfirmModalWidget;
|
class UConfirmModalWidget;
|
||||||
@@ -26,19 +27,19 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> ContinueButton;
|
TObjectPtr<UTextButton> ContinueButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> NewGameButton;
|
TObjectPtr<UTextButton> NewGameButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> SettingsButton;
|
TObjectPtr<UTextButton> SettingsButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> CreditsButton;
|
TObjectPtr<UTextButton> CreditsButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> QuitButton;
|
TObjectPtr<UTextButton> QuitButton;
|
||||||
|
|
||||||
// Stack the confirm popup / credits / settings screens are pushed onto.
|
// Stack the confirm popup / credits / settings screens are pushed onto.
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
|||||||
@@ -2,23 +2,22 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "SettingsScreenWidget.h"
|
#include "SettingsScreenWidget.h"
|
||||||
|
|
||||||
#include "AudioSettingsTab.h"
|
#include "AudioSettingsTab.h"
|
||||||
#include "GameplaySettingsTab.h"
|
#include "GameplaySettingsTab.h"
|
||||||
#include "GraphicsSettingsTab.h"
|
#include "GraphicsSettingsTab.h"
|
||||||
#include "Components/Button.h"
|
|
||||||
#include "Components/WidgetSwitcher.h"
|
#include "Components/WidgetSwitcher.h"
|
||||||
#include "NakedDesire/Global/NakedDesireUserSettings.h"
|
#include "NakedDesire/Global/NakedDesireUserSettings.h"
|
||||||
|
#include "NakedDesire/UI/TextButton.h"
|
||||||
|
|
||||||
void USettingsScreenWidget::NativeOnActivated()
|
void USettingsScreenWidget::NativeOnActivated()
|
||||||
{
|
{
|
||||||
Super::NativeOnActivated();
|
Super::NativeOnActivated();
|
||||||
|
|
||||||
GameplayTabButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::ShowGameplayTab);
|
GameplayTabButton->OnClicked().AddUObject(this, &USettingsScreenWidget::ShowGameplayTab);
|
||||||
AudioTabButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::ShowAudioTab);
|
AudioTabButton->OnClicked().AddUObject(this, &USettingsScreenWidget::ShowAudioTab);
|
||||||
GraphicsTabButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::ShowGraphicsTab);
|
GraphicsTabButton->OnClicked().AddUObject(this, &USettingsScreenWidget::ShowGraphicsTab);
|
||||||
ApplyButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::OnApplyClicked);
|
ApplyButton->OnClicked().AddUObject(this, &USettingsScreenWidget::OnApplyClicked);
|
||||||
BackButton->OnClicked.AddUniqueDynamic(this, &USettingsScreenWidget::OnBackClicked);
|
BackButton->OnClicked().AddUObject(this, &USettingsScreenWidget::OnBackClicked);
|
||||||
|
|
||||||
// Pull live values into every tab so the controls reflect the current state.
|
// Pull live values into every tab so the controls reflect the current state.
|
||||||
GameplayTab->RefreshFromSettings();
|
GameplayTab->RefreshFromSettings();
|
||||||
@@ -39,16 +38,25 @@ void USettingsScreenWidget::NativeOnDeactivated()
|
|||||||
void USettingsScreenWidget::ShowGameplayTab()
|
void USettingsScreenWidget::ShowGameplayTab()
|
||||||
{
|
{
|
||||||
TabSwitcher->SetActiveWidget(GameplayTab);
|
TabSwitcher->SetActiveWidget(GameplayTab);
|
||||||
|
GameplayTabButton->SetIsActive(true);
|
||||||
|
AudioTabButton->SetIsActive(false);
|
||||||
|
GraphicsTabButton->SetIsActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void USettingsScreenWidget::ShowAudioTab()
|
void USettingsScreenWidget::ShowAudioTab()
|
||||||
{
|
{
|
||||||
TabSwitcher->SetActiveWidget(AudioTab);
|
TabSwitcher->SetActiveWidget(AudioTab);
|
||||||
|
GameplayTabButton->SetIsActive(false);
|
||||||
|
AudioTabButton->SetIsActive(true);
|
||||||
|
GraphicsTabButton->SetIsActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void USettingsScreenWidget::ShowGraphicsTab()
|
void USettingsScreenWidget::ShowGraphicsTab()
|
||||||
{
|
{
|
||||||
TabSwitcher->SetActiveWidget(GraphicsTab);
|
TabSwitcher->SetActiveWidget(GraphicsTab);
|
||||||
|
GameplayTabButton->SetIsActive(false);
|
||||||
|
AudioTabButton->SetIsActive(false);
|
||||||
|
GraphicsTabButton->SetIsActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void USettingsScreenWidget::OnApplyClicked()
|
void USettingsScreenWidget::OnApplyClicked()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "CommonActivatableWidget.h"
|
#include "CommonActivatableWidget.h"
|
||||||
#include "SettingsScreenWidget.generated.h"
|
#include "SettingsScreenWidget.generated.h"
|
||||||
|
|
||||||
class UButton;
|
class UTextButton;
|
||||||
class UWidgetSwitcher;
|
class UWidgetSwitcher;
|
||||||
class UGameplaySettingsTab;
|
class UGameplaySettingsTab;
|
||||||
class UAudioSettingsTab;
|
class UAudioSettingsTab;
|
||||||
@@ -29,19 +29,19 @@ private:
|
|||||||
TObjectPtr<UWidgetSwitcher> TabSwitcher;
|
TObjectPtr<UWidgetSwitcher> TabSwitcher;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> GameplayTabButton;
|
TObjectPtr<UTextButton> GameplayTabButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> AudioTabButton;
|
TObjectPtr<UTextButton> AudioTabButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> GraphicsTabButton;
|
TObjectPtr<UTextButton> GraphicsTabButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> ApplyButton;
|
TObjectPtr<UTextButton> ApplyButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> BackButton;
|
TObjectPtr<UTextButton> BackButton;
|
||||||
|
|
||||||
UPROPERTY(meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UGameplaySettingsTab> GameplayTab;
|
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