diff --git a/Content/Blueprint/RobotPawnActors/BP_RevoluteRobot.uasset b/Content/Blueprint/RobotPawnActors/BP_RevoluteRobot.uasset index 2a3fa1c0..29d733e1 100644 Binary files a/Content/Blueprint/RobotPawnActors/BP_RevoluteRobot.uasset and b/Content/Blueprint/RobotPawnActors/BP_RevoluteRobot.uasset differ diff --git a/Content/Blueprint/RobotPawnActors/BP_WheeledRobot.uasset b/Content/Blueprint/RobotPawnActors/BP_WheeledRobot.uasset index 28af7541..e276f41f 100644 Binary files a/Content/Blueprint/RobotPawnActors/BP_WheeledRobot.uasset and b/Content/Blueprint/RobotPawnActors/BP_WheeledRobot.uasset differ diff --git a/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset b/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset index 72fcc8a4..a0d8a229 100644 Binary files a/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset and b/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset differ diff --git a/Content/Blueprint/oldRobotsBP/BP_WheeledRobot.uasset b/Content/Blueprint/oldRobotsBP/BP_WheeledRobot.uasset index 4227127f..6e39a987 100644 Binary files a/Content/Blueprint/oldRobotsBP/BP_WheeledRobot.uasset and b/Content/Blueprint/oldRobotsBP/BP_WheeledRobot.uasset differ diff --git a/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset b/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset index 271c7d58..f24ebe42 100644 Binary files a/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset and b/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset differ diff --git a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset index c6c244a2..aaffcf85 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 f2452b8c..7267853f 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 288f1793..410589fc 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 cdd204ce..dd66ad7a 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/Core/LuckyRobotsGameInstance.cpp b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp index 31960174..10a55efd 100644 --- a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp +++ b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp @@ -344,6 +344,41 @@ void ULuckyRobotsGameInstance::GetMessageParse(FString Json) } } +FParsedData ULuckyRobotsGameInstance::DoJsonParse(const FString& JsonString) +{ + FParsedData ParsedData; + + auto VaRestSubsystem = CastChecked(USubsystemBlueprintLibrary::GetEngineSubsystem(UVaRestSubsystem::StaticClass()), ECastCheckedType::NullChecked); + + if (!VaRestSubsystem) + { + return ParsedData; + } + + UVaRestJsonObject* VaRestJsonObject = VaRestSubsystem->ConstructVaRestJsonObject(); + if (!VaRestJsonObject) + { + return ParsedData; + } + + if (VaRestJsonObject->DecodeJson(JsonString, true)) + { + UVaRestJsonObject* TempJsonObject = VaRestJsonObject->GetObjectField("startup_instructions"); + if (TempJsonObject) + { + ParsedData.LevelName = TempJsonObject->GetStringField("level"); + ParsedData.CharacterName = TempJsonObject->GetStringField("character"); + ParsedData.Quality = TempJsonObject->GetStringField("quality"); + } + } + else + { + UE_LOG(LogTemp, Error, TEXT("Parse Problem")); + } + + return ParsedData; +} + void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName) { CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName); diff --git a/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp b/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp index ee6e1137..bbd5b158 100644 --- a/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp +++ b/Source/Luckyrobots/Private/Menus/MainScreenUserWidget.cpp @@ -177,47 +177,12 @@ void UMainScreenUserWidget::UpdateSelectQuality() BPUpdateSelectQuality(); } -FParsedData UMainScreenUserWidget::DoJsonParse(const FString& JsonString) -{ - FParsedData ParsedData; - - auto VaRestSubsystem = CastChecked(USubsystemBlueprintLibrary::GetEngineSubsystem(UVaRestSubsystem::StaticClass()), ECastCheckedType::NullChecked); - - if (!VaRestSubsystem) - { - return ParsedData; - } - - UVaRestJsonObject* VaRestJsonObject = VaRestSubsystem->ConstructVaRestJsonObject(); - if (!VaRestJsonObject) - { - return ParsedData; - } - - if (VaRestJsonObject->DecodeJson(JsonString, true)) - { - UVaRestJsonObject* TempJsonObject = VaRestJsonObject->GetObjectField("startup_instructions"); - if (TempJsonObject) - { - ParsedData.LevelName = TempJsonObject->GetStringField("level"); - ParsedData.CharacterName = TempJsonObject->GetStringField("character"); - ParsedData.Quality = TempJsonObject->GetStringField("quality"); - } - } - else - { - UE_LOG(LogTemp, Error, TEXT("Parse Problem")); - } - - return ParsedData; -} - void UMainScreenUserWidget::OnMessageDispatchedHandler(const FString& Message) { ULuckyRobotsGameInstance* GameInstance = Cast(GetGameInstance()); if (GameInstance) { - FParsedData ParsedData = DoJsonParse(Message); + FParsedData ParsedData = GameInstance->DoJsonParse(Message); if (ParsedData.CharacterName == "DRONE") { GameInstance->CurrentSelectRobot = ERobotsName::LuckyDrone; diff --git a/Source/Luckyrobots/Private/UI/GameUserWidget.cpp b/Source/Luckyrobots/Private/UI/GameUserWidget.cpp index d02e7efb..f732c390 100644 --- a/Source/Luckyrobots/Private/UI/GameUserWidget.cpp +++ b/Source/Luckyrobots/Private/UI/GameUserWidget.cpp @@ -14,3 +14,38 @@ void UGameUserWidget::NativeConstruct() GameInstance->GameUserWidget = this; } } + +void UGameUserWidget::DoWaitSecond() +{ + ULuckyRobotsGameInstance* GameInstance = Cast(GetGameInstance()); + if (GameInstance) + { + if (GameInstance->bIsFirstOpenGame) + { + DownCount = 3; + GetWorld()->GetTimerManager().ClearTimer(UpdateDownCountTimerHandle); + GetWorld()->GetTimerManager().SetTimer(UpdateDownCountTimerHandle, this, &UGameUserWidget::UpdateDownCount, 1.0f, true); + + UpdateDownCount(); + } + } +} + +void UGameUserWidget::UpdateDownCount() +{ + if (DownCount > 0) + { + DownCountStr = FString::FromInt(DownCount); + DownCount--; + } + else + { + DownCountStr = ""; + ULuckyRobotsGameInstance* GameInstance = Cast(GetGameInstance()); + if (GameInstance) + { + GameInstance->DoQualitySettings(0, true); + } + GetWorld()->GetTimerManager().ClearTimer(UpdateDownCountTimerHandle); + } +} \ No newline at end of file diff --git a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h index 5341d132..67cba8f6 100644 --- a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h +++ b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h @@ -203,6 +203,9 @@ public: UFUNCTION(BlueprintCallable) void GetMessageParse(FString Json); + UFUNCTION(BlueprintCallable) + FParsedData DoJsonParse(const FString& JsonString); + public: UFUNCTION(BlueprintCallable) void SetCurrentFolderName(const FString& FolderName); diff --git a/Source/Luckyrobots/Public/Menus/MainScreenUserWidget.h b/Source/Luckyrobots/Public/Menus/MainScreenUserWidget.h index 7fcf3509..0d5491d1 100644 --- a/Source/Luckyrobots/Public/Menus/MainScreenUserWidget.h +++ b/Source/Luckyrobots/Public/Menus/MainScreenUserWidget.h @@ -79,7 +79,6 @@ public: void UpdateSelectQuality(); public: - FParsedData DoJsonParse(const FString& JsonString); void OnMessageDispatchedHandler(const FString& Message); void DoSendReadyJson(); diff --git a/Source/Luckyrobots/Public/UI/GameUserWidget.h b/Source/Luckyrobots/Public/UI/GameUserWidget.h index 6a663e86..0077062f 100644 --- a/Source/Luckyrobots/Public/UI/GameUserWidget.h +++ b/Source/Luckyrobots/Public/UI/GameUserWidget.h @@ -19,9 +19,32 @@ protected: virtual void NativeConstruct() override; public: - UFUNCTION(BlueprintImplementableEvent) + FTimerHandle UpdateDownCountTimerHandle; + +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsCrash; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsGoalMenuVis; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool bIsTracing; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + int32 DownCount = 0; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + FString DownCountStr; +public: + UFUNCTION(BlueprintCallable) + void DoWaitSecond(); + + void UpdateDownCount(); +public: + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void DoLogItemAdd(const FString& Topic, const FString& MsgText, ELogItemType LogItemType); - UFUNCTION(BlueprintImplementableEvent) + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void DoRefreshListView(); };