added main and pause menus
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
|
||||
#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"
|
||||
|
||||
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);
|
||||
|
||||
// Pull live values into every tab so the controls reflect the current state.
|
||||
GameplayTab->RefreshFromSettings();
|
||||
AudioTab->RefreshFromSettings();
|
||||
GraphicsTab->RefreshFromSettings();
|
||||
|
||||
ShowGameplayTab();
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::NativeOnDeactivated()
|
||||
{
|
||||
Super::NativeOnDeactivated();
|
||||
|
||||
// Persist whatever the player changed, even if they didn't hit Apply.
|
||||
PersistSettings();
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::ShowGameplayTab()
|
||||
{
|
||||
TabSwitcher->SetActiveWidget(GameplayTab);
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::ShowAudioTab()
|
||||
{
|
||||
TabSwitcher->SetActiveWidget(AudioTab);
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::ShowGraphicsTab()
|
||||
{
|
||||
TabSwitcher->SetActiveWidget(GraphicsTab);
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::OnApplyClicked()
|
||||
{
|
||||
// Commits resolution + scalability changes staged by the graphics tab.
|
||||
if (UNakedDesireUserSettings* Settings = UNakedDesireUserSettings::GetNakedDesireUserSettings())
|
||||
Settings->ApplySettings(false);
|
||||
|
||||
PersistSettings();
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::OnBackClicked()
|
||||
{
|
||||
DeactivateWidget();
|
||||
}
|
||||
|
||||
void USettingsScreenWidget::PersistSettings()
|
||||
{
|
||||
if (UNakedDesireUserSettings* Settings = UNakedDesireUserSettings::GetNakedDesireUserSettings())
|
||||
Settings->SaveSettings();
|
||||
}
|
||||
Reference in New Issue
Block a user