new consol command
This commit is contained in:
parent
59574370f5
commit
2f3caca7f6
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.
BIN
Content/Blueprint/structure/FActuatorForIk.uasset
Normal file
BIN
Content/Blueprint/structure/FActuatorForIk.uasset
Normal file
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()
|
||||
{
|
||||
@ -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<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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user