Merge pull request 'martin' (#12) from martin into main

Reviewed-on: luckyrobots/LuckyRobotsUnreal#12
This commit is contained in:
martinluckyrobots 2025-04-04 06:07:27 +00:00
commit 0327fdbdbb
37 changed files with 317 additions and 13 deletions

View File

@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CaptureSettingsUserWidget.h"

View File

@ -80,7 +80,7 @@ void ULuckyRobotsFunctionLibrary::UpdateQualitySettings(const UObject* WorldCont
}
}
FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings()
FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings(const UObject* WorldContextObject)
{
FCaptureSettingsData DefaultCaptureSetting;
DefaultCaptureSetting.FolderName = FText::FromString("robotdata");
@ -94,6 +94,11 @@ FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings()
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
if (SaveGame)
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->CurrentCaptureSettingsData = SaveGame->CaptureSetting;
}
return SaveGame->CaptureSetting;
}
else
@ -109,8 +114,14 @@ FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings()
return DefaultCaptureSetting;
}
void ULuckyRobotsFunctionLibrary::SaveCaptureSettings(FCaptureSettingsData CaptureSetting)
void ULuckyRobotsFunctionLibrary::SaveCaptureSettings(const UObject* WorldContextObject, FCaptureSettingsData CaptureSetting)
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->CurrentCaptureSettingsData = CaptureSetting;
}
USG_CaptureSetting* SaveGame = nullptr;
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
if (!SaveGame)

View File

