diff --git a/Content/Blueprint/RobotPawnActors/BP_mujokoSO_100.uasset b/Content/Blueprint/RobotPawnActors/BP_mujokoSO_100.uasset index 483d1bc3..ca45f388 100644 Binary files a/Content/Blueprint/RobotPawnActors/BP_mujokoSO_100.uasset and b/Content/Blueprint/RobotPawnActors/BP_mujokoSO_100.uasset differ diff --git a/Content/Blueprint/component/BPC_CustomIK.uasset b/Content/Blueprint/component/BPC_CustomIK.uasset new file mode 100644 index 00000000..07ad90e5 Binary files /dev/null and b/Content/Blueprint/component/BPC_CustomIK.uasset differ diff --git a/Content/Blueprint/structure/FActuatorForIk.uasset b/Content/Blueprint/structure/FActuatorForIk.uasset new file mode 100644 index 00000000..bbadda69 Binary files /dev/null and b/Content/Blueprint/structure/FActuatorForIk.uasset differ diff --git a/Content/GameBP/Datatable/DT_RobotData.uasset b/Content/GameBP/Datatable/DT_RobotData.uasset index e07b8ba3..65b4d89a 100644 Binary files a/Content/GameBP/Datatable/DT_RobotData.uasset and b/Content/GameBP/Datatable/DT_RobotData.uasset differ diff --git a/Content/luckyBot/icons/UI/SelectScreen/so100.uasset b/Content/luckyBot/icons/UI/SelectScreen/so100.uasset new file mode 100644 index 00000000..7424fb04 Binary files /dev/null and b/Content/luckyBot/icons/UI/SelectScreen/so100.uasset differ diff --git a/Source/LuckyWorldV2/Private/Core/LuckyRobotsGameInstance.cpp b/Source/LuckyWorldV2/Private/Core/LuckyRobotsGameInstance.cpp index ebc40ce3..2e53cf3e 100644 --- a/Source/LuckyWorldV2/Private/Core/LuckyRobotsGameInstance.cpp +++ b/Source/LuckyWorldV2/Private/Core/LuckyRobotsGameInstance.cpp @@ -14,6 +14,8 @@ #include "Gameplay/TargetSelector.h" #include "UI/Settings/CaptureSettingsUserWidget.h" #include "Subsystem/UISubsystem.h" +#include "Engine/World.h" +#include "Engine/Engine.h" void ULuckyRobotsGameInstance::Init() { @@ -601,4 +603,61 @@ void ULuckyRobotsGameInstance::SetWidgetTotalHit(int32 Value) int32 ULuckyRobotsGameInstance::GetWidgetTotalHit() const { return WidgetTotalHit; +} +void ULuckyRobotsGameInstance::SetLuckyRobot(FString RobotName) +{ + bool bFound = false; + + for (int32 i = 0; i <= static_cast(ERobotsName::SO100Robot); i++) + { + ERobotsName EnumVal = static_cast(i); + FString EnumString = StaticEnum()->GetNameStringByValue(i); // Enum name + + if (EnumString.Equals(RobotName, ESearchCase::IgnoreCase)) + { + CurrentSelectRobot = EnumVal; + bFound = true; + + UE_LOG(LogTemp, Warning, TEXT("Robot selected: %s"), *EnumString); + + // Current level reopen + if (UWorld* World = GetWorld()) + { + FString CurrentLevelName = World->GetMapName(); + + // Remove PIE prefix if present + FString ShortName = FPackageName::GetShortName(CurrentLevelName); + ShortName.RemoveFromStart(TEXT("UEDPIE_0_")); // Adjust for PIE prefix + + if (!ShortName.IsEmpty()) + { + UE_LOG(LogTemp, Warning, TEXT("Reopening level: %s"), *ShortName); + UGameplayStatics::OpenLevel(World, FName(*ShortName)); + } + else + { + UE_LOG(LogTemp, Error, TEXT("Failed to extract short name from level: %s"), *CurrentLevelName); + } + } + break; + } + } + + if (!bFound) + { + UE_LOG(LogTemp, Error, TEXT("Invalid robot name: %s"), *RobotName); + } +} +void ULuckyRobotsGameInstance::LuckyRobots() +{ + UEnum* EnumPtr = StaticEnum(); + if (!EnumPtr) return; + + for (int32 i = 0; i < EnumPtr->NumEnums() - 1; ++i) // Last is _MAX usually + { + FString Name = EnumPtr->GetNameStringByIndex(i); + Name = Name.Replace(TEXT("ERobotsName::"), TEXT("")); + GameUserWidget->DoLogItemAdd("Robot:", Name, ELogItemType::Consol); + UE_LOG(LogTemp, Display, TEXT("Robot: %s"), *Name); + } } \ No newline at end of file diff --git a/Source/LuckyWorldV2/Public/Core/LuckyRobotsGameInstance.h b/Source/LuckyWorldV2/Public/Core/LuckyRobotsGameInstance.h index 06216130..0c8836da 100644 --- a/Source/LuckyWorldV2/Public/Core/LuckyRobotsGameInstance.h +++ b/Source/LuckyWorldV2/Public/Core/LuckyRobotsGameInstance.h @@ -121,7 +121,7 @@ public: public: UPROPERTY(EditAnywhere, BlueprintReadWrite) - ERobotsName CurrentSelectRobot = ERobotsName::None; + ERobotsName CurrentSelectRobot = ERobotsName::SO100Robot; UPROPERTY(EditAnywhere, BlueprintReadWrite) ELevelEnum CurrentSelectLevel = ELevelEnum::None; @@ -323,5 +323,9 @@ public: UFUNCTION(BlueprintPure) int32 GetWidgetTotalHit() const; + UFUNCTION(exec) + void SetLuckyRobot(FString RobotName); + UFUNCTION(exec) + void LuckyRobots(); };