Merge pull request 'martin' (#17) from martin into main
Reviewed-on: luckyrobots/LuckyRobotsUnreal#17
This commit is contained in:
commit
c2ddce0ce8
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.
Binary file not shown.
Binary file not shown.
@ -215,6 +215,75 @@ void ULuckyRobotsGameInstance::DoQualitySettings(int32 Quality, bool Auto)
|
||||
}
|
||||
}
|
||||
|
||||
FString ULuckyRobotsGameInstance::GetWriteFolderPath()
|
||||
{
|
||||
FString Directory = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir());
|
||||
FString WriteFolderPath = FPaths::Combine(Directory, GetCurrentFolderName()) + "/";
|
||||
|
||||
return WriteFolderPath;
|
||||
}
|
||||
|
||||
TSoftObjectPtr<UStaticMesh> ULuckyRobotsGameInstance::GetRandomMesh()
|
||||
{
|
||||
int32 MeshCount = GetCurrentRandomMeshes().Num();
|
||||
if (MeshCount > 0)
|
||||
{
|
||||
int32 RandomIndex = UKismetMathLibrary::RandomIntegerInRange(0, MeshCount - 1);
|
||||
if (GetCurrentRandomMeshes().IsValidIndex(RandomIndex))
|
||||
{
|
||||
return GetCurrentRandomMeshes()[RandomIndex];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TArray<FSelectableItemData> ULuckyRobotsGameInstance::GetSelectableItemList(EItemCategory ItemCategory)
|
||||
{
|
||||
TArray<FSelectableItemData> SelectableItemList;
|
||||
UDataTable* SelectedDataTable = nullptr;
|
||||
|
||||
switch (ItemCategory)
|
||||
{
|
||||
case EItemCategory::Furniture:
|
||||
SelectedDataTable = FurnitureDataTable;
|
||||
break;
|
||||
case EItemCategory::Decoration:
|
||||
SelectedDataTable = DecorationDataTable;
|
||||
break;
|
||||
case EItemCategory::Kitchenware:
|
||||
SelectedDataTable = KitchenwareDataTable;
|
||||
break;
|
||||
case EItemCategory::Electronics:
|
||||
SelectedDataTable = ElectronicsDataTable;
|
||||
break;
|
||||
case EItemCategory::Bathroom:
|
||||
SelectedDataTable = BathroomDataTable;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (SelectedDataTable)
|
||||
{
|
||||
FString ContextString;
|
||||
TArray<FName> RowNames = SelectedDataTable->GetRowNames();
|
||||
for (const FName& RowName : RowNames)
|
||||
{
|
||||
FSelectableItemData* ItemData = SelectedDataTable->FindRow<FSelectableItemData>(RowName, ContextString);
|
||||
if (ItemData)
|
||||
{
|
||||
if (ItemData->Category == ItemCategory && UKismetSystemLibrary::IsValidSoftObjectReference(ItemData->Mesh))
|
||||
{
|
||||
SelectableItemList.Add(*ItemData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SelectableItemList;
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName)
|
||||
{
|
||||
CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName);
|
||||
|
@ -180,6 +180,16 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DoQualitySettings(int32 Quality, bool Auto);
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
FString GetWriteFolderPath();
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
TSoftObjectPtr<UStaticMesh> GetRandomMesh();
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Selectable Items")
|
||||
TArray<FSelectableItemData> GetSelectableItemList(EItemCategory ItemCategory);
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentFolderName(const FString& FolderName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user