@ -14,14 +14,14 @@ void ULuckyRobotsGameInstance::DoSendMessage(FString SendValue)
LuckyRobotsGameState->DoSendMessage(SendValue);
}
DoLogItemAdd("Receive", SendValue, 0);
DoLogItemAdd("Receive", SendValue, ELogItemType::Debug);
}
void ULuckyRobotsGameInstance::DoLogItemAdd(FString Topic, FString MsgText, int Type)
void ULuckyRobotsGameInstance::DoLogItemAdd(FString Topic, FString MsgText, ELogItemType LogItemType)
{
if (GameUserWidget)
{
GameUserWidget->DoLogItemAdd(Topic, MsgText, Type);
GameUserWidget->DoLogItemAdd(Topic, MsgText, LogItemType);
}
}
@ -133,3 +133,134 @@ void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool IsClear)
GameUserWidget->DoRefreshListView();
}
}
void ULuckyRobotsGameInstance::SetCurrentFolderName(FString FolderName)
{
CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName);
}
void ULuckyRobotsGameInstance::SetCurrentFileName(FString FileName)
{
CurrentCaptureSettingsData.FileName = FText::FromString(FileName);
}
void ULuckyRobotsGameInstance::SetCurrentWritesPerSec(int WritesPerSec)
{
CurrentCaptureSettingsData.WritesPerSec = FText::FromString(FString::FromInt(WritesPerSec));
}
void ULuckyRobotsGameInstance::SetCurrentIsScenario(bool IsScenario)
{
CurrentCaptureSettingsData.IsScenario = IsScenario;
}
void ULuckyRobotsGameInstance::SetCurrentIsRandomLight(bool bLight)
{
CurrentCaptureSettingsData.bLight = bLight;
}
void ULuckyRobotsGameInstance::SetCurrentIsRandomMaterials(bool bMaterials)
{
CurrentCaptureSettingsData.bMaterials = bMaterials;
}
void ULuckyRobotsGameInstance::SetCurrentIsRandomRobotPosition(bool bRobotPosition)
{
CurrentCaptureSettingsData.bRobotPosition = bRobotPosition;
}
void ULuckyRobotsGameInstance::SetCurrentIsRandomPets(bool bPets)
{
CurrentCaptureSettingsData.bPets = bPets;
}
void ULuckyRobotsGameInstance::SetCurrentPetsNumber(int PetsNumber)
{
CurrentCaptureSettingsData.NumberOfPets = FText::FromString(FString::FromInt(PetsNumber));
}
void ULuckyRobotsGameInstance::SetCurrentIsRandomPeople(bool bPeople)
{
CurrentCaptureSettingsData.bPeople = bPeople;
}
void ULuckyRobotsGameInstance::SetCurrentPeopleNumber(int PeopleNumber)
{
CurrentCaptureSettingsData.NumberOfPeople = FText::FromString(FString::FromInt(PeopleNumber));
}
void ULuckyRobotsGameInstance::SetCurrentIsRandomObjects(bool bObjects)
{
CurrentCaptureSettingsData.bObjects = bObjects;
}
void ULuckyRobotsGameInstance::SetCurrentObjectsNumber(int ObjectsNumber)
{
CurrentCaptureSettingsData.NumberOfObjects = FText::FromString(FString::FromInt(ObjectsNumber));
}
void ULuckyRobotsGameInstance::SetCurrentRandomMeshes(TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes)
{
CurrentCaptureSettingsData.RandomMeshes = RandomMeshes;
}
void ULuckyRobotsGameInstance::SetCurrentIsInfiniteCapture(bool bInfiniteCapture)
{
CurrentCaptureSettingsData.bInfiniteCapture = bInfiniteCapture;
}
void ULuckyRobotsGameInstance::SetCurrentCaptureNumber(int CaptureNumber)
{
CurrentCaptureSettingsData.NumberOfCaptures = FText::FromString(FString::FromInt(CaptureNumber));
}
FString ULuckyRobotsGameInstance::GetCurrentFolderName()
{
return CurrentCaptureSettingsData.FolderName.ToString();
}
FString ULuckyRobotsGameInstance::GetCurrentFileName()
{
return CurrentCaptureSettingsData.FileName.ToString();
}
int ULuckyRobotsGameInstance::GetCurrentWritesPerSec()
{
return FCString::Atoi(*(CurrentCaptureSettingsData.WritesPerSec.ToString()));
}
bool ULuckyRobotsGameInstance::GetCurrentIsScenario()
{
return CurrentCaptureSettingsData.IsScenario;
}
bool ULuckyRobotsGameInstance::GetCurrentIsRandomLight()
{
return CurrentCaptureSettingsData.bLight;
}
bool ULuckyRobotsGameInstance::GetCurrentIsRandomMaterials()
{
return CurrentCaptureSettingsData.bMaterials;
}
bool ULuckyRobotsGameInstance::GetCurrentIsRandomRobotPosition()
{
return CurrentCaptureSettingsData.bRobotPosition;
}
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPets()
{
return CurrentCaptureSettingsData.bPets;
}
int ULuckyRobotsGameInstance::GetCurrentPetsNumber()
{
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfPets.ToString()));
}
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPeople()
{
return CurrentCaptureSettingsData.bPeople;
}
int ULuckyRobotsGameInstance::GetCurrentPeopleNumber()
{
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfPeople.ToString()));
}
bool ULuckyRobotsGameInstance::GetCurrentIsRandomObjects()
{
return CurrentCaptureSettingsData.bObjects;
}
int ULuckyRobotsGameInstance::GetCurrentObjectsNumber()
{
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfObjects.ToString()));
}
TArray<TSoftObjectPtr<UStaticMeshComponent>> ULuckyRobotsGameInstance::GetCurrentRandomMeshes()
{
return CurrentCaptureSettingsData.RandomMeshes;
}
bool ULuckyRobotsGameInstance::GetCurrentIsInfiniteCapture()
{
return CurrentCaptureSettingsData.bInfiniteCapture;
}
int ULuckyRobotsGameInstance::GetCurrentCaptureNumber()
{
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfCaptures.ToString()));
}

View File

@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "CaptureSettingsUserWidget.generated.h"
/**
*
*/
UCLASS()
class LUCKYROBOTS_API UCaptureSettingsUserWidget : public UUserWidget
{
GENERATED_BODY()
};

View File

