Optimize WB_SelectGoalMenu
This commit is contained in:
parent
03f5612651
commit
38a91fb2e7
Binary file not shown.
@ -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);
|
||||
}
|
||||
}
|
@ -6,6 +6,8 @@
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "SelectGoalUserWidget.generated.h"
|
||||
|
||||
class UComboBoxString;
|
||||
class UPathfindingSelectorUserWidget;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -14,7 +16,24 @@ class LUCKYWORLDV2_API USelectGoalUserWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
|
||||
UDataTable* AllGoalListDataTable;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
UPathfindingSelectorUserWidget* NavigateSimpleEnvironments;
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bInitAddOption;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, BlueprintImplementableEvent)
|
||||
void DoAutoConfirm();
|
||||
|
||||
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
||||
UComboBoxString* GetComboBoxString();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user