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

Reviewed-on: luckyrobots/LuckyRobotsUnreal#14
This commit is contained in:
martinluckyrobots 2025-04-08 01:55:44 +00:00
commit 537443339d
101 changed files with 795 additions and 542 deletions

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -1,23 +1,22 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "LuckyRobotsGameInstance.h" #include "Core/LuckyRobotsGameInstance.h"
#include "LuckyRobotsGameState.h" #include "GameModes/LuckyRobotsGameState.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "GameUserWidget.h" #include "UI/GameUserWidget.h"
#include "Kismet/KismetSystemLibrary.h"
void ULuckyRobotsGameInstance::DoSendMessage(FString SendValue) void ULuckyRobotsGameInstance::DoSendMessage(const FString& SendValue)
{ {
ALuckyRobotsGameState* LuckyRobotsGameState = Cast<ALuckyRobotsGameState>(UGameplayStatics::GetGameState(this)); if (ALuckyRobotsGameState* GameState = Cast<ALuckyRobotsGameState>(UGameplayStatics::GetGameState(this)))
if (LuckyRobotsGameState)
{ {
LuckyRobotsGameState->DoSendMessage(SendValue); GameState->DoSendMessage(SendValue);
} }
DoLogItemAdd(TEXT("Receive"), SendValue, ELogItemType::Debug);
DoLogItemAdd("Receive", SendValue, ELogItemType::Debug);
} }
void ULuckyRobotsGameInstance::DoLogItemAdd(FString Topic, FString MsgText, ELogItemType LogItemType) void ULuckyRobotsGameInstance::DoLogItemAdd(const FString& Topic, const FString& MsgText, ELogItemType LogItemType)
{ {
if (GameUserWidget) if (GameUserWidget)
{ {
@ -27,15 +26,16 @@ void ULuckyRobotsGameInstance::DoLogItemAdd(FString Topic, FString MsgText, ELog
void ULuckyRobotsGameInstance::SwitchGamePaused() void ULuckyRobotsGameInstance::SwitchGamePaused()
{ {
UGameplayStatics::SetGamePaused(this, !UGameplayStatics::IsGamePaused(this)); bool bPaused = UGameplayStatics::IsGamePaused(this);
UGameplayStatics::SetGamePaused(this, !bPaused);
if (UGameplayStatics::IsGamePaused(this)) if (!bPaused)
{ {
UKismetSystemLibrary::ExecuteConsoleCommand(this, "r.SceneRendering 0"); UKismetSystemLibrary::ExecuteConsoleCommand(this, TEXT("r.SceneRendering 0"));
} }
else else
{ {
UKismetSystemLibrary::ExecuteConsoleCommand(this, "r.SceneRendering 1"); UKismetSystemLibrary::ExecuteConsoleCommand(this, TEXT("r.SceneRendering 1"));
} }
} }
@ -44,18 +44,19 @@ void ULuckyRobotsGameInstance::ClearTaskList()
TaskList.Empty(); TaskList.Empty();
} }
void ULuckyRobotsGameInstance::AddTask(FGoalsTaskData TaskData) void ULuckyRobotsGameInstance::AddTask(const FGoalsTaskData& TaskData)
{ {
TaskList.Add(TaskData); TaskList.Add(TaskData);
} }
void ULuckyRobotsGameInstance::RemoveTask(FGoalsTaskData TaskData)
void ULuckyRobotsGameInstance::RemoveTask(const FGoalsTaskData& TaskData)
{ {
TaskList.Remove(TaskData); TaskList.Remove(TaskData);
} }
void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType) void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType)
{ {
for (auto Task : TaskList) for (const FGoalsTaskData& Task : TaskList)
{ {
if (Task.GoalType == GoalType) if (Task.GoalType == GoalType)
{ {
@ -65,12 +66,12 @@ void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType)
} }
} }
int ULuckyRobotsGameInstance::GetTaskNum() int32 ULuckyRobotsGameInstance::GetTaskNum() const
{ {
return TaskList.Num(); return TaskList.Num();
} }
void ULuckyRobotsGameInstance::SetTask(int Index, FGoalsTaskData TaskData) void ULuckyRobotsGameInstance::SetTask(int32 Index, const FGoalsTaskData& TaskData)
{ {
if (TaskList.IsValidIndex(Index)) if (TaskList.IsValidIndex(Index))
{ {
@ -78,7 +79,7 @@ void ULuckyRobotsGameInstance::SetTask(int Index, FGoalsTaskData TaskData)
} }
else else
{ {
for (int i = TaskList.Num(); i < Index; i++) while (TaskList.Num() < Index)
{ {
FGoalsTaskData TempTaskData; FGoalsTaskData TempTaskData;
AddTask(TempTaskData); AddTask(TempTaskData);
@ -87,39 +88,37 @@ void ULuckyRobotsGameInstance::SetTask(int Index, FGoalsTaskData TaskData)
} }
} }
bool ULuckyRobotsGameInstance::GetTask(int Index, FGoalsTaskData& TaskData) bool ULuckyRobotsGameInstance::GetTask(int32 Index, FGoalsTaskData& OutTaskData) const
{ {
if (TaskList.IsValidIndex(Index)) if (TaskList.IsValidIndex(Index))
{ {
TaskData = TaskList[Index]; OutTaskData = TaskList[Index];
return true; return true;
} }
return false; return false;
} }
void ULuckyRobotsGameInstance::ReSetTaskList() void ULuckyRobotsGameInstance::ReSetTaskList()
{ {
TArray<FGoalsTaskData> TempTaskList; TArray<FGoalsTaskData> TempTaskList;
for (auto Task : TaskList) for (FGoalsTaskData& Task : TaskList)
{ {
Task.bIsStart = false; Task.bIsStart = false;
Task.bIsStart = false; Task.bIsComplete = false;
Task.bActive = false; Task.bActive = false;
TempTaskList.Add(Task); TempTaskList.Add(Task);
} }
TaskList = TempTaskList; TaskList = TempTaskList;
} }
TArray<FGoalsTaskData> ULuckyRobotsGameInstance::GetTaskList() TArray<FGoalsTaskData> ULuckyRobotsGameInstance::GetTaskList() const
{ {
return TaskList; return TaskList;
} }
void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool IsClear) void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool bIsClear)
{ {
if (IsClear) if (bIsClear)
{ {
ClearTaskList(); ClearTaskList();
} }
@ -134,133 +133,162 @@ void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool IsClear)
} }
} }
void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName)
void ULuckyRobotsGameInstance::SetCurrentFolderName(FString FolderName)
{ {
CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName); CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName);
} }
void ULuckyRobotsGameInstance::SetCurrentFileName(FString FileName)
void ULuckyRobotsGameInstance::SetCurrentFileName(const FString& FileName)
{ {
CurrentCaptureSettingsData.FileName = FText::FromString(FileName); CurrentCaptureSettingsData.FileName = FText::FromString(FileName);
} }
void ULuckyRobotsGameInstance::SetCurrentWritesPerSec(int WritesPerSec)
void ULuckyRobotsGameInstance::SetCurrentWritesPerSec(int32 WritesPerSec)
{ {
CurrentCaptureSettingsData.WritesPerSec = FText::FromString(FString::FromInt(WritesPerSec)); CurrentCaptureSettingsData.WritesPerSec = FText::FromString(FString::FromInt(WritesPerSec));
} }
void ULuckyRobotsGameInstance::SetCurrentIsScenario(bool IsScenario) void ULuckyRobotsGameInstance::SetCurrentIsScenario(bool IsScenario)
{ {
CurrentCaptureSettingsData.IsScenario = IsScenario; CurrentCaptureSettingsData.IsScenario = IsScenario;
} }
void ULuckyRobotsGameInstance::SetCurrentIsRandomLight(bool bLight) void ULuckyRobotsGameInstance::SetCurrentIsRandomLight(bool bLight)
{ {
CurrentCaptureSettingsData.bLight = bLight; CurrentCaptureSettingsData.bLight = bLight;
} }
void ULuckyRobotsGameInstance::SetCurrentIsRandomMaterials(bool bMaterials) void ULuckyRobotsGameInstance::SetCurrentIsRandomMaterials(bool bMaterials)
{ {
CurrentCaptureSettingsData.bMaterials = bMaterials; CurrentCaptureSettingsData.bMaterials = bMaterials;
} }
void ULuckyRobotsGameInstance::SetCurrentIsRandomRobotPosition(bool bRobotPosition) void ULuckyRobotsGameInstance::SetCurrentIsRandomRobotPosition(bool bRobotPosition)
{ {
CurrentCaptureSettingsData.bRobotPosition = bRobotPosition; CurrentCaptureSettingsData.bRobotPosition = bRobotPosition;
} }
void ULuckyRobotsGameInstance::SetCurrentIsRandomPets(bool bPets) void ULuckyRobotsGameInstance::SetCurrentIsRandomPets(bool bPets)
{ {
CurrentCaptureSettingsData.bPets = bPets; CurrentCaptureSettingsData.bPets = bPets;
} }
void ULuckyRobotsGameInstance::SetCurrentPetsNumber(int PetsNumber)
void ULuckyRobotsGameInstance::SetCurrentPetsNumber(int32 PetsNumber)
{ {
CurrentCaptureSettingsData.NumberOfPets = FText::FromString(FString::FromInt(PetsNumber)); CurrentCaptureSettingsData.NumberOfPets = FText::FromString(FString::FromInt(PetsNumber));
} }
void ULuckyRobotsGameInstance::SetCurrentIsRandomPeople(bool bPeople) void ULuckyRobotsGameInstance::SetCurrentIsRandomPeople(bool bPeople)
{ {
CurrentCaptureSettingsData.bPeople = bPeople; CurrentCaptureSettingsData.bPeople = bPeople;
} }
void ULuckyRobotsGameInstance::SetCurrentPeopleNumber(int PeopleNumber)
void ULuckyRobotsGameInstance::SetCurrentPeopleNumber(int32 PeopleNumber)
{ {
CurrentCaptureSettingsData.NumberOfPeople = FText::FromString(FString::FromInt(PeopleNumber)); CurrentCaptureSettingsData.NumberOfPeople = FText::FromString(FString::FromInt(PeopleNumber));
} }
void ULuckyRobotsGameInstance::SetCurrentIsRandomObjects(bool bObjects) void ULuckyRobotsGameInstance::SetCurrentIsRandomObjects(bool bObjects)
{ {
CurrentCaptureSettingsData.bObjects = bObjects; CurrentCaptureSettingsData.bObjects = bObjects;
} }
void ULuckyRobotsGameInstance::SetCurrentObjectsNumber(int ObjectsNumber)
void ULuckyRobotsGameInstance::SetCurrentObjectsNumber(int32 ObjectsNumber)
{ {
CurrentCaptureSettingsData.NumberOfObjects = FText::FromString(FString::FromInt(ObjectsNumber)); CurrentCaptureSettingsData.NumberOfObjects = FText::FromString(FString::FromInt(ObjectsNumber));
} }
void ULuckyRobotsGameInstance::SetCurrentRandomMeshes(TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes)
void ULuckyRobotsGameInstance::SetCurrentRandomMeshes(const TArray<TSoftObjectPtr<UStaticMesh>>& RandomMeshes)
{ {
CurrentCaptureSettingsData.RandomMeshes = RandomMeshes; CurrentCaptureSettingsData.RandomMeshes = RandomMeshes;
} }
void ULuckyRobotsGameInstance::SetCurrentIsInfiniteCapture(bool bInfiniteCapture) void ULuckyRobotsGameInstance::SetCurrentIsInfiniteCapture(bool bInfiniteCapture)
{ {
CurrentCaptureSettingsData.bInfiniteCapture = bInfiniteCapture; CurrentCaptureSettingsData.bInfiniteCapture = bInfiniteCapture;
} }
void ULuckyRobotsGameInstance::SetCurrentCaptureNumber(int CaptureNumber)
void ULuckyRobotsGameInstance::SetCurrentCaptureNumber(int32 CaptureNumber)
{ {
CurrentCaptureSettingsData.NumberOfCaptures = FText::FromString(FString::FromInt(CaptureNumber)); CurrentCaptureSettingsData.NumberOfCaptures = FText::FromString(FString::FromInt(CaptureNumber));
} }
FString ULuckyRobotsGameInstance::GetCurrentFolderName() FString ULuckyRobotsGameInstance::GetCurrentFolderName() const
{ {
return CurrentCaptureSettingsData.FolderName.ToString(); return CurrentCaptureSettingsData.FolderName.ToString();
} }
FString ULuckyRobotsGameInstance::GetCurrentFileName()
FString ULuckyRobotsGameInstance::GetCurrentFileName() const
{ {
return CurrentCaptureSettingsData.FileName.ToString(); return CurrentCaptureSettingsData.FileName.ToString();
} }
int ULuckyRobotsGameInstance::GetCurrentWritesPerSec()
int32 ULuckyRobotsGameInstance::GetCurrentWritesPerSec() const
{ {
return FCString::Atoi(*(CurrentCaptureSettingsData.WritesPerSec.ToString())); return FCString::Atoi(*CurrentCaptureSettingsData.WritesPerSec.ToString());
} }
bool ULuckyRobotsGameInstance::GetCurrentIsScenario()
bool ULuckyRobotsGameInstance::GetCurrentIsScenario() const
{ {
return CurrentCaptureSettingsData.IsScenario; return CurrentCaptureSettingsData.IsScenario;
} }
bool ULuckyRobotsGameInstance::GetCurrentIsRandomLight()
bool ULuckyRobotsGameInstance::GetCurrentIsRandomLight() const
{ {
return CurrentCaptureSettingsData.bLight; return CurrentCaptureSettingsData.bLight;
} }
bool ULuckyRobotsGameInstance::GetCurrentIsRandomMaterials()
bool ULuckyRobotsGameInstance::GetCurrentIsRandomMaterials() const
{ {
return CurrentCaptureSettingsData.bMaterials; return CurrentCaptureSettingsData.bMaterials;
} }
bool ULuckyRobotsGameInstance::GetCurrentIsRandomRobotPosition()
bool ULuckyRobotsGameInstance::GetCurrentIsRandomRobotPosition() const
{ {
return CurrentCaptureSettingsData.bRobotPosition; return CurrentCaptureSettingsData.bRobotPosition;
} }
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPets()
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPets() const
{ {
return CurrentCaptureSettingsData.bPets; return CurrentCaptureSettingsData.bPets;
} }
int ULuckyRobotsGameInstance::GetCurrentPetsNumber()
int32 ULuckyRobotsGameInstance::GetCurrentPetsNumber() const
{ {
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfPets.ToString())); return FCString::Atoi(*CurrentCaptureSettingsData.NumberOfPets.ToString());
} }
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPeople()
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPeople() const
{ {
return CurrentCaptureSettingsData.bPeople; return CurrentCaptureSettingsData.bPeople;
} }
int ULuckyRobotsGameInstance::GetCurrentPeopleNumber()
int32 ULuckyRobotsGameInstance::GetCurrentPeopleNumber() const
{ {
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfPeople.ToString())); return FCString::Atoi(*CurrentCaptureSettingsData.NumberOfPeople.ToString());
} }
bool ULuckyRobotsGameInstance::GetCurrentIsRandomObjects()
bool ULuckyRobotsGameInstance::GetCurrentIsRandomObjects() const
{ {
return CurrentCaptureSettingsData.bObjects; return CurrentCaptureSettingsData.bObjects;
} }
int ULuckyRobotsGameInstance::GetCurrentObjectsNumber()
int32 ULuckyRobotsGameInstance::GetCurrentObjectsNumber() const
{ {
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfObjects.ToString())); return FCString::Atoi(*CurrentCaptureSettingsData.NumberOfObjects.ToString());
} }
TArray<TSoftObjectPtr<UStaticMeshComponent>> ULuckyRobotsGameInstance::GetCurrentRandomMeshes()
TArray<TSoftObjectPtr<UStaticMesh>> ULuckyRobotsGameInstance::GetCurrentRandomMeshes() const
{ {
return CurrentCaptureSettingsData.RandomMeshes; return CurrentCaptureSettingsData.RandomMeshes;
} }
bool ULuckyRobotsGameInstance::GetCurrentIsInfiniteCapture()
bool ULuckyRobotsGameInstance::GetCurrentIsInfiniteCapture() const
{ {
return CurrentCaptureSettingsData.bInfiniteCapture; return CurrentCaptureSettingsData.bInfiniteCapture;
} }
int ULuckyRobotsGameInstance::GetCurrentCaptureNumber()
int32 ULuckyRobotsGameInstance::GetCurrentCaptureNumber() const
{ {
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfCaptures.ToString())); return FCString::Atoi(*CurrentCaptureSettingsData.NumberOfCaptures.ToString());
} }