@ -4,6 +4,7 @@
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "SharedDef.h"
#include "GameUserWidget.generated.h"
/**
@ -19,7 +20,7 @@ protected:
public:
UFUNCTION(BlueprintImplementableEvent)
void DoLogItemAdd(const FString& Topic, const FString& MsgText,int Type);
void DoLogItemAdd(const FString& Topic, const FString& MsgText, ELogItemType LogItemType);
UFUNCTION(BlueprintImplementableEvent)
void DoRefreshListView();

View File

@ -29,9 +29,9 @@ public:
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
static void UpdateQualitySettings(const UObject* WorldContextObject);
UFUNCTION(BlueprintCallable)
static FCaptureSettingsData LoadCaptureSettings();
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
static FCaptureSettingsData LoadCaptureSettings(const UObject* WorldContextObject);
UFUNCTION(BlueprintCallable)
static void SaveCaptureSettings(FCaptureSettingsData CaptureSetting);
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
static void SaveCaptureSettings(const UObject* WorldContextObject, FCaptureSettingsData CaptureSetting);
};

View File

@ -24,6 +24,41 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* LevelDataTable;
public:
bool bIsFirstOpenGame;
bool bIsDebug;
bool bIsWidgetTestMode;
bool bIsShowPath;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bIsCapture;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bIsCaptureHand;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bIsCaptureHead;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bScenarioCapture;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bIsMouseOpen;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bIschange;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
int FolderCount;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
FTransform TargetPosition;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
FCaptureSettingsData CurrentCaptureSettingsData;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
ERobotsName CurrentSelectRobot = ERobotsName::None;
@ -51,7 +86,7 @@ public:
void DoSendMessage(FString SendValue);
UFUNCTION(BlueprintCallable)
void DoLogItemAdd(FString Topic, FString MsgText, int Type);
void DoLogItemAdd(FString Topic, FString MsgText, ELogItemType LogItemType);
UFUNCTION(BlueprintCallable)
void SwitchGamePaused();
@ -87,6 +122,104 @@ public:
UFUNCTION(BlueprintCallable)
void DoSetTempTaskValueChange(bool IsClear);
public:
UFUNCTION(BlueprintCallable)
void SetCurrentFolderName(FString FolderName);
UFUNCTION(BlueprintCallable)
void SetCurrentFileName(FString FileName);
UFUNCTION(BlueprintCallable)
void SetCurrentWritesPerSec(int WritesPerSec);
UFUNCTION(BlueprintCallable)
void SetCurrentIsScenario(bool IsScenario);
UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomLight(bool bLight);
UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomMaterials(bool bMaterials);
UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomRobotPosition(bool bRobotPosition);
UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomPets(bool bPets);
UFUNCTION(BlueprintCallable)
void SetCurrentPetsNumber(int PetsNumber);
UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomPeople(bool bPeople);
UFUNCTION(BlueprintCallable)
void SetCurrentPeopleNumber(int PeopleNumber);
UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomObjects(bool bObjects);
UFUNCTION(BlueprintCallable)
void SetCurrentObjectsNumber(int ObjectsNumber);
UFUNCTION(BlueprintCallable)
void SetCurrentRandomMeshes(TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes);
UFUNCTION(BlueprintCallable)
void SetCurrentIsInfiniteCapture(bool bInfiniteCapture);
UFUNCTION(BlueprintCallable)
void SetCurrentCaptureNumber(int CaptureNumber);
public:
UFUNCTION(BlueprintPure)
FString GetCurrentFolderName();
UFUNCTION(BlueprintPure)
FString GetCurrentFileName();
UFUNCTION(BlueprintPure)
int GetCurrentWritesPerSec();
UFUNCTION(BlueprintPure)
bool GetCurrentIsScenario();
UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomLight();
UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomMaterials();
UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomRobotPosition();
UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomPets();
UFUNCTION(BlueprintPure)
int GetCurrentPetsNumber();
UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomPeople();
UFUNCTION(BlueprintPure)
int GetCurrentPeopleNumber();
UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomObjects();
UFUNCTION(BlueprintPure)
int GetCurrentObjectsNumber();
UFUNCTION(BlueprintPure)
TArray<TSoftObjectPtr<UStaticMeshComponent>> GetCurrentRandomMeshes();
UFUNCTION(BlueprintPure)
bool GetCurrentIsInfiniteCapture();
UFUNCTION(BlueprintPure)
int GetCurrentCaptureNumber();
public:
UFUNCTION(BlueprintImplementableEvent)
void DoGetDispatch(const FString& EventName, USIOJsonValue* EventData);

View File

@ -108,7 +108,14 @@ enum class ESaveDataType : uint8
none UMETA(DisplayName = "none")
};
UENUM(BlueprintType)
enum class ELogItemType : uint8
{
Debug UMETA(DisplayName = "Debug"),
War UMETA(DisplayName = "War"),
Error UMETA(DisplayName = "Error"),
Consol UMETA(DisplayName = "Consol")
};
USTRUCT(BlueprintType)
struct FRobotData : public FTableRowBase
{
@ -262,7 +269,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText WritesPerSec = FText::FromString("1");
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool IsScenario;