forked from LuckyRobots/LuckyWorldV2
Merge branch 'main' of https://luckyrobots.com/LuckyRobots/LuckyWorldV2
This commit is contained in:
commit
ad0cd57220
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprint/component/BPC_CustomIK.uasset
Normal file
BIN
Content/Blueprint/component/BPC_CustomIK.uasset
Normal file
Binary file not shown.
Binary file not shown.
BIN
Content/Blueprint/structure/FActuatorForIk.uasset
Normal file
BIN
Content/Blueprint/structure/FActuatorForIk.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Content/luckyBot/icons/UI/SelectScreen/so100.uasset
Normal file
BIN
Content/luckyBot/icons/UI/SelectScreen/so100.uasset
Normal file
Binary file not shown.
@ -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()
|
||||
{
|
||||
@ -242,7 +244,7 @@ FString ULuckyRobotsGameInstance::GetWriteFolderPath()
|
||||
return WriteFolderPath;
|
||||
}
|
||||
|
||||
TSoftObjectPtr<UStaticMesh> ULuckyRobotsGameInstance::GetRandomMesh()
|
||||
TSoftObjectPtr<UStaticMesh> ULuckyRobotsGameInstance::GetRandomMesh(FTransform& SpawnTransform)
|
||||
{
|
||||
int32 MeshCount = GetCurrentRandomMeshes().Num();
|
||||
if (MeshCount > 0)
|
||||
@ -250,7 +252,19 @@ TSoftObjectPtr<UStaticMesh> ULuckyRobotsGameInstance::GetRandomMesh()
|
||||
int32 RandomIndex = UKismetMathLibrary::RandomIntegerInRange(0, MeshCount - 1);
|
||||
if (GetCurrentRandomMeshes().IsValidIndex(RandomIndex))
|
||||
{
|
||||
return GetCurrentRandomMeshes()[RandomIndex];
|
||||
TSoftObjectPtr<UStaticMesh> randommesh = (GetCurrentRandomMeshes()[RandomIndex]);
|
||||
|
||||
TArray<FSelectableItemData> SelectableItemList = GetSelectableItemList(EItemCategory::Furniture);
|
||||
for (auto SelectableItem : SelectableItemList)
|
||||
{
|
||||
if (SelectableItem.Mesh == randommesh)
|
||||
{
|
||||
SpawnTransform = SelectableItem.Transform;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return randommesh;
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,4 +615,94 @@ 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<int32>(ERobotsName::SO100Robot); i++)
|
||||
{
|
||||
ERobotsName EnumVal = static_cast<ERobotsName>(i);
|
||||
FString EnumString = StaticEnum<ERobotsName>()->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<ERobotsName>();
|
||||
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);
|
||||
if (GEngine)
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Blue, FString::Printf(TEXT("Robot selected: %s"), *Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
EUnrealBuildType ULuckyRobotsGameInstance::CheckBuildConfiguration() const
|
||||
{
|
||||
#if UE_BUILD_DEBUG
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("This is a Debug build"));
|
||||
return EUnrealBuildType::Debug;
|
||||
}
|
||||
#elif UE_BUILD_DEVELOPMENT
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("This is a Development build"));
|
||||
return EUnrealBuildType::Development;
|
||||
}
|
||||
#elif UE_BUILD_TEST
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("This is a Test build"));
|
||||
return EUnrealBuildType::Test;
|
||||
}
|
||||
#elif UE_BUILD_SHIPPING
|
||||
{
|
||||
return EUnrealBuildType::Shipping;
|
||||
UE_LOG(LogTemp, Warning, TEXT("This is a Shipping build"));
|
||||
}
|
||||
#else
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("Unknown build configuration"));
|
||||
return EUnrealBuildType::None;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public:
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ERobotsName CurrentSelectRobot = ERobotsName::None;
|
||||
ERobotsName CurrentSelectRobot = ERobotsName::SO100Robot;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ELevelEnum CurrentSelectLevel = ELevelEnum::None;
|
||||
@ -202,7 +202,7 @@ public:
|
||||
FString GetWriteFolderPath();
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
TSoftObjectPtr<UStaticMesh> GetRandomMesh();
|
||||
TSoftObjectPtr<UStaticMesh> GetRandomMesh(FTransform& SpawnTransform);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Selectable Items")
|
||||
TArray<FSelectableItemData> GetSelectableItemList(EItemCategory ItemCategory);
|
||||
@ -323,5 +323,12 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int32 GetWidgetTotalHit() const;
|
||||
UFUNCTION(exec)
|
||||
void SetLuckyRobot(FString RobotName);
|
||||
UFUNCTION(exec)
|
||||
void LuckyRobots();
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
EUnrealBuildType CheckBuildConfiguration() const;
|
||||
|
||||
};
|
||||
|
@ -79,6 +79,7 @@ public:
|
||||
void UpdateSelectQuality();
|
||||
|
||||
public:
|
||||
UFUNCTION()
|
||||
void OnMessageDispatchedHandler(const FString& Message);
|
||||
void DoSendReadyJson();
|
||||
|
||||
|
@ -35,6 +35,15 @@ enum class ERobotsName : uint8
|
||||
SO100Robot UMETA(DisplayName = "SO100 Arm Robot")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EUnrealBuildType : uint8
|
||||
{
|
||||
None UMETA(DisplayName = "Unknown build configuration"),
|
||||
Debug UMETA(DisplayName = "Debug build configuration"),
|
||||
Development UMETA(DisplayName = "Development build configuration"),
|
||||
Shipping UMETA(DisplayName = "Shipping build configuration")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ELevelType : uint8
|
||||
{
|
||||
|
@ -69,8 +69,9 @@ public:
|
||||
void ToggleShowPath();
|
||||
|
||||
void UpdateDownCount();
|
||||
|
||||
UFUNCTION()
|
||||
void OnStartTracing();
|
||||
UFUNCTION()
|
||||
void OnEndTracing();
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user