Optimizing some UI

This commit is contained in:
martinluckyrobots
2025-04-15 22:06:41 +08:00
parent 4692cd734e
commit 78f94c5985
13 changed files with 123 additions and 23 deletions

View File

@ -7,6 +7,7 @@
#include "UI/Settings/SelectGoalUserWidget.h"
#include "Kismet/GameplayStatics.h"
#include "Gameplay/NaviSplineCreator.h"
#include "Subsystem/UISubsystem.h"
void UGameUserWidget::NativeConstruct()
{
@ -17,6 +18,13 @@ void UGameUserWidget::NativeConstruct()
{
GameInstance->GameUserWidget = this;
}
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnStartTracing.AddDynamic(this, &UGameUserWidget::OnStartTracing);
UISubsystem->OnEndTracing.AddDynamic(this, &UGameUserWidget::OnEndTracing);
}
}
void UGameUserWidget::DoWaitSecond()
@ -54,6 +62,23 @@ void UGameUserWidget::UpdateDownCount()
}
}
void UGameUserWidget::OnStartTracing()
{
bIsTracing = true;
}
void UGameUserWidget::OnEndTracing()
{
bIsTracing = false;
BPPlayShowTipAnimation();
if (GetCaptureSettingsUserWidget())
{
GetCaptureSettingsUserWidget()->BPSaveSettings();
}
}
void UGameUserWidget::ToggleHide()
{
ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
@ -103,7 +128,11 @@ void UGameUserWidget::DoReset()
}
}
OnReset.Broadcast();
auto UISubsystem = GetGameInstance()->GetSubsystem<UUISubsystem>();
if (UISubsystem)
{
UISubsystem->OnReset.Broadcast();
}
}
void UGameUserWidget::DoExit()