diff --git a/Content/GameBP/UI/Settings/WB_SelectGoalMenu.uasset b/Content/GameBP/UI/Settings/WB_SelectGoalMenu.uasset index e64530bf..3e42acc9 100644 Binary files a/Content/GameBP/UI/Settings/WB_SelectGoalMenu.uasset and b/Content/GameBP/UI/Settings/WB_SelectGoalMenu.uasset differ diff --git a/Source/LuckyWorldV2/Private/UI/Settings/SelectGoalUserWidget.cpp b/Source/LuckyWorldV2/Private/UI/Settings/SelectGoalUserWidget.cpp index 405a6645..16f34dbb 100644 --- a/Source/LuckyWorldV2/Private/UI/Settings/SelectGoalUserWidget.cpp +++ b/Source/LuckyWorldV2/Private/UI/Settings/SelectGoalUserWidget.cpp @@ -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 RowNames = AllGoalListDataTable->GetRowNames(); + for (const FName& RowName : RowNames) + { + FAllGoalListData* AllGoalListData = AllGoalListDataTable->FindRow(RowName, ContextString); + if (AllGoalListData) + { + if (AllGoalListData->bIsActive) + { + FString GoalTypeString = UEnum::GetValueAsString(AllGoalListData->GoalType); + GetComboBoxString()->AddOption(GoalTypeString); + bInitAddOption = true; + break; + } + } + } + } + + GetComboBoxString()->SetSelectedIndex(bInitAddOption); + } +} \ No newline at end of file diff --git a/Source/LuckyWorldV2/Public/UI/Settings/SelectGoalUserWidget.h b/Source/LuckyWorldV2/Public/UI/Settings/SelectGoalUserWidget.h index bb92685e..f80955f2 100644 --- a/Source/LuckyWorldV2/Public/UI/Settings/SelectGoalUserWidget.h +++ b/Source/LuckyWorldV2/Public/UI/Settings/SelectGoalUserWidget.h @@ -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(); };