View File

@ -0,0 +1,125 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
#include "Core/LuckyRobotsGameInstance.h"
#include "GameFramework/GameUserSettings.h"
#include "Kismet/GameplayStatics.h"
#include "Settings/SG_CaptureSetting.h"
ULuckyRobotsGameInstance* ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(const UObject* WorldContextObject)
{
if (WorldContextObject && WorldContextObject->GetWorld())
{
return Cast<ULuckyRobotsGameInstance>(WorldContextObject->GetWorld()->GetGameInstance());
}
return nullptr;
}
TArray<FRobotData> ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(const UObject* WorldContextObject)
{
TArray<FRobotData> RobotDataList;
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
{
if (GameInstance->RobotDataDataTable)
{
FString ContextString;
TArray<FName> RowNames = GameInstance->RobotDataDataTable->GetRowNames();
for (const FName& RowName : RowNames)
{
FRobotData* pRow = GameInstance->RobotDataDataTable->FindRow<FRobotData>(RowName, ContextString);
if (pRow && pRow->bActive)
{
RobotDataList.Add(*pRow);
}
}
}
}
return RobotDataList;
}
TArray<FLevelData> ULuckyRobotsFunctionLibrary::GetActiveLevelDataList(const UObject* WorldContextObject)
{
TArray<FLevelData> LevelDataList;
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
{
if (GameInstance->LevelDataTable)
{
FString ContextString;
TArray<FName> RowNames = GameInstance->LevelDataTable->GetRowNames();
for (const FName& RowName : RowNames)
{
FLevelData* pRow = GameInstance->LevelDataTable->FindRow<FLevelData>(RowName, ContextString);
if (pRow && pRow->bActive)
{
LevelDataList.Add(*pRow);
}
}
}
}
return LevelDataList;
}
void ULuckyRobotsFunctionLibrary::UpdateQualitySettings(const UObject* WorldContextObject)
{
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
{
if (UGameUserSettings* GameUserSettings = GEngine->GetGameUserSettings())
{
GameUserSettings->SetOverallScalabilityLevel(static_cast<int32>(GameInstance->CurrentSelectQuality));
GameUserSettings->SaveSettings();
GameUserSettings->ApplySettings(true);
}
}
}
FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings(const UObject* WorldContextObject)
{
FCaptureSettingsData DefaultCaptureSetting;
DefaultCaptureSetting.FolderName = FText::FromString("robotdata");
DefaultCaptureSetting.FileName = FText::FromString("FILE");
DefaultCaptureSetting.WritesPerSec = FText::FromString("1");
DefaultCaptureSetting.NumberOfPeople = FText::FromString("1");
DefaultCaptureSetting.NumberOfObjects = FText::FromString("1");
DefaultCaptureSetting.NumberOfCaptures = FText::FromString("1");
USG_CaptureSetting* SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
if (SaveGame)
{
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
{
GameInstance->CurrentCaptureSettingsData = SaveGame->CaptureSetting;
}
return SaveGame->CaptureSetting;
}
else
{
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::CreateSaveGameObject(USG_CaptureSetting::StaticClass()));
if (SaveGame)
{
SaveGame->CaptureSetting = DefaultCaptureSetting;
UGameplayStatics::SaveGameToSlot(SaveGame, "SGCaptureSettings", 0);
}
}
return DefaultCaptureSetting;
}
void ULuckyRobotsFunctionLibrary::SaveCaptureSettings(const UObject* WorldContextObject, FCaptureSettingsData CaptureSetting)
{
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
{
GameInstance->CurrentCaptureSettingsData = CaptureSetting;
}
USG_CaptureSetting* SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
if (!SaveGame)
{
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::CreateSaveGameObject(USG_CaptureSetting::StaticClass()));
}
if (SaveGame)
{
SaveGame->CaptureSetting = CaptureSetting;
UGameplayStatics::SaveGameToSlot(SaveGame, "SGCaptureSettings", 0);
}
}

