diff --git a/Content/Blueprint/Core/BP_selectorPoi.uasset b/Content/Blueprint/Core/BP_selectorPoi.uasset index a44f1bbf..d7d18750 100644 Binary files a/Content/Blueprint/Core/BP_selectorPoi.uasset and b/Content/Blueprint/Core/BP_selectorPoi.uasset differ diff --git a/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset b/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset index 33572e33..7006f570 100644 Binary files a/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset and b/Content/Blueprint/RobotPawnActors/BP_mujokoStretch.uasset differ diff --git a/Content/Blueprint/component/BPC_Capture.uasset b/Content/Blueprint/component/BPC_Capture.uasset index e4a7825a..acfe67ff 100644 Binary files a/Content/Blueprint/component/BPC_Capture.uasset and b/Content/Blueprint/component/BPC_Capture.uasset differ diff --git a/Content/Blueprint/component/BPC_NaviPoint.uasset b/Content/Blueprint/component/BPC_NaviPoint.uasset index 5ca33e5f..e5b4519f 100644 Binary files a/Content/Blueprint/component/BPC_NaviPoint.uasset and b/Content/Blueprint/component/BPC_NaviPoint.uasset differ diff --git a/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset b/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset index 9b89357e..656627df 100644 Binary files a/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset and b/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset differ diff --git a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset index aaffcf85..349acd61 100644 Binary files a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset and b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset differ diff --git a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset index 7267853f..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 410589fc..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/DemoRobot/DemoROBOT.uasset b/Content/luckyBot/DemoRobot/DemoROBOT.uasset deleted file mode 100644 index d5bc40ed..00000000 Binary files a/Content/luckyBot/DemoRobot/DemoROBOT.uasset and /dev/null differ diff --git a/Content/luckyBot/DemoRobot/NewFolder/NewTest.uasset b/Content/luckyBot/DemoRobot/NewFolder/NewTest.uasset deleted file mode 100644 index 8662913d..00000000 Binary files a/Content/luckyBot/DemoRobot/NewFolder/NewTest.uasset and /dev/null differ diff --git a/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset b/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset index dfec9bc9..0aeb84ce 100644 Binary files a/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset and b/Content/luckyBot/Luckywidget/BPI_IngameWidget.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/BPI_ListBox.uasset b/Content/luckyBot/Luckywidget/ChildItems/BPI_ListBox.uasset deleted file mode 100644 index 898a3bf3..00000000 Binary files a/Content/luckyBot/Luckywidget/ChildItems/BPI_ListBox.uasset and /dev/null differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset index 0e466912..f076a629 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_NavigateSimpleEnvironments.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset index e1f4b826..0fd6e25e 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListBox.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset index 28ee87d7..c622d309 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_TaskListBox.uasset differ diff --git a/Content/luckyBot/Luckywidget/menu/BPI_CaptureSetting.uasset b/Content/luckyBot/Luckywidget/menu/BPI_CaptureSetting.uasset deleted file mode 100644 index dcd1e25f..00000000 Binary files a/Content/luckyBot/Luckywidget/menu/BPI_CaptureSetting.uasset and /dev/null differ diff --git a/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset b/Content/luckyBot/Luckywidget/menu/WB_SelectGoalMenu.uasset index dd66ad7a..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/Content/luckyBot/Sequencer_SCAN/Capture.uasset b/Content/luckyBot/Sequencer_SCAN/Capture.uasset deleted file mode 100644 index 2b05df51..00000000 Binary files a/Content/luckyBot/Sequencer_SCAN/Capture.uasset and /dev/null differ diff --git a/Content/luckyBot/Test/LuckyAllPhysics.uasset b/Content/luckyBot/Test/LuckyAllPhysics.uasset deleted file mode 100644 index 6cb07136..00000000 Binary files a/Content/luckyBot/Test/LuckyAllPhysics.uasset and /dev/null differ diff --git a/Content/luckyBot/Test/NewBlueprint.uasset b/Content/luckyBot/Test/NewBlueprint.uasset deleted file mode 100644 index eb67c1a0..00000000 Binary files a/Content/luckyBot/Test/NewBlueprint.uasset and /dev/null differ diff --git a/Content/luckyBot/blueprint/DroneMovementBluePrint.uasset b/Content/luckyBot/blueprint/DroneMovementBluePrint.uasset deleted file mode 100644 index ae5c59bc..00000000 Binary files a/Content/luckyBot/blueprint/DroneMovementBluePrint.uasset and /dev/null differ diff --git a/Content/luckyBot/blueprint/LuckyBotGameInstance.uasset b/Content/luckyBot/blueprint/LuckyBotGameInstance.uasset deleted file mode 100644 index 8daf7f42..00000000 Binary files a/Content/luckyBot/blueprint/LuckyBotGameInstance.uasset and /dev/null differ diff --git a/Content/luckyBot/blueprint/LuckyBotNewBlueprint.uasset b/Content/luckyBot/blueprint/LuckyBotNewBlueprint.uasset deleted file mode 100644 index 622fe3a0..00000000 Binary files a/Content/luckyBot/blueprint/LuckyBotNewBlueprint.uasset and /dev/null differ diff --git a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp index 10a55efd..c839810d 100644 --- a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp +++ b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp @@ -11,6 +11,7 @@ #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h" #include "VaRestSubsystem.h" #include "Subsystems/SubsystemBlueprintLibrary.h" +#include "Gameplay/TargetSelector.h" void ULuckyRobotsGameInstance::DoSendMessage(const FString& SendValue) { @@ -46,22 +47,22 @@ void ULuckyRobotsGameInstance::SwitchGamePaused() void ULuckyRobotsGameInstance::ClearTaskList() { - TaskList.Empty(); + CurrentCaptureSettingsData.TaskList.Empty(); } void ULuckyRobotsGameInstance::AddTask(const FGoalsTaskData& TaskData) { - TaskList.Add(TaskData); + CurrentCaptureSettingsData.TaskList.Add(TaskData); } void ULuckyRobotsGameInstance::RemoveTask(const FGoalsTaskData& TaskData) { - TaskList.Remove(TaskData); + CurrentCaptureSettingsData.TaskList.Remove(TaskData); } void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType) { - for (const FGoalsTaskData& Task : TaskList) + for (FGoalsTaskData Task : CurrentCaptureSettingsData.TaskList) { if (Task.GoalType == GoalType) { @@ -73,18 +74,18 @@ void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType) int32 ULuckyRobotsGameInstance::GetTaskNum() const { - return TaskList.Num(); + return CurrentCaptureSettingsData.TaskList.Num(); } void ULuckyRobotsGameInstance::SetTask(int32 Index, const FGoalsTaskData& TaskData) { - if (TaskList.IsValidIndex(Index)) + if (CurrentCaptureSettingsData.TaskList.IsValidIndex(Index)) { - TaskList[Index] = TaskData; + CurrentCaptureSettingsData.TaskList[Index] = TaskData; } else { - while (TaskList.Num() < Index) + while (CurrentCaptureSettingsData.TaskList.Num() < Index) { FGoalsTaskData TempTaskData; AddTask(TempTaskData); @@ -95,9 +96,9 @@ void ULuckyRobotsGameInstance::SetTask(int32 Index, const FGoalsTaskData& TaskDa bool ULuckyRobotsGameInstance::GetTask(int32 Index, FGoalsTaskData& OutTaskData) const { - if (TaskList.IsValidIndex(Index)) + if (CurrentCaptureSettingsData.TaskList.IsValidIndex(Index)) { - OutTaskData = TaskList[Index]; + OutTaskData = CurrentCaptureSettingsData.TaskList[Index]; return true; } return false; @@ -106,19 +107,19 @@ bool ULuckyRobotsGameInstance::GetTask(int32 Index, FGoalsTaskData& OutTaskData) void ULuckyRobotsGameInstance::ReSetTaskList() { TArray TempTaskList; - for (FGoalsTaskData& Task : TaskList) + for (FGoalsTaskData& Task : CurrentCaptureSettingsData.TaskList) { Task.bIsStart = false; Task.bIsComplete = false; Task.bActive = false; TempTaskList.Add(Task); } - TaskList = TempTaskList; + CurrentCaptureSettingsData.TaskList = TempTaskList; } TArray ULuckyRobotsGameInstance::GetTaskList() const { - return TaskList; + return CurrentCaptureSettingsData.TaskList; } void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool bIsClear) @@ -379,6 +380,38 @@ FParsedData ULuckyRobotsGameInstance::DoJsonParse(const FString& JsonString) return ParsedData; } +void ULuckyRobotsGameInstance::UpdateTargetSelector() +{ + TArray AllTargetSelector; + UGameplayStatics::GetAllActorsOfClass(this, ATargetSelector::StaticClass(), AllTargetSelector); + for (auto TargetSelector : AllTargetSelector) + { + if (TargetSelector) + { + TargetSelector->Destroy(); + } + } + + TArray GoalsTaskList = GetTaskList(); + for (int i = 0; i < GoalsTaskList.Num() ; ++i) + { + if (GoalsTaskList[i].GoalType == EGoalType::NavigateSimpleEnvironments) + { + if (i == 0) + { + TargetPosition = GoalsTaskList[i].TargetLocation; + } + ATargetSelector* TargetSelector = GetWorld()->SpawnActorDeferred(TargetSelectorClass, GoalsTaskList[i].TargetLocation, nullptr, nullptr, + ESpawnActorCollisionHandlingMethod::AlwaysSpawn); + if (TargetSelector) + { + TargetSelector->FinishSpawning(GoalsTaskList[i].TargetLocation); + TargetSelector->bIsTracing = false; + } + } + } +} + void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName) { CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName); diff --git a/Source/Luckyrobots/Private/Gameplay/TargetSelector.cpp b/Source/Luckyrobots/Private/Gameplay/TargetSelector.cpp new file mode 100644 index 00000000..ed36ad54 --- /dev/null +++ b/Source/Luckyrobots/Private/Gameplay/TargetSelector.cpp @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Gameplay/TargetSelector.h" + +// Sets default values +ATargetSelector::ATargetSelector() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + +} + +// Called when the game starts or when spawned +void ATargetSelector::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void ATargetSelector::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + 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/Core/LuckyRobotsGameInstance.h b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h index 67cba8f6..68ad921a 100644 --- a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h +++ b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h @@ -42,6 +42,9 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") UDataTable* BathroomDataTable; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") + TSubclassOf TargetSelectorClass; + public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") TArray AlphabetForRandomList; @@ -106,8 +109,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Random Mesh") bool bIsRandomPannel; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Random Mesh") - bool bIsRandomRobotPosition; public: UPROPERTY(EditAnywhere, BlueprintReadWrite) @@ -119,9 +120,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite) EQualityEnum CurrentSelectQuality = EQualityEnum::Epic; - UPROPERTY(EditAnywhere, BlueprintReadWrite) - TArray TaskList; - UPROPERTY(EditAnywhere, BlueprintReadWrite) FGoalsTaskData TempTask; @@ -206,6 +204,9 @@ public: UFUNCTION(BlueprintCallable) FParsedData DoJsonParse(const FString& JsonString); + UFUNCTION(BlueprintCallable) + void UpdateTargetSelector(); + public: UFUNCTION(BlueprintCallable) void SetCurrentFolderName(const FString& FolderName); diff --git a/Source/Luckyrobots/Public/Gameplay/TargetSelector.h b/Source/Luckyrobots/Public/Gameplay/TargetSelector.h new file mode 100644 index 00000000..29fbfdf8 --- /dev/null +++ b/Source/Luckyrobots/Public/Gameplay/TargetSelector.h @@ -0,0 +1,29 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "TargetSelector.generated.h" + +UCLASS() +class LUCKYROBOTS_API ATargetSelector : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + ATargetSelector(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsTracing = true; +}; 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 cfe802ae..db38adf4 100644 --- a/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h +++ b/Source/Luckyrobots/Public/UI/Settings/CaptureSettingsUserWidget.h @@ -4,8 +4,11 @@ #include "CoreMinimal.h" #include "Blueprint/UserWidget.h" +#include "SharedDef.h" #include "CaptureSettingsUserWidget.generated.h" +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnOpenMenuStateChanged, bool, Open); + /** * */ @@ -13,5 +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(); };