diff --git a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset index 70ded875..7a29227e 100644 Binary files a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset and b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset differ diff --git a/Content/GameBP/UI/WB_GameWidget.uasset b/Content/GameBP/UI/WB_GameWidget.uasset index d22a58cc..3d8c30e6 100644 Binary files a/Content/GameBP/UI/WB_GameWidget.uasset and b/Content/GameBP/UI/WB_GameWidget.uasset differ diff --git a/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset b/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset index b680777e..237ebcba 100644 Binary files a/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset and b/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset differ diff --git a/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp b/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp index bbd5b158..912ae99e 100644 --- a/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp +++ b/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp @@ -7,7 +7,7 @@ #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h" #include "Subsystems/SubsystemBlueprintLibrary.h" #include "VaRestSubsystem.h" -#include +#include "Kismet/GameplayStatics.h" void UMainScreenUserWidget::NativeConstruct() { diff --git a/Source/Luckyrobots/Private/UI/Settings/CaptureSettingsUserWidget.cpp b/Source/Luckyrobots/Private/UI/Settings/CaptureSettingsUserWidget.cpp index 272118a8..98f5d39a 100644 --- a/Source/Luckyrobots/Private/UI/Settings/CaptureSettingsUserWidget.cpp +++ b/Source/Luckyrobots/Private/UI/Settings/CaptureSettingsUserWidget.cpp @@ -2,4 +2,39 @@ #include "UI/Settings/CaptureSettingsUserWidget.h" +#include "Core/LuckyRobotsGameInstance.h" +#include "UI/GameUserWidget.h" +void UCaptureSettingsUserWidget::NativeConstruct() +{ + Super::NativeConstruct(); + + BPRefreshTaskList(); + ULuckyRobotsGameInstance* GameInstance = Cast(GetGameInstance()); + if (GameInstance) + { + GameInstance->OnRandomMeshesUpdated.AddDynamic(this, &UCaptureSettingsUserWidget::BPOnRandomMeshesUpdated); + } +} + +void UCaptureSettingsUserWidget::ToggleMenu() +{ + bIsOpen = !bIsOpen; + + if (bIsOpen) + { + BPLoadSettings(); + } + else + { + ULuckyRobotsGameInstance* GameInstance = Cast(GetGameInstance()); + if (GameInstance && GameInstance->GameUserWidget) + { + GameInstance->GameUserWidget->DoAutoConfirm(); + } + } + + OnOpenMenuStateChanged.Broadcast(bIsOpen); + + ToggleMenuDisplay(); +} \ No newline at end of file diff --git a/Source/Luckyrobots/Public/UI/GameUserWidget.h b/Source/Luckyrobots/Public/UI/GameUserWidget.h index 0077062f..61c9895e 100644 --- a/Source/Luckyrobots/Public/UI/GameUserWidget.h +++ b/Source/Luckyrobots/Public/UI/GameUserWidget.h @@ -47,4 +47,7 @@ public: UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void DoRefreshListView(); + + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) + void DoAutoConfirm(); }; diff --git a/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h b/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h index 86f8dd01..db38adf4 100644 --- a/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h +++ b/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h @@ -7,6 +7,8 @@ #include "SharedDef.h" #include "CaptureSettingsUserWidget.generated.h" +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenMenuStateChanged, bool, Open); + /** * */ @@ -14,12 +16,30 @@ UCLASS() class LUCKYROBOTS_API UCaptureSettingsUserWidget : public UUserWidget { GENERATED_BODY() - +protected: + virtual void NativeConstruct() override; + public: UPROPERTY(EditAnywhere, BlueprintReadWrite) bool bIsOpen; + UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event") + FOnOpenMenuStateChanged OnOpenMenuStateChanged; + +public: + UFUNCTION(BlueprintCallable) + void ToggleMenu(); + public: UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void BPRefreshTaskList(); + + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) + void BPOnRandomMeshesUpdated(); + + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) + void BPLoadSettings(); + + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) + void ToggleMenuDisplay(); };