View File

@ -1,14 +1,13 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "LuckyRobotsGameMode.h" #include "GameModes/LuckyRobotsGameMode.h"
#include "LuckyRobotsGameInstance.h" #include "Core/LuckyRobotsGameInstance.h"
#include "LuckyRobotsFunctionLibrary.h" #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
void ALuckyRobotsGameMode::BeginPlay() void ALuckyRobotsGameMode::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
ULuckyRobotsFunctionLibrary::UpdateQualitySettings(this); ULuckyRobotsFunctionLibrary::UpdateQualitySettings(this);
} }
@ -17,24 +16,21 @@ UClass* ALuckyRobotsGameMode::GetDefaultPawnClassForController_Implementation(AC
UClass* RobotClass = Super::GetDefaultPawnClassForController_Implementation(InController); UClass* RobotClass = Super::GetDefaultPawnClassForController_Implementation(InController);
ERobotsName CurrentRobot = ERobotsName::None; ERobotsName CurrentRobot = ERobotsName::None;
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()); if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
if (LuckyRobotsGameInstance)
{ {
CurrentRobot = LuckyRobotsGameInstance->CurrentSelectRobot; CurrentRobot = GameInstance->CurrentSelectRobot;
} }
if (CurrentRobot != ERobotsName::None) if (CurrentRobot != ERobotsName::None)
{ {
TArray<FRobotData> ActiveRobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this); TArray<FRobotData> ActiveRobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this);
for (auto ActiveRobotData : ActiveRobotDataList) for (const FRobotData& RobotData : ActiveRobotDataList)
{ {
if (ActiveRobotData.Name == CurrentRobot) if (RobotData.Name == CurrentRobot)
{ {
RobotClass = ActiveRobotData.RobotClass; RobotClass = RobotData.RobotClass;
break; break;
} }
} }
} }
return RobotClass; return RobotClass;
} }

View File

@ -1,10 +1,10 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "LuckyRobotsGameState.h" #include "GameModes/LuckyRobotsGameState.h"
#include "SocketIOClientComponent.h" #include "SocketIOClientComponent.h"
#include "LuckyRobotsFunctionLibrary.h" #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
#include "LuckyRobotsGameInstance.h" #include "Core/LuckyRobotsGameInstance.h"
ALuckyRobotsGameState::ALuckyRobotsGameState() ALuckyRobotsGameState::ALuckyRobotsGameState()
{ {
@ -14,7 +14,6 @@ ALuckyRobotsGameState::ALuckyRobotsGameState()
void ALuckyRobotsGameState::BeginPlay() void ALuckyRobotsGameState::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
if (SocketIOClientComponent) if (SocketIOClientComponent)
{ {
SocketIOClientComponent->Connect(L"http://localhost:3000/"); SocketIOClientComponent->Connect(L"http://localhost:3000/");
@ -23,33 +22,25 @@ void ALuckyRobotsGameState::BeginPlay()
void ALuckyRobotsGameState::DoSendMessage(FString SendValue) void ALuckyRobotsGameState::DoSendMessage(FString SendValue)
{ {
if (SocketIOClientComponent) if (SocketIOClientComponent && SocketIOClientComponent->bIsConnected)
{ {
if (SocketIOClientComponent->bIsConnected) USIOJsonValue* SIOJsonValue = USIOJsonValue::ConstructJsonValueString(this, SendValue);
{ SocketIOClientComponent->Emit(TEXT("message"), SIOJsonValue);
USIOJsonValue* SIOJsonValue = USIOJsonValue::ConstructJsonValueString(this, SendValue);
SocketIOClientComponent->Emit("message", SIOJsonValue);
}
} }
} }
void ALuckyRobotsGameState::DoSocketOnConnect(FString SocketId, FString SessionId, bool IsReconnection) void ALuckyRobotsGameState::DoSocketOnConnect(FString SocketId, FString SessionId, bool IsReconnection)
{ {
if (SocketIOClientComponent) if (SocketIOClientComponent && SocketIOClientComponent->bIsConnected)
{ {
if (SocketIOClientComponent->bIsConnected) SocketIOClientComponent->BindEventToGenericEvent(TEXT("response"));
{
SocketIOClientComponent->BindEventToGenericEvent("response");
}
} }
} }
void ALuckyRobotsGameState::DoSocketOnGenericEvent(FString EventName, USIOJsonValue* EventData) void ALuckyRobotsGameState::DoSocketOnGenericEvent(FString EventName, USIOJsonValue* EventData)
{ {
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this); if (ULuckyRobotsGameInstance* GameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this))
if (LuckyRobotsGameInstance)
{ {
LuckyRobotsGameInstance->DoGetDispatch(EventName, EventData); GameInstance->DoGetDispatch(EventName, EventData);
} }
} }

View File

@ -1,17 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "GameUserWidget.h"
#include "LuckyRobotsFunctionLibrary.h"
#include "LuckyRobotsGameInstance.h"
void UGameUserWidget::NativeConstruct()
{
Super::NativeConstruct();
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this);
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->GameUserWidget = this;
}
}

View File

@ -1,8 +1,8 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "LobbyGameMode.h" #include "Lobby/LobbyGameMode.h"
#include "LuckyRobotsFunctionLibrary.h" #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
void ALobbyGameMode::BeginPlay() void ALobbyGameMode::BeginPlay()
{ {

View File

@ -1,7 +1,7 @@
// Fill out your copyright notice in the Description page of Project Settings. // Fill out your copyright notice in the Description page of Project Settings.
#include "LobbyPlayerController.h" #include "Lobby/LobbyPlayerController.h"
void ALobbyPlayerController::BeginPlay() void ALobbyPlayerController::BeginPlay()
{ {

View File

@ -1,137 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "LuckyRobotsFunctionLibrary.h"
#include "LuckyRobotsGameInstance.h"
#include "GameFramework/GameUserSettings.h"
#include "Kismet/GameplayStatics.h"
#include "SG_CaptureSetting.h"
ULuckyRobotsGameInstance* ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(const UObject* WorldContextObject)
{
return Cast<ULuckyRobotsGameInstance>(WorldContextObject->GetWorld()->GetGameInstance());
}
TArray<FRobotData> ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(const UObject* WorldContextObject)
{
TArray<FRobotData> RobotDataList;
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
if (LuckyRobotsGameInstance)
{
if (LuckyRobotsGameInstance->RobotDataDataTable)
{
FString ContextString;
TArray<FName> RowNames = LuckyRobotsGameInstance->RobotDataDataTable->GetRowNames();
for (auto RowString : RowNames)
{
FRobotData* pRow = LuckyRobotsGameInstance->RobotDataDataTable->FindRow<FRobotData>(FName(RowString), ContextString);
if (pRow)
{
if (pRow->bActive)
{
RobotDataList.Add(*pRow);
}
}
}
}
}
return RobotDataList;
}
TArray<FLevelData> ULuckyRobotsFunctionLibrary::GetActiveLevelDataList(const UObject* WorldContextObject)
{
TArray<FLevelData> LevelDataList;
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
if (LuckyRobotsGameInstance)
{
if (LuckyRobotsGameInstance->LevelDataTable)
{
FString ContextString;
TArray<FName> RowNames = LuckyRobotsGameInstance->LevelDataTable->GetRowNames();
for (auto RowString : RowNames)
{
FLevelData* pRow = LuckyRobotsGameInstance->LevelDataTable->FindRow<FLevelData>(FName(RowString), ContextString);
if (pRow)
{
if (pRow->bActive)
{
LevelDataList.Add(*pRow);
}
}
}
}
}
return LevelDataList;
}
void ULuckyRobotsFunctionLibrary::UpdateQualitySettings(const UObject* WorldContextObject)
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
if (LuckyRobotsGameInstance)
{
// Load game user settings and apply
UGameUserSettings* GameUserSettings = GEngine->GetGameUserSettings();
if (GameUserSettings)
{
GameUserSettings->SetOverallScalabilityLevel(int(LuckyRobotsGameInstance->CurrentSelectQuality));
GameUserSettings->SaveSettings();
GameUserSettings->ApplySettings(true);
}
}
}
FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings(const UObject* WorldContextObject)
{
FCaptureSettingsData DefaultCaptureSetting;
DefaultCaptureSetting.FolderName = FText::FromString("robotdata");
DefaultCaptureSetting.FileName = FText::FromString("FILE");
DefaultCaptureSetting.WritesPerSec = FText::FromString("1");
DefaultCaptureSetting.NumberOfPeople = FText::FromString("1");
DefaultCaptureSetting.NumberOfObjects = FText::FromString("1");
DefaultCaptureSetting.NumberOfCaptures = FText::FromString("1");
USG_CaptureSetting* SaveGame = nullptr;
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
if (SaveGame)
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->CurrentCaptureSettingsData = SaveGame->CaptureSetting;
}
return SaveGame->CaptureSetting;
}
else
{
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::CreateSaveGameObject(USG_CaptureSetting::StaticClass()));
if (SaveGame)
{
SaveGame->CaptureSetting = DefaultCaptureSetting;
UGameplayStatics::SaveGameToSlot(SaveGame, "SGCaptureSettings", 0);
}
}
return DefaultCaptureSetting;
}
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)
{
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::CreateSaveGameObject(USG_CaptureSetting::StaticClass()));
}
if (SaveGame)
{
SaveGame->CaptureSetting = CaptureSetting;
UGameplayStatics::SaveGameToSlot(SaveGame, "SGCaptureSettings", 0);
}
}

View File

@ -1,149 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MainScreenUserWidget.h"
#include "Engine/DataTable.h"
#include "LuckyRobotsGameInstance.h"
#include "LuckyRobotsFunctionLibrary.h"
void UMainScreenUserWidget::NativeConstruct()
{
Super::NativeConstruct();
InitData();
}
void UMainScreenUserWidget::InitData()
{
InitRobotData();
InitLevelData();
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
if (LuckyRobotsGameInstance)
{
iCurrentSelectQuality = int(LuckyRobotsGameInstance->CurrentSelectQuality);
}
}
void UMainScreenUserWidget::InitRobotData()
{
RobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this);
iCurrentSelectRobot = 0;
UpdateSelectRobot();
}
void UMainScreenUserWidget::InitLevelData()
{
LevelDataList = ULuckyRobotsFunctionLibrary::GetActiveLevelDataList(this);
FRobotData CurrentRobotData = GetCurrentRobotData();
if (CurrentRobotData.Name != ERobotsName::None)
{
TArray<FLevelData> ActiveLevelDataList = LevelDataList;
LevelDataList.Empty();
for (auto ActiveLevelData : ActiveLevelDataList)
{
if (ActiveLevelData.RobotTypeList.Find(CurrentRobotData.RobotType) >= 0)
{
LevelDataList.Add(ActiveLevelData);
}
}
}
iCurrentSelectLevel = 0;
UpdateSelectLevel();
}
FRobotData UMainScreenUserWidget::GetCurrentRobotData()
{
FRobotData CurrentRobotData;
if (RobotDataList.IsValidIndex(iCurrentSelectRobot))
{
CurrentRobotData = RobotDataList[iCurrentSelectRobot];
}
return CurrentRobotData;
}
FLevelData UMainScreenUserWidget::GetCurrentLevelData()
{
FLevelData CurrentLevelData;
if (LevelDataList.IsValidIndex(iCurrentSelectLevel))
{
CurrentLevelData = LevelDataList[iCurrentSelectLevel];
}
return CurrentLevelData;
}
void UMainScreenUserWidget::SelectNextRobot()
{
iCurrentSelectRobot = FMath::Clamp(iCurrentSelectRobot + 1, 0, RobotDataList.Num() - 1);
UpdateSelectRobot();
}
void UMainScreenUserWidget::SelectPreviousRobot()
{
iCurrentSelectRobot = FMath::Clamp(iCurrentSelectRobot - 1, 0, RobotDataList.Num() - 1);
UpdateSelectRobot();
}
void UMainScreenUserWidget::SelectNextLevel()
{
iCurrentSelectLevel = FMath::Clamp(iCurrentSelectLevel + 1, 0, LevelDataList.Num() - 1);
UpdateSelectLevel();
}
void UMainScreenUserWidget::SelectPreviousLevel()
{
iCurrentSelectLevel = FMath::Clamp(iCurrentSelectLevel - 1, 0, LevelDataList.Num() - 1);
UpdateSelectLevel();
}
void UMainScreenUserWidget::SelectNextQuality()
{
UEnum* QualityEnum = StaticEnum<EQualityEnum>();
int QualityEnumNum = QualityEnum->NumEnums() - 1;
iCurrentSelectQuality = FMath::Clamp(iCurrentSelectQuality - 1, 0, QualityEnumNum - 1);
UpdateSelectQuality();
}
void UMainScreenUserWidget::SelectPreviousQuality()
{
UEnum* QualityEnum = StaticEnum<EQualityEnum>();
int QualityEnumNum = QualityEnum->NumEnums() - 1;
iCurrentSelectQuality = FMath::Clamp(iCurrentSelectQuality + 1, 0, QualityEnumNum - 1);
UpdateSelectQuality();
}
void UMainScreenUserWidget::UpdateSelectRobot()
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->CurrentSelectRobot = GetCurrentRobotData().Name;
}
BPUpdateSelectRobot();
InitLevelData();
}
void UMainScreenUserWidget::UpdateSelectLevel()
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->CurrentSelectLevel = GetCurrentLevelData().LevelEnum;
}
BPUpdateSelectLevel();
}
void UMainScreenUserWidget::UpdateSelectQuality()
{
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
if (LuckyRobotsGameInstance)
{
LuckyRobotsGameInstance->CurrentSelectQuality = static_cast<EQualityEnum>(iCurrentSelectQuality);
}
BPUpdateSelectQuality();
}

View File

@ -0,0 +1,137 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Menus/MainScreenUserWidget.h"
#include "Engine/DataTable.h"
#include "Core/LuckyRobotsGameInstance.h"
#include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
void UMainScreenUserWidget::NativeConstruct()
{
Super::NativeConstruct();
InitData();
}
void UMainScreenUserWidget::InitData()
{
InitRobotData();
InitLevelData();
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
{
CurrentQualityIndex = static_cast<int32>(GameInstance->CurrentSelectQuality);
}
}
void UMainScreenUserWidget::InitRobotData()
{
RobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this);
CurrentRobotIndex = 0;
UpdateSelectRobot();
}
void UMainScreenUserWidget::InitLevelData()
{
LevelDataList = ULuckyRobotsFunctionLibrary::GetActiveLevelDataList(this);
FRobotData CurrentRobotData = GetCurrentRobotData();
if (CurrentRobotData.Name != ERobotsName::None)
{
TArray<FLevelData> FilteredLevels;
for (const FLevelData& LevelData : LevelDataList)
{
if (LevelData.RobotTypeList.Contains(CurrentRobotData.RobotType))
{
FilteredLevels.Add(LevelData);
}
}
LevelDataList = FilteredLevels;
}
CurrentLevelIndex = 0;
UpdateSelectLevel();
}
FRobotData UMainScreenUserWidget::GetCurrentRobotData() const
{
if (RobotDataList.IsValidIndex(CurrentRobotIndex))
{
return RobotDataList[CurrentRobotIndex];
}
return FRobotData();
}
FLevelData UMainScreenUserWidget::GetCurrentLevelData() const
{
if (LevelDataList.IsValidIndex(CurrentLevelIndex))
{
return LevelDataList[CurrentLevelIndex];
}
return FLevelData();
}
void UMainScreenUserWidget::SelectNextRobot()
{
CurrentRobotIndex = FMath::Clamp(CurrentRobotIndex + 1, 0, RobotDataList.Num() - 1);
UpdateSelectRobot();
}
void UMainScreenUserWidget::SelectPreviousRobot()
{
CurrentRobotIndex = FMath::Clamp(CurrentRobotIndex - 1, 0, RobotDataList.Num() - 1);
UpdateSelectRobot();
}
void UMainScreenUserWidget::SelectNextLevel()
{
CurrentLevelIndex = FMath::Clamp(CurrentLevelIndex + 1, 0, LevelDataList.Num() - 1);
UpdateSelectLevel();
}
void UMainScreenUserWidget::SelectPreviousLevel()
{
CurrentLevelIndex = FMath::Clamp(CurrentLevelIndex - 1, 0, LevelDataList.Num() - 1);
UpdateSelectLevel();
}
void UMainScreenUserWidget::SelectNextQuality()
{
UEnum* QualityEnum = StaticEnum<EQualityEnum>();
int32 EnumCount = QualityEnum->NumEnums() - 1;
CurrentQualityIndex = FMath::Clamp(CurrentQualityIndex - 1, 0, EnumCount - 1);
UpdateSelectQuality();
}
void UMainScreenUserWidget::SelectPreviousQuality()
{
UEnum* QualityEnum = StaticEnum<EQualityEnum>();
int32 EnumCount = QualityEnum->NumEnums() - 1;
CurrentQualityIndex = FMath::Clamp(CurrentQualityIndex + 1, 0, EnumCount - 1);
UpdateSelectQuality();
}
void UMainScreenUserWidget::UpdateSelectRobot()
{
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
{
GameInstance->CurrentSelectRobot = GetCurrentRobotData().Name;
}
BPUpdateSelectRobot();
InitLevelData();
}
void UMainScreenUserWidget::UpdateSelectLevel()
{
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
{
GameInstance->CurrentSelectLevel = GetCurrentLevelData().LevelEnum;
}
BPUpdateSelectLevel();
}
void UMainScreenUserWidget::UpdateSelectQuality()
{
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
{
GameInstance->CurrentSelectQuality = static_cast<EQualityEnum>(CurrentQualityIndex);
}
BPUpdateSelectQuality();
}

View File

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

View File

@ -0,0 +1,14 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UI/GameUserWidget.h"
#include "Core/LuckyRobotsGameInstance.h"
void UGameUserWidget::NativeConstruct()
{
Super::NativeConstruct();
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
{
GameInstance->GameUserWidget = this;
}
}

View File

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

View File

@ -24,9 +24,23 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* LevelDataTable; UDataTable* LevelDataTable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* FurnitureDataTable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* DecorationDataTable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* KitchenwareDataTable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* ElectronicsDataTable;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Config")
UDataTable* BathroomDataTable;
public: public:
bool bIsFirstOpenGame; bool bIsFirstOpenGame;
bool bIsDebug; bool bIsDebug;
bool bIsWidgetTestMode; bool bIsWidgetTestMode;
bool bIsShowPath; bool bIsShowPath;
@ -48,10 +62,10 @@ public:
bool bIsMouseOpen; bool bIsMouseOpen;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
bool bIschange; bool bIsChanged;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
int FolderCount; int32 FolderCount;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
FTransform TargetPosition; FTransform TargetPosition;
@ -90,10 +104,10 @@ public:
public: public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void DoSendMessage(FString SendValue); void DoSendMessage(const FString& SendValue);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void DoLogItemAdd(FString Topic, FString MsgText, ELogItemType LogItemType); void DoLogItemAdd(const FString& Topic, const FString& MsgText, ELogItemType LogItemType);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SwitchGamePaused(); void SwitchGamePaused();
@ -103,41 +117,41 @@ public:
void ClearTaskList(); void ClearTaskList();
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void AddTask(FGoalsTaskData TaskData); void AddTask(const FGoalsTaskData& TaskData);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void RemoveTask(FGoalsTaskData TaskData); void RemoveTask(const FGoalsTaskData& TaskData);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void RemoveTaskByGoalType(EGoalType GoalType); void RemoveTaskByGoalType(EGoalType GoalType);
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
int GetTaskNum(); int32 GetTaskNum() const;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetTask(int Index, FGoalsTaskData TaskData); void SetTask(int32 Index, const FGoalsTaskData& TaskData);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
bool GetTask(int Index, FGoalsTaskData& TaskData); bool GetTask(int32 Index, FGoalsTaskData& OutTaskData) const;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void ReSetTaskList(); void ReSetTaskList();
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
TArray<FGoalsTaskData> GetTaskList(); TArray<FGoalsTaskData> GetTaskList() const;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void DoSetTempTaskValueChange(bool IsClear); void DoSetTempTaskValueChange(bool bIsClear);
public: public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentFolderName(FString FolderName); void SetCurrentFolderName(const FString& FolderName);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentFileName(FString FileName); void SetCurrentFileName(const FString& FileName);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentWritesPerSec(int WritesPerSec); void SetCurrentWritesPerSec(int32 WritesPerSec);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentIsScenario(bool IsScenario); void SetCurrentIsScenario(bool IsScenario);
@ -155,77 +169,77 @@ public:
void SetCurrentIsRandomPets(bool bPets); void SetCurrentIsRandomPets(bool bPets);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentPetsNumber(int PetsNumber); void SetCurrentPetsNumber(int32 PetsNumber);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomPeople(bool bPeople); void SetCurrentIsRandomPeople(bool bPeople);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentPeopleNumber(int PeopleNumber); void SetCurrentPeopleNumber(int32 PeopleNumber);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentIsRandomObjects(bool bObjects); void SetCurrentIsRandomObjects(bool bObjects);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentObjectsNumber(int ObjectsNumber); void SetCurrentObjectsNumber(int32 ObjectsNumber);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentRandomMeshes(TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes); void SetCurrentRandomMeshes(const TArray<TSoftObjectPtr<UStaticMesh>>& RandomMeshes);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentIsInfiniteCapture(bool bInfiniteCapture); void SetCurrentIsInfiniteCapture(bool bInfiniteCapture);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetCurrentCaptureNumber(int CaptureNumber); void SetCurrentCaptureNumber(int32 CaptureNumber);
public: public:
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
FString GetCurrentFolderName(); FString GetCurrentFolderName() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
FString GetCurrentFileName(); FString GetCurrentFileName() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
int GetCurrentWritesPerSec(); int32 GetCurrentWritesPerSec() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsScenario(); bool GetCurrentIsScenario() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomLight(); bool GetCurrentIsRandomLight() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomMaterials(); bool GetCurrentIsRandomMaterials() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomRobotPosition(); bool GetCurrentIsRandomRobotPosition() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomPets(); bool GetCurrentIsRandomPets() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
int GetCurrentPetsNumber(); int32 GetCurrentPetsNumber() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomPeople(); bool GetCurrentIsRandomPeople() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
int GetCurrentPeopleNumber(); int32 GetCurrentPeopleNumber() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsRandomObjects(); bool GetCurrentIsRandomObjects() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
int GetCurrentObjectsNumber(); int32 GetCurrentObjectsNumber() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
TArray<TSoftObjectPtr<UStaticMeshComponent>> GetCurrentRandomMeshes(); TArray<TSoftObjectPtr<UStaticMesh>> GetCurrentRandomMeshes() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
bool GetCurrentIsInfiniteCapture(); bool GetCurrentIsInfiniteCapture() const;
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
int GetCurrentCaptureNumber(); int32 GetCurrentCaptureNumber() const;
public: public:
UFUNCTION(BlueprintImplementableEvent) UFUNCTION(BlueprintImplementableEvent)

View File

@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
@ -7,16 +5,12 @@
#include "SharedDef.h" #include "SharedDef.h"
#include "MainScreenUserWidget.generated.h" #include "MainScreenUserWidget.generated.h"
class UDataTable;
/**
*
*/
UCLASS() UCLASS()
class LUCKYROBOTS_API UMainScreenUserWidget : public UUserWidget class LUCKYROBOTS_API UMainScreenUserWidget : public UUserWidget
{ {
GENERATED_BODY() GENERATED_BODY()
protected: protected:
virtual void NativeConstruct(); virtual void NativeConstruct() override;
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
@ -26,24 +20,29 @@ public:
TArray<FLevelData> LevelDataList; TArray<FLevelData> LevelDataList;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int iCurrentSelectRobot; int32 CurrentRobotIndex;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int iCurrentSelectLevel;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int iCurrentSelectQuality; int32 CurrentLevelIndex;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 CurrentQualityIndex;
public: public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InitData(); void InitData();
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InitRobotData(); void InitRobotData();
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InitLevelData(); void InitLevelData();
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
FRobotData GetCurrentRobotData(); FRobotData GetCurrentRobotData() const;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
FLevelData GetCurrentLevelData(); FLevelData GetCurrentLevelData() const;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SelectNextRobot(); void SelectNextRobot();

View File

@ -2,124 +2,225 @@
#include "SharedDef.generated.h" #include "SharedDef.generated.h"
UENUM(BlueprintType) UENUM(BlueprintType)
enum class ERobotsCategories : uint8 enum class ERobotsCategories : uint8
{ {
Wheeled UMETA(DisplayName = "Wheeled Robots"), Wheeled UMETA(DisplayName = "Wheeled Robots"),
FourLegged UMETA(DisplayName = "Four-Legged Robots"), FourLegged UMETA(DisplayName = "Four-Legged Robots"),
TwoLegged UMETA(DisplayName = "Two-Legged Robots"), TwoLegged UMETA(DisplayName = "Two-Legged Robots"),
Stationary UMETA(DisplayName = "Stationary Robots"), Stationary UMETA(DisplayName = "Stationary Robots"),
IndoorFlying UMETA(DisplayName = "Indoor Flying Robots"), IndoorFlying UMETA(DisplayName = "Indoor Flying Robots"),
SwimmingUnderwater UMETA(DisplayName = "Swimming/Underwater Robots"), SwimmingUnderwater UMETA(DisplayName = "Swimming/Underwater Robots"),
CrawlingModular UMETA(DisplayName = "Crawling/Modular Robots"), CrawlingModular UMETA(DisplayName = "Crawling/Modular Robots"),
Arm UMETA(DisplayName = "Arm-Robots"), Arm UMETA(DisplayName = "Arm-Robots"),
OutdoorFlying UMETA(DisplayName = "Outdoor Flying Robots") OutdoorFlying UMETA(DisplayName = "Outdoor Flying Robots")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class ERobotsName : uint8 enum class ERobotsName : uint8
{ {
None UMETA(DisplayName = "None"), None UMETA(DisplayName = "None"),
Luck_e UMETA(DisplayName = "Luck-e"), Luck_e UMETA(DisplayName = "Luck-e"),
Stretch UMETA(DisplayName = "Stretch"), Stretch UMETA(DisplayName = "Stretch"),
LuckyDrone UMETA(DisplayName = "Lucky Drone"), LuckyDrone UMETA(DisplayName = "Lucky Drone"),
DJIDrone UMETA(DisplayName = "DJI Drone"), DJIDrone UMETA(DisplayName = "DJI Drone"),
ArmLucky UMETA(DisplayName = "Arm Lucky"), ArmLucky UMETA(DisplayName = "Arm Lucky"),
UnitreeG1 UMETA(DisplayName = "Unitree G1"), UnitreeG1 UMETA(DisplayName = "Unitree G1"),
StretchRobotV1 UMETA(DisplayName = "Stretch Robot V1"), StretchRobotV1 UMETA(DisplayName = "Stretch Robot V1"),
PandaArmRobot UMETA(DisplayName = "Panda Arm Robot"), PandaArmRobot UMETA(DisplayName = "Panda Arm Robot"),
PuralinkRobot UMETA(DisplayName = "Puralink Robot"), PuralinkRobot UMETA(DisplayName = "Puralink Robot"),
UnitreeGo2 UMETA(DisplayName = "Unitree Go 2"), UnitreeGo2 UMETA(DisplayName = "Unitree Go 2"),
RevoluteRobot UMETA(DisplayName = "Revolute Robot"), RevoluteRobot UMETA(DisplayName = "Revolute Robot"),
BostonSpotRobot UMETA(DisplayName = "Boston Spot Robot") BostonSpotRobot UMETA(DisplayName = "Boston Spot Robot")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class ELevelType : uint8 enum class ELevelType : uint8
{ {
Home UMETA(DisplayName = "Home"), Home UMETA(DisplayName = "Home"),
Office UMETA(DisplayName = "Office"), Office UMETA(DisplayName = "Office"),
Street UMETA(DisplayName = "Street"), Street UMETA(DisplayName = "Street"),
TestLevel UMETA(DisplayName = "TestLevel") TestLevel UMETA(DisplayName = "TestLevel")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class ELevelEnum : uint8 enum class ELevelEnum : uint8
{ {
None UMETA(DisplayName = "None"), None UMETA(DisplayName = "None"),
TestLevel UMETA(DisplayName = "Test Level"), TestLevel UMETA(DisplayName = "Test Level"),
Loft UMETA(DisplayName = "Loft"), Loft UMETA(DisplayName = "Loft"),
Rome UMETA(DisplayName = "Rome"), Rome UMETA(DisplayName = "Rome"),
Paris UMETA(DisplayName = "Paris"), Paris UMETA(DisplayName = "Paris"),
Marseille UMETA(DisplayName = "Marseille"), Marseille UMETA(DisplayName = "Marseille"),
Istanbul UMETA(DisplayName = "Istanbul"), Istanbul UMETA(DisplayName = "Istanbul"),
Office UMETA(DisplayName = "Office"), Office UMETA(DisplayName = "Office"),
BasicForest UMETA(DisplayName = "Basic Forest"), BasicForest UMETA(DisplayName = "Basic Forest"),
NaturalForest UMETA(DisplayName = "Natural Forest"), NaturalForest UMETA(DisplayName = "Natural Forest"),
KitchenForArmRobot UMETA(DisplayName = "Kitchen for Arm Robot"), KitchenForArmRobot UMETA(DisplayName = "Kitchen for Arm Robot"),
PipeFabric UMETA(DisplayName = "Pipe Fabric") PipeFabric UMETA(DisplayName = "Pipe Fabric")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EQualityEnum : uint8 enum class EQualityEnum : uint8
{ {
Low UMETA(DisplayName = "Low"), Low UMETA(DisplayName = "Low"),
Middle UMETA(DisplayName = "Middle"), Middle UMETA(DisplayName = "Middle"),
High UMETA(DisplayName = "High"), High UMETA(DisplayName = "High"),
Epic UMETA(DisplayName = "Epic") Epic UMETA(DisplayName = "Epic")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EGoalType : uint8 enum class EGoalType : uint8
{ {
GrabAndPull UMETA(DisplayName = "Grab and Pull"), GrabAndPull UMETA(DisplayName = "Grab and Pull"),
GrabAndRotate UMETA(DisplayName = "Grab and Rotate"), GrabAndRotate UMETA(DisplayName = "Grab and Rotate"),
GrabAndOpen UMETA(DisplayName = "Grab and Open"), GrabAndOpen UMETA(DisplayName = "Grab and Open"),
PickAndPlace UMETA(DisplayName = "Pick and Place"), PickAndPlace UMETA(DisplayName = "Pick and Place"),
Pick UMETA(DisplayName = "Pick"), Pick UMETA(DisplayName = "Pick"),
GrabAndInsert UMETA(DisplayName = "Grab and Insert"), GrabAndInsert UMETA(DisplayName = "Grab and Insert"),
Find UMETA(DisplayName = "Find"), Find UMETA(DisplayName = "Find"),
Point UMETA(DisplayName = "Point"), Point UMETA(DisplayName = "Point"),
PointWithLaserPointer UMETA(DisplayName = "Point with Laser Pointer"), PointWithLaserPointer UMETA(DisplayName = "Point with Laser Pointer"),
RotateHand UMETA(DisplayName = "Rotate Hand"), RotateHand UMETA(DisplayName = "Rotate Hand"),
SliceDice UMETA(DisplayName = "Slice/Dice"), SliceDice UMETA(DisplayName = "Slice/Dice"),
Wipe UMETA(DisplayName = "Wipe"), Wipe UMETA(DisplayName = "Wipe"),
FoldUnfold UMETA(DisplayName = "Fold/Unfold"), FoldUnfold UMETA(DisplayName = "Fold/Unfold"),
ArrangeOrganize UMETA(DisplayName = "Arrange/Organize"), ArrangeOrganize UMETA(DisplayName = "Arrange/Organize"),
PressButton UMETA(DisplayName = "Press Button"), PressButton UMETA(DisplayName = "Press Button"),
PourDispense UMETA(DisplayName = "Pour/Dispense"), PourDispense UMETA(DisplayName = "Pour/Dispense"),
NavigateSimpleEnvironments UMETA(DisplayName = "Navigate Simple Environments"), NavigateSimpleEnvironments UMETA(DisplayName = "Navigate Simple Environments"),
NavigateComplexTerrain UMETA(DisplayName = "Navigate Complex Terrain"), NavigateComplexTerrain UMETA(DisplayName = "Navigate Complex Terrain"),
ClimbStairsOrRamps UMETA(DisplayName = "Climb Stairs or Ramps"), ClimbStairsOrRamps UMETA(DisplayName = "Climb Stairs or Ramps"),
BalanceStabilize UMETA(DisplayName = "Balance/Stabilize"), BalanceStabilize UMETA(DisplayName = "Balance/Stabilize"),
DockingAndCharging UMETA(DisplayName = "Docking and Charging"), DockingAndCharging UMETA(DisplayName = "Docking and Charging"),
ChangeGripper UMETA(DisplayName = "Change Gripper"), ChangeGripper UMETA(DisplayName = "Change Gripper"),
Place UMETA(DisplayName = "Place") Place UMETA(DisplayName = "Place")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class ESaveDataType : uint8 enum class ESaveDataType : uint8
{ {
file UMETA(DisplayName = "file"), file UMETA(DisplayName = "file"),
webserver UMETA(DisplayName = "webserver"), webserver UMETA(DisplayName = "webserver"),
http UMETA(DisplayName = "http"), http UMETA(DisplayName = "http"),
debug UMETA(DisplayName = "debug"), debug UMETA(DisplayName = "debug"),
none UMETA(DisplayName = "none") none UMETA(DisplayName = "none")
}; };
UENUM(BlueprintType) UENUM(BlueprintType)
enum class ELogItemType : uint8 enum class ELogItemType : uint8
{ {
Debug UMETA(DisplayName = "Debug"), Debug UMETA(DisplayName = "Debug"),
War UMETA(DisplayName = "War"), War UMETA(DisplayName = "War"),
Error UMETA(DisplayName = "Error"), Error UMETA(DisplayName = "Error"),
Consol UMETA(DisplayName = "Consol") Consol UMETA(DisplayName = "Consol")
}; };
UENUM(BlueprintType)
enum class EFurniture : uint8
{
None UMETA(DisplayName = "None"),
Sofas UMETA(DisplayName = "Sofas"),
Chairs UMETA(DisplayName = "Chairs"),
Tables UMETA(DisplayName = "Tables"),
Beds UMETA(DisplayName = "Beds"),
Cabinets UMETA(DisplayName = "Cabinets"),
Shelves UMETA(DisplayName = "Shelves"),
Desks UMETA(DisplayName = "Desks"),
Doors UMETA(DisplayName = "Doors"),
Drawers UMETA(DisplayName = "Drawers")
};
UENUM(BlueprintType)
enum class EDecoration : uint8
{
None UMETA(DisplayName = "None"),
Carpets UMETA(DisplayName = "Carpets"),
Paintings UMETA(DisplayName = "Paintings"),
Vases UMETA(DisplayName = "Vases"),
Lamps UMETA(DisplayName = "Lamps"),
Mirrors UMETA(DisplayName = "Mirrors"),
Curtains UMETA(DisplayName = "Curtains"),
Plants UMETA(DisplayName = "Plants"),
Textiles UMETA(DisplayName = "Textiles"),
Lighting UMETA(DisplayName = "Lighting"),
Outdoor UMETA(DisplayName = "Outdoor"),
OfficeSupplies UMETA(DisplayName = "Office Supplies"),
Books UMETA(DisplayName = "Books"),
ToolsAndEquipment UMETA(DisplayName = "Tools And Equipment"),
Dressing UMETA(DisplayName = "Dressing"),
BasketsAndBoxes UMETA(DisplayName = "Baskets And Boxes")
};
UENUM(BlueprintType)
enum class EKitchenware : uint8
{
None UMETA(DisplayName = "None"),
Plates UMETA(DisplayName = "Plates"),
Glasses UMETA(DisplayName = "Glasses"),
Cutlery UMETA(DisplayName = "Cutlery"),
Pots UMETA(DisplayName = "Pots"),
SmallAppliances UMETA(DisplayName = "Small Appliances"),
Cups UMETA(DisplayName = "Cups"),
Bottles UMETA(DisplayName = "Bottles")
};
UENUM(BlueprintType)
enum class EElectronics : uint8
{
None UMETA(DisplayName = "None"),
Television UMETA(DisplayName = "Television"),
LargeAppliances UMETA(DisplayName = "Large Appliances"),
Oven UMETA(DisplayName = "Oven"),
Computer UMETA(DisplayName = "Computer"),
KitchenGadgets UMETA(DisplayName = "Kitchen Gadgets"),
MusicGadgets UMETA(DisplayName = "Music Gadgets"),
SmallElectronics UMETA(DisplayName = "Small Electronics")
};
UENUM(BlueprintType)
enum class EBathroom : uint8
{
None UMETA(DisplayName = "None"),
Towels UMETA(DisplayName = "Towels"),
SoapDispenser UMETA(DisplayName = "Soap Dispenser"),
ShowerCurtains UMETA(DisplayName = "Shower Curtains"),
BathMats UMETA(DisplayName = "Bath Mats"),
Toiletries UMETA(DisplayName = "Toiletries")
};
UENUM(BlueprintType)
enum class EItemCategory : uint8
{
Furniture UMETA(DisplayName = "Furniture"),
Decoration UMETA(DisplayName = "Decoration"),
Kitchenware UMETA(DisplayName = "Kitchenware"),
Electronics UMETA(DisplayName = "Electronics"),
Bathroom UMETA(DisplayName = "Bathroom")
};
UENUM(BlueprintType)
enum class EHoldItemType : uint8
{
None UMETA(DisplayName = "None"),
HoldObject UMETA(DisplayName = "Hold Object"),
DontTouch UMETA(DisplayName = "Don't Touch")
};
UENUM(BlueprintType)
enum class EScenarioEnum : uint8
{
None UMETA(DisplayName = "None"),
TidyUp UMETA(DisplayName = "Tidy Up"),
Draw UMETA(DisplayName = "Draw"),
StoveOff UMETA(DisplayName = "Stove Off")
};
USTRUCT(BlueprintType) USTRUCT(BlueprintType)
struct FRobotData : public FTableRowBase struct FRobotData : public FTableRowBase
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
ERobotsName Name; ERobotsName Name;
@ -147,9 +248,10 @@ USTRUCT(BlueprintType)
struct FLevelData : public FTableRowBase struct FLevelData : public FTableRowBase
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int ID; int32 ID;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
ELevelEnum LevelEnum; ELevelEnum LevelEnum;
@ -157,7 +259,6 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
ELevelType LevelType; ELevelType LevelType;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
TSoftObjectPtr<UWorld> LevelObject; TSoftObjectPtr<UWorld> LevelObject;
@ -178,12 +279,12 @@ public:
LevelObject == Other.LevelObject && LevelObject == Other.LevelObject &&
LevelImage == Other.LevelImage && LevelImage == Other.LevelImage &&
bActive == Other.bActive && bActive == Other.bActive &&
RobotTypeList == Other.RobotTypeList; RobotTypeList == Other.RobotTypeList;
} }
FLevelData& operator=(const FLevelData& Other) FLevelData& operator=(const FLevelData& Other)
{ {
if (this != &Other) if (this != &Other)
{ {
ID = Other.ID; ID = Other.ID;
LevelEnum = Other.LevelEnum; LevelEnum = Other.LevelEnum;
@ -201,6 +302,7 @@ USTRUCT(BlueprintType)
struct FGoalsTaskData : public FTableRowBase struct FGoalsTaskData : public FTableRowBase
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
EGoalType GoalType; EGoalType GoalType;
@ -215,13 +317,13 @@ public:
TSoftObjectPtr<UObject> TargetActor; TSoftObjectPtr<UObject> TargetActor;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bIsComplate; bool bIsComplete;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
FVector DropOffLocation; FVector DropOffLocation;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString ObjectName; FString ObjectName;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bActive; bool bActive;
@ -230,9 +332,9 @@ public:
{ {
return GoalType == Other.GoalType && return GoalType == Other.GoalType &&
bIsStart == Other.bIsStart && bIsStart == Other.bIsStart &&
TargetLocation.Equals(Other.TargetLocation, 0.01f) && TargetLocation.Equals(Other.TargetLocation, 0.01f) &&
TargetActor == Other.TargetActor && TargetActor == Other.TargetActor &&
bIsComplate == Other.bIsComplate && bIsComplete == Other.bIsComplete &&
DropOffLocation.Equals(Other.DropOffLocation, 0.01f) && DropOffLocation.Equals(Other.DropOffLocation, 0.01f) &&
ObjectName == Other.ObjectName && ObjectName == Other.ObjectName &&
bActive == Other.bActive; bActive == Other.bActive;
@ -240,13 +342,13 @@ public:
FGoalsTaskData& operator=(const FGoalsTaskData& Other) FGoalsTaskData& operator=(const FGoalsTaskData& Other)
{ {
if (this != &Other) if (this != &Other)
{ {
GoalType = Other.GoalType; GoalType = Other.GoalType;
bIsStart = Other.bIsStart; bIsStart = Other.bIsStart;
TargetLocation = Other.TargetLocation; TargetLocation = Other.TargetLocation;
TargetActor = Other.TargetActor; TargetActor = Other.TargetActor;
bIsComplate = Other.bIsComplate; bIsComplete = Other.bIsComplete;
DropOffLocation = Other.DropOffLocation; DropOffLocation = Other.DropOffLocation;
ObjectName = Other.ObjectName; ObjectName = Other.ObjectName;
bActive = Other.bActive; bActive = Other.bActive;
@ -259,6 +361,7 @@ USTRUCT(BlueprintType)
struct FCaptureSettingsData : public FTableRowBase struct FCaptureSettingsData : public FTableRowBase
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText FolderName = FText::FromString("robotdata"); FText FolderName = FText::FromString("robotdata");
@ -303,10 +406,10 @@ public:
FText NumberOfObjects = FText::FromString("1"); FText NumberOfObjects = FText::FromString("1");
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes; TArray<TSoftObjectPtr<UStaticMesh>> RandomMeshes;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bInfiniteCapture; bool bInfiniteCapture;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
FText NumberOfCaptures = FText::FromString("1"); FText NumberOfCaptures = FText::FromString("1");
@ -317,7 +420,7 @@ public:
FileName.EqualTo(Other.FileName) && FileName.EqualTo(Other.FileName) &&
WritesPerSec.EqualTo(Other.WritesPerSec) && WritesPerSec.EqualTo(Other.WritesPerSec) &&
IsScenario == Other.IsScenario && IsScenario == Other.IsScenario &&
TaskList == Other.TaskList && TaskList == Other.TaskList &&
bLight == Other.bLight && bLight == Other.bLight &&
bMaterials == Other.bMaterials && bMaterials == Other.bMaterials &&
bRobotPosition == Other.bRobotPosition && bRobotPosition == Other.bRobotPosition &&
@ -327,14 +430,14 @@ public:
NumberOfPeople.EqualTo(Other.NumberOfPeople) && NumberOfPeople.EqualTo(Other.NumberOfPeople) &&
bObjects == Other.bObjects && bObjects == Other.bObjects &&
NumberOfObjects.EqualTo(Other.NumberOfObjects) && NumberOfObjects.EqualTo(Other.NumberOfObjects) &&
RandomMeshes == Other.RandomMeshes && RandomMeshes == Other.RandomMeshes &&
bInfiniteCapture == Other.bInfiniteCapture && bInfiniteCapture == Other.bInfiniteCapture &&
NumberOfCaptures.EqualTo(Other.NumberOfCaptures); NumberOfCaptures.EqualTo(Other.NumberOfCaptures);
} }
FCaptureSettingsData& operator=(const FCaptureSettingsData& Other) FCaptureSettingsData& operator=(const FCaptureSettingsData& Other)
{ {
if (this != &Other) if (this != &Other)
{ {
FolderName = Other.FolderName; FolderName = Other.FolderName;
FileName = Other.FileName; FileName = Other.FileName;
@ -362,6 +465,7 @@ USTRUCT(BlueprintType)
struct FAllGoalListData : public FTableRowBase struct FAllGoalListData : public FTableRowBase
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
EGoalType GoalType; EGoalType GoalType;
@ -380,9 +484,10 @@ USTRUCT(BlueprintType)
struct FLuckyCode : public FTableRowBase struct FLuckyCode : public FTableRowBase
{ {
GENERATED_BODY() GENERATED_BODY()
public: public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int ID; int32 ID;
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString Code; FString Code;
@ -393,3 +498,150 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool bCallback; bool bCallback;
}; };
USTRUCT(BlueprintType)
struct FSelectableItemData : public FTableRowBase
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
int32 ID;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
EItemCategory Category;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item", meta = (EditCondition = "Category == EItemCategory::Furniture", EditConditionHides))
EFurniture FurnitureType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item", meta = (EditCondition = "Category == EItemCategory::Decoration", EditConditionHides))
EDecoration DecorationType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item", meta = (EditCondition = "Category == EItemCategory::Kitchenware", EditConditionHides))
EKitchenware KitchenwareType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item", meta = (EditCondition = "Category == EItemCategory::Electronics", EditConditionHides))
EElectronics ElectronicsType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item", meta = (EditCondition = "Category == EItemCategory::Bathroom", EditConditionHides))
EBathroom BathroomType;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FString Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
TSoftObjectPtr<UTexture2D> Icon;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
TSoftObjectPtr<UStaticMesh> Mesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FString Description;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
bool bIsStatic;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FTransform Transform;
FSelectableItemData()
: ID(0)
, Category(EItemCategory::Furniture)
, FurnitureType(EFurniture::None)
, DecorationType(EDecoration::None)
, KitchenwareType(EKitchenware::None)
, ElectronicsType(EElectronics::None)
, BathroomType(EBathroom::None)
, Name(TEXT(""))
, Icon(nullptr)
, Mesh(nullptr)
, Description(TEXT(""))
, bIsStatic(false)
, Transform(FTransform::Identity)
{
}
};
USTRUCT(BlueprintType)
struct FHoldItemStruct : public FTableRowBase
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
int32 ID;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FString Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
TSoftObjectPtr<UTexture2D> Icon;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
TSoftObjectPtr<UStaticMesh> Mesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FString Description;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
EHoldItemType Type;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
EScenarioEnum ScenarioEnum;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item")
FTransform Transform;
FHoldItemStruct()
: ID(0)
, Name(TEXT(""))
, Icon(nullptr)
, Mesh(nullptr)
, Description(TEXT(""))
, Type(EHoldItemType::None)
, ScenarioEnum(EScenarioEnum::None)
, Transform(FTransform::Identity)
{
}
};
USTRUCT(BlueprintType)
struct FStretchRobotActuator
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actuator")
FString Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actuator")
float Min;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actuator")
float Max;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Actuator")
int32 Index;
};
USTRUCT(BlueprintType)
struct FRandomMaterialTexture
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<TSoftObjectPtr<UStaticMesh>> Meshs;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<TSoftObjectPtr<UMaterialInstance>> Materials;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<TSoftObjectPtr<UTexture>> Textures;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool RandomMaterial;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool RandomTexture;
};

View File

@ -16,7 +16,7 @@ class LUCKYROBOTS_API UGameUserWidget : public UUserWidget
GENERATED_BODY() GENERATED_BODY()
protected: protected:
virtual void NativeConstruct(); virtual void NativeConstruct() override;
public: public:
UFUNCTION(BlueprintImplementableEvent) UFUNCTION(BlueprintImplementableEvent)

Some files were not shown because too many files have changed in this diff Show More