You've already forked LuckyWorld
Optimize WB_SelectGoalMenu
This commit is contained in:
@ -2,4 +2,37 @@
|
||||
|
||||
|
||||
#include "UI/Settings/SelectGoalUserWidget.h"
|
||||
#include "SharedDef.h"
|
||||
#include "Components/ComboBoxString.h"
|
||||
|
||||
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)
|
||||
{
|
||||
FString GoalTypeString = UEnum::GetValueAsString<EGoalType>(AllGoalListData->GoalType);
|
||||
GetComboBoxString()->AddOption(GoalTypeString);
|
||||
bInitAddOption = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GetComboBoxString()->SetSelectedIndex(bInitAddOption);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user