2025-04-14 19:36:02 +08:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
#include "UI/Settings/SelectGoalUserWidget.h"
|
2025-04-17 10:41:19 +08:00
|
|
|
#include "SharedDef.h"
|
|
|
|
#include "Components/ComboBoxString.h"
|
2025-04-14 19:36:02 +08:00
|
|
|
|
2025-04-17 10:41:19 +08:00
|
|
|
void USelectGoalUserWidget::NativeConstruct()
|
|
|
|
{
|
|
|
|
Super::NativeConstruct();
|
|
|
|
|
|
|
|
bInitAddOption = false;
|
|
|
|
|
|
|
|
if (GetComboBoxString())
|
|
|
|
{
|
|
|
|
if (AllGoalListDataTable)
|
|
|
|
{
|
|
|
|
FString ContextString;
|
|
|
|
TArray<FName> RowNames = AllGoalListDataTable->GetRowNames();
|
|
|
|
for (const FName& RowName : RowNames)
|
|
|
|
{
|
|
|
|
FAllGoalListData* AllGoalListData = AllGoalListDataTable->FindRow<FAllGoalListData>(RowName, ContextString);
|
|
|
|
if (AllGoalListData)
|
|
|
|
{
|
|
|
|
if (AllGoalListData->bIsActive)
|
|
|
|
{
|
2025-04-17 11:49:17 +08:00
|
|
|
UEnum* GoalTypeEnum = StaticEnum<EGoalType>();
|
|
|
|
FString GoalTypeString = GoalTypeEnum->GetDisplayNameTextByIndex(int(AllGoalListData->GoalType)).ToString();
|
2025-04-17 10:41:19 +08:00
|
|
|
GetComboBoxString()->AddOption(GoalTypeString);
|
|
|
|
bInitAddOption = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GetComboBoxString()->SetSelectedIndex(bInitAddOption);
|
|
|
|
}
|
|
|
|
}
|