You've already forked LuckyWorld
Optimize code to unreal style
This commit is contained in:
@ -5,19 +5,18 @@
|
||||
#include "GameModes/LuckyRobotsGameState.h"
|
||||
#include "Kismet/GameplayStatics.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 (LuckyRobotsGameState)
|
||||
if (ALuckyRobotsGameState* GameState = Cast<ALuckyRobotsGameState>(UGameplayStatics::GetGameState(this)))
|
||||
{
|
||||
LuckyRobotsGameState->DoSendMessage(SendValue);
|
||||
GameState->DoSendMessage(SendValue);
|
||||
}
|
||||
|
||||
DoLogItemAdd("Receive", SendValue, ELogItemType::Debug);
|
||||
DoLogItemAdd(TEXT("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)
|
||||
{
|
||||
@ -27,15 +26,16 @@ void ULuckyRobotsGameInstance::DoLogItemAdd(FString Topic, FString MsgText, ELog
|
||||
|
||||
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
|
||||
{
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(this, "r.SceneRendering 1");
|
||||
UKismetSystemLibrary::ExecuteConsoleCommand(this, TEXT("r.SceneRendering 1"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,18 +44,19 @@ void ULuckyRobotsGameInstance::ClearTaskList()
|
||||
TaskList.Empty();
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::AddTask(FGoalsTaskData TaskData)
|
||||
void ULuckyRobotsGameInstance::AddTask(const FGoalsTaskData& TaskData)
|
||||
{
|
||||
TaskList.Add(TaskData);
|
||||
}
|
||||
void ULuckyRobotsGameInstance::RemoveTask(FGoalsTaskData TaskData)
|
||||
|
||||
void ULuckyRobotsGameInstance::RemoveTask(const FGoalsTaskData& TaskData)
|
||||
{
|
||||
TaskList.Remove(TaskData);
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType)
|
||||
{
|
||||
for (auto Task : TaskList)
|
||||
for (const FGoalsTaskData& Task : TaskList)
|
||||
{
|
||||
if (Task.GoalType == GoalType)
|
||||
{
|
||||
@ -65,12 +66,12 @@ void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType)
|
||||
}
|
||||
}
|
||||
|
||||
int ULuckyRobotsGameInstance::GetTaskNum()
|
||||
int32 ULuckyRobotsGameInstance::GetTaskNum() const
|
||||
{
|
||||
return TaskList.Num();
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::SetTask(int Index, FGoalsTaskData TaskData)
|
||||
void ULuckyRobotsGameInstance::SetTask(int32 Index, const FGoalsTaskData& TaskData)
|
||||
{
|
||||
if (TaskList.IsValidIndex(Index))
|
||||
{
|
||||
@ -78,7 +79,7 @@ void ULuckyRobotsGameInstance::SetTask(int Index, FGoalsTaskData TaskData)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = TaskList.Num(); i < Index; i++)
|
||||
while (TaskList.Num() < Index)
|
||||
{
|
||||
FGoalsTaskData 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))
|
||||
{
|
||||
TaskData = TaskList[Index];
|
||||
OutTaskData = TaskList[Index];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::ReSetTaskList()
|
||||
{
|
||||
TArray<FGoalsTaskData> TempTaskList;
|
||||
for (auto Task : TaskList)
|
||||
for (FGoalsTaskData& Task : TaskList)
|
||||
{
|
||||
Task.bIsStart = false;
|
||||
Task.bIsStart = false;
|
||||
Task.bIsComplete = false;
|
||||
Task.bActive = false;
|
||||
TempTaskList.Add(Task);
|
||||
}
|
||||
|
||||
TaskList = TempTaskList;
|
||||
}
|
||||
|
||||
TArray<FGoalsTaskData> ULuckyRobotsGameInstance::GetTaskList()
|
||||
TArray<FGoalsTaskData> ULuckyRobotsGameInstance::GetTaskList() const
|
||||
{
|
||||
return TaskList;
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool IsClear)
|
||||
void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool bIsClear)
|
||||
{
|
||||
if (IsClear)
|
||||
if (bIsClear)
|
||||
{
|
||||
ClearTaskList();
|
||||
}
|
||||
@ -134,133 +133,162 @@ void ULuckyRobotsGameInstance::DoSetTempTaskValueChange(bool IsClear)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentFolderName(FString FolderName)
|
||||
void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName)
|
||||
{
|
||||
CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName);
|
||||
}
|
||||
void ULuckyRobotsGameInstance::SetCurrentFileName(FString FileName)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentFileName(const FString& FileName)
|
||||
{
|
||||
CurrentCaptureSettingsData.FileName = FText::FromString(FileName);
|
||||
}
|
||||
void ULuckyRobotsGameInstance::SetCurrentWritesPerSec(int WritesPerSec)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentWritesPerSec(int32 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)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentPetsNumber(int32 PetsNumber)
|
||||
{
|
||||
CurrentCaptureSettingsData.NumberOfPets = FText::FromString(FString::FromInt(PetsNumber));
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentIsRandomPeople(bool bPeople)
|
||||
{
|
||||
CurrentCaptureSettingsData.bPeople = bPeople;
|
||||
}
|
||||
void ULuckyRobotsGameInstance::SetCurrentPeopleNumber(int PeopleNumber)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentPeopleNumber(int32 PeopleNumber)
|
||||
{
|
||||
CurrentCaptureSettingsData.NumberOfPeople = FText::FromString(FString::FromInt(PeopleNumber));
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentIsRandomObjects(bool bObjects)
|
||||
{
|
||||
CurrentCaptureSettingsData.bObjects = bObjects;
|
||||
}
|
||||
void ULuckyRobotsGameInstance::SetCurrentObjectsNumber(int ObjectsNumber)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentObjectsNumber(int32 ObjectsNumber)
|
||||
{
|
||||
CurrentCaptureSettingsData.NumberOfObjects = FText::FromString(FString::FromInt(ObjectsNumber));
|
||||
}
|
||||
void ULuckyRobotsGameInstance::SetCurrentRandomMeshes(TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentRandomMeshes(const TArray<TSoftObjectPtr<UStaticMeshComponent>>& RandomMeshes)
|
||||
{
|
||||
CurrentCaptureSettingsData.RandomMeshes = RandomMeshes;
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentIsInfiniteCapture(bool bInfiniteCapture)
|
||||
{
|
||||
CurrentCaptureSettingsData.bInfiniteCapture = bInfiniteCapture;
|
||||
}
|
||||
void ULuckyRobotsGameInstance::SetCurrentCaptureNumber(int CaptureNumber)
|
||||
|
||||
void ULuckyRobotsGameInstance::SetCurrentCaptureNumber(int32 CaptureNumber)
|
||||
{
|
||||
CurrentCaptureSettingsData.NumberOfCaptures = FText::FromString(FString::FromInt(CaptureNumber));
|
||||
}
|
||||
|
||||
FString ULuckyRobotsGameInstance::GetCurrentFolderName()
|
||||
FString ULuckyRobotsGameInstance::GetCurrentFolderName() const
|
||||
{
|
||||
return CurrentCaptureSettingsData.FolderName.ToString();
|
||||
}
|
||||
FString ULuckyRobotsGameInstance::GetCurrentFileName()
|
||||
|
||||
FString ULuckyRobotsGameInstance::GetCurrentFileName() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomLight()
|
||||
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomLight() const
|
||||
{
|
||||
return CurrentCaptureSettingsData.bLight;
|
||||
}
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomMaterials()
|
||||
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomMaterials() const
|
||||
{
|
||||
return CurrentCaptureSettingsData.bMaterials;
|
||||
}
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomRobotPosition()
|
||||
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomRobotPosition() const
|
||||
{
|
||||
return CurrentCaptureSettingsData.bRobotPosition;
|
||||
}
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPets()
|
||||
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsRandomPets() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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<UStaticMeshComponent>> ULuckyRobotsGameInstance::GetCurrentRandomMeshes() const
|
||||
{
|
||||
return CurrentCaptureSettingsData.RandomMeshes;
|
||||
}
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsInfiniteCapture()
|
||||
|
||||
bool ULuckyRobotsGameInstance::GetCurrentIsInfiniteCapture() const
|
||||
{
|
||||
return CurrentCaptureSettingsData.bInfiniteCapture;
|
||||
}
|
||||
int ULuckyRobotsGameInstance::GetCurrentCaptureNumber()
|
||||
|
||||
int32 ULuckyRobotsGameInstance::GetCurrentCaptureNumber() const
|
||||
{
|
||||
return FCString::Atoi(*(CurrentCaptureSettingsData.NumberOfCaptures.ToString()));
|
||||
}
|
||||
return FCString::Atoi(*CurrentCaptureSettingsData.NumberOfCaptures.ToString());
|
||||
}
|
||||
|
@ -9,28 +9,28 @@
|
||||
|
||||
ULuckyRobotsGameInstance* ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(const UObject* WorldContextObject)
|
||||
{
|
||||
return Cast<ULuckyRobotsGameInstance>(WorldContextObject->GetWorld()->GetGameInstance());
|
||||
if (WorldContextObject && WorldContextObject->GetWorld())
|
||||
{
|
||||
return Cast<ULuckyRobotsGameInstance>(WorldContextObject->GetWorld()->GetGameInstance());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TArray<FRobotData> ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(const UObject* WorldContextObject)
|
||||
{
|
||||
TArray<FRobotData> RobotDataList;
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
|
||||
{
|
||||
if (LuckyRobotsGameInstance->RobotDataDataTable)
|
||||
if (GameInstance->RobotDataDataTable)
|
||||
{
|
||||
FString ContextString;
|
||||
TArray<FName> RowNames = LuckyRobotsGameInstance->RobotDataDataTable->GetRowNames();
|
||||
for (auto RowString : RowNames)
|
||||
TArray<FName> RowNames = GameInstance->RobotDataDataTable->GetRowNames();
|
||||
for (const FName& RowName : RowNames)
|
||||
{
|
||||
FRobotData* pRow = LuckyRobotsGameInstance->RobotDataDataTable->FindRow<FRobotData>(FName(RowString), ContextString);
|
||||
if (pRow)
|
||||
FRobotData* pRow = GameInstance->RobotDataDataTable->FindRow<FRobotData>(RowName, ContextString);
|
||||
if (pRow && pRow->bActive)
|
||||
{
|
||||
if (pRow->bActive)
|
||||
{
|
||||
RobotDataList.Add(*pRow);
|
||||
}
|
||||
RobotDataList.Add(*pRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,22 +41,18 @@ TArray<FRobotData> ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(const UOb
|
||||
TArray<FLevelData> ULuckyRobotsFunctionLibrary::GetActiveLevelDataList(const UObject* WorldContextObject)
|
||||
{
|
||||
TArray<FLevelData> LevelDataList;
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
|
||||
{
|
||||
if (LuckyRobotsGameInstance->LevelDataTable)
|
||||
if (GameInstance->LevelDataTable)
|
||||
{
|
||||
FString ContextString;
|
||||
TArray<FName> RowNames = LuckyRobotsGameInstance->LevelDataTable->GetRowNames();
|
||||
for (auto RowString : RowNames)
|
||||
TArray<FName> RowNames = GameInstance->LevelDataTable->GetRowNames();
|
||||
for (const FName& RowName : RowNames)
|
||||
{
|
||||
FLevelData* pRow = LuckyRobotsGameInstance->LevelDataTable->FindRow<FLevelData>(FName(RowString), ContextString);
|
||||
if (pRow)
|
||||
FLevelData* pRow = GameInstance->LevelDataTable->FindRow<FLevelData>(RowName, ContextString);
|
||||
if (pRow && pRow->bActive)
|
||||
{
|
||||
if (pRow->bActive)
|
||||
{
|
||||
LevelDataList.Add(*pRow);
|
||||
}
|
||||
LevelDataList.Add(*pRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,14 +62,11 @@ TArray<FLevelData> ULuckyRobotsFunctionLibrary::GetActiveLevelDataList(const UOb
|
||||
|
||||
void ULuckyRobotsFunctionLibrary::UpdateQualitySettings(const UObject* WorldContextObject)
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
|
||||
{
|
||||
// Load game user settings and apply
|
||||
UGameUserSettings* GameUserSettings = GEngine->GetGameUserSettings();
|
||||
if (GameUserSettings)
|
||||
if (UGameUserSettings* GameUserSettings = GEngine->GetGameUserSettings())
|
||||
{
|
||||
GameUserSettings->SetOverallScalabilityLevel(int(LuckyRobotsGameInstance->CurrentSelectQuality));
|
||||
GameUserSettings->SetOverallScalabilityLevel(static_cast<int32>(GameInstance->CurrentSelectQuality));
|
||||
GameUserSettings->SaveSettings();
|
||||
GameUserSettings->ApplySettings(true);
|
||||
}
|
||||
@ -90,14 +83,12 @@ FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings(const UObj
|
||||
DefaultCaptureSetting.NumberOfObjects = FText::FromString("1");
|
||||
DefaultCaptureSetting.NumberOfCaptures = FText::FromString("1");
|
||||
|
||||
USG_CaptureSetting* SaveGame = nullptr;
|
||||
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
|
||||
USG_CaptureSetting* SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
|
||||
if (SaveGame)
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
|
||||
{
|
||||
LuckyRobotsGameInstance->CurrentCaptureSettingsData = SaveGame->CaptureSetting;
|
||||
GameInstance->CurrentCaptureSettingsData = SaveGame->CaptureSetting;
|
||||
}
|
||||
return SaveGame->CaptureSetting;
|
||||
}
|
||||
@ -116,22 +107,19 @@ FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings(const UObj
|
||||
|
||||
void ULuckyRobotsFunctionLibrary::SaveCaptureSettings(const UObject* WorldContextObject, FCaptureSettingsData CaptureSetting)
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = GetLuckyRobotsGameInstance(WorldContextObject);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = GetLuckyRobotsGameInstance(WorldContextObject))
|
||||
{
|
||||
LuckyRobotsGameInstance->CurrentCaptureSettingsData = CaptureSetting;
|
||||
GameInstance->CurrentCaptureSettingsData = CaptureSetting;
|
||||
}
|
||||
|
||||
USG_CaptureSetting* SaveGame = nullptr;
|
||||
SaveGame = Cast<USG_CaptureSetting>(UGameplayStatics::LoadGameFromSlot("SGCaptureSettings", 0));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
void ALuckyRobotsGameMode::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
ULuckyRobotsFunctionLibrary::UpdateQualitySettings(this);
|
||||
}
|
||||
|
||||
@ -17,24 +16,21 @@ UClass* ALuckyRobotsGameMode::GetDefaultPawnClassForController_Implementation(AC
|
||||
UClass* RobotClass = Super::GetDefaultPawnClassForController_Implementation(InController);
|
||||
|
||||
ERobotsName CurrentRobot = ERobotsName::None;
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
||||
{
|
||||
CurrentRobot = LuckyRobotsGameInstance->CurrentSelectRobot;
|
||||
CurrentRobot = GameInstance->CurrentSelectRobot;
|
||||
}
|
||||
if (CurrentRobot != ERobotsName::None)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RobotClass;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ ALuckyRobotsGameState::ALuckyRobotsGameState()
|
||||
void ALuckyRobotsGameState::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
if (SocketIOClientComponent)
|
||||
{
|
||||
SocketIOClientComponent->Connect(L"http://localhost:3000/");
|
||||
@ -23,33 +22,25 @@ void ALuckyRobotsGameState::BeginPlay()
|
||||
|
||||
void ALuckyRobotsGameState::DoSendMessage(FString SendValue)
|
||||
{
|
||||
if (SocketIOClientComponent)
|
||||
if (SocketIOClientComponent && SocketIOClientComponent->bIsConnected)
|
||||
{
|
||||
if (SocketIOClientComponent->bIsConnected)
|
||||
{
|
||||
USIOJsonValue* SIOJsonValue = USIOJsonValue::ConstructJsonValueString(this, SendValue);
|
||||
SocketIOClientComponent->Emit("message", SIOJsonValue);
|
||||
}
|
||||
USIOJsonValue* SIOJsonValue = USIOJsonValue::ConstructJsonValueString(this, SendValue);
|
||||
SocketIOClientComponent->Emit(TEXT("message"), SIOJsonValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ALuckyRobotsGameState::DoSocketOnConnect(FString SocketId, FString SessionId, bool IsReconnection)
|
||||
{
|
||||
if (SocketIOClientComponent)
|
||||
if (SocketIOClientComponent && SocketIOClientComponent->bIsConnected)
|
||||
{
|
||||
if (SocketIOClientComponent->bIsConnected)
|
||||
{
|
||||
SocketIOClientComponent->BindEventToGenericEvent("response");
|
||||
}
|
||||
SocketIOClientComponent->BindEventToGenericEvent(TEXT("response"));
|
||||
}
|
||||
}
|
||||
|
||||
void ALuckyRobotsGameState::DoSocketOnGenericEvent(FString EventName, USIOJsonValue* EventData)
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this))
|
||||
{
|
||||
LuckyRobotsGameInstance->DoGetDispatch(EventName, EventData);
|
||||
GameInstance->DoGetDispatch(EventName, EventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
void UMainScreenUserWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
||||
InitData();
|
||||
}
|
||||
|
||||
@ -18,132 +17,121 @@ void UMainScreenUserWidget::InitData()
|
||||
InitRobotData();
|
||||
InitLevelData();
|
||||
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
||||
{
|
||||
iCurrentSelectQuality = int(LuckyRobotsGameInstance->CurrentSelectQuality);
|
||||
CurrentQualityIndex = static_cast<int32>(GameInstance->CurrentSelectQuality);
|
||||
}
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::InitRobotData()
|
||||
{
|
||||
RobotDataList = ULuckyRobotsFunctionLibrary::GetActiveRobotDataList(this);
|
||||
|
||||
iCurrentSelectRobot = 0;
|
||||
CurrentRobotIndex = 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)
|
||||
TArray<FLevelData> FilteredLevels;
|
||||
for (const FLevelData& LevelData : LevelDataList)
|
||||
{
|
||||
if (ActiveLevelData.RobotTypeList.Find(CurrentRobotData.RobotType) >= 0)
|
||||
if (LevelData.RobotTypeList.Contains(CurrentRobotData.RobotType))
|
||||
{
|
||||
LevelDataList.Add(ActiveLevelData);
|
||||
FilteredLevels.Add(LevelData);
|
||||
}
|
||||
}
|
||||
LevelDataList = FilteredLevels;
|
||||
}
|
||||
|
||||
iCurrentSelectLevel = 0;
|
||||
CurrentLevelIndex = 0;
|
||||
UpdateSelectLevel();
|
||||
}
|
||||
|
||||
FRobotData UMainScreenUserWidget::GetCurrentRobotData()
|
||||
FRobotData UMainScreenUserWidget::GetCurrentRobotData() const
|
||||
{
|
||||
FRobotData CurrentRobotData;
|
||||
if (RobotDataList.IsValidIndex(iCurrentSelectRobot))
|
||||
if (RobotDataList.IsValidIndex(CurrentRobotIndex))
|
||||
{
|
||||
CurrentRobotData = RobotDataList[iCurrentSelectRobot];
|
||||
return RobotDataList[CurrentRobotIndex];
|
||||
}
|
||||
return CurrentRobotData;
|
||||
return FRobotData();
|
||||
}
|
||||
|
||||
FLevelData UMainScreenUserWidget::GetCurrentLevelData()
|
||||
FLevelData UMainScreenUserWidget::GetCurrentLevelData() const
|
||||
{
|
||||
FLevelData CurrentLevelData;
|
||||
if (LevelDataList.IsValidIndex(iCurrentSelectLevel))
|
||||
if (LevelDataList.IsValidIndex(CurrentLevelIndex))
|
||||
{
|
||||
CurrentLevelData = LevelDataList[iCurrentSelectLevel];
|
||||
return LevelDataList[CurrentLevelIndex];
|
||||
}
|
||||
return CurrentLevelData;
|
||||
return FLevelData();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::SelectNextRobot()
|
||||
{
|
||||
iCurrentSelectRobot = FMath::Clamp(iCurrentSelectRobot + 1, 0, RobotDataList.Num() - 1);
|
||||
CurrentRobotIndex = FMath::Clamp(CurrentRobotIndex + 1, 0, RobotDataList.Num() - 1);
|
||||
UpdateSelectRobot();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::SelectPreviousRobot()
|
||||
{
|
||||
iCurrentSelectRobot = FMath::Clamp(iCurrentSelectRobot - 1, 0, RobotDataList.Num() - 1);
|
||||
CurrentRobotIndex = FMath::Clamp(CurrentRobotIndex - 1, 0, RobotDataList.Num() - 1);
|
||||
UpdateSelectRobot();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::SelectNextLevel()
|
||||
{
|
||||
iCurrentSelectLevel = FMath::Clamp(iCurrentSelectLevel + 1, 0, LevelDataList.Num() - 1);
|
||||
CurrentLevelIndex = FMath::Clamp(CurrentLevelIndex + 1, 0, LevelDataList.Num() - 1);
|
||||
UpdateSelectLevel();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::SelectPreviousLevel()
|
||||
{
|
||||
iCurrentSelectLevel = FMath::Clamp(iCurrentSelectLevel - 1, 0, LevelDataList.Num() - 1);
|
||||
CurrentLevelIndex = FMath::Clamp(CurrentLevelIndex - 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);
|
||||
|
||||
int32 EnumCount = QualityEnum->NumEnums() - 1;
|
||||
CurrentQualityIndex = FMath::Clamp(CurrentQualityIndex - 1, 0, EnumCount - 1);
|
||||
UpdateSelectQuality();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::SelectPreviousQuality()
|
||||
{
|
||||
UEnum* QualityEnum = StaticEnum<EQualityEnum>();
|
||||
int QualityEnumNum = QualityEnum->NumEnums() - 1;
|
||||
iCurrentSelectQuality = FMath::Clamp(iCurrentSelectQuality + 1, 0, QualityEnumNum - 1);
|
||||
|
||||
int32 EnumCount = QualityEnum->NumEnums() - 1;
|
||||
CurrentQualityIndex = FMath::Clamp(CurrentQualityIndex + 1, 0, EnumCount - 1);
|
||||
UpdateSelectQuality();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::UpdateSelectRobot()
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
||||
{
|
||||
LuckyRobotsGameInstance->CurrentSelectRobot = GetCurrentRobotData().Name;
|
||||
GameInstance->CurrentSelectRobot = GetCurrentRobotData().Name;
|
||||
}
|
||||
BPUpdateSelectRobot();
|
||||
InitLevelData();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::UpdateSelectLevel()
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
||||
{
|
||||
LuckyRobotsGameInstance->CurrentSelectLevel = GetCurrentLevelData().LevelEnum;
|
||||
GameInstance->CurrentSelectLevel = GetCurrentLevelData().LevelEnum;
|
||||
}
|
||||
BPUpdateSelectLevel();
|
||||
}
|
||||
|
||||
void UMainScreenUserWidget::UpdateSelectQuality()
|
||||
{
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance());
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
||||
{
|
||||
LuckyRobotsGameInstance->CurrentSelectQuality = static_cast<EQualityEnum>(iCurrentSelectQuality);
|
||||
GameInstance->CurrentSelectQuality = static_cast<EQualityEnum>(CurrentQualityIndex);
|
||||
}
|
||||
BPUpdateSelectQuality();
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,13 @@
|
||||
|
||||
|
||||
#include "UI/GameUserWidget.h"
|
||||
#include "FunctionLibraries/LuckyRobotsFunctionLibrary.h"
|
||||
#include "Core/LuckyRobotsGameInstance.h"
|
||||
|
||||
void UGameUserWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
||||
ULuckyRobotsGameInstance* LuckyRobotsGameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this);
|
||||
if (LuckyRobotsGameInstance)
|
||||
if (ULuckyRobotsGameInstance* GameInstance = Cast<ULuckyRobotsGameInstance>(GetGameInstance()))
|
||||
{
|
||||
LuckyRobotsGameInstance->GameUserWidget = this;
|
||||
GameInstance->GameUserWidget = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ public:
|
||||
|
||||
public:
|
||||
bool bIsFirstOpenGame;
|
||||
|
||||
bool bIsDebug;
|
||||
bool bIsWidgetTestMode;
|
||||
bool bIsShowPath;
|
||||
@ -48,10 +47,10 @@ public:
|
||||
bool bIsMouseOpen;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
|
||||
bool bIschange;
|
||||
bool bIsChanged;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
|
||||
int FolderCount;
|
||||
int32 FolderCount;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Capture")
|
||||
FTransform TargetPosition;
|
||||
@ -90,10 +89,10 @@ public:
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DoSendMessage(FString SendValue);
|
||||
void DoSendMessage(const FString& SendValue);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DoLogItemAdd(FString Topic, FString MsgText, ELogItemType LogItemType);
|
||||
void DoLogItemAdd(const FString& Topic, const FString& MsgText, ELogItemType LogItemType);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SwitchGamePaused();
|
||||
@ -103,41 +102,41 @@ public:
|
||||
void ClearTaskList();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void AddTask(FGoalsTaskData TaskData);
|
||||
void AddTask(const FGoalsTaskData& TaskData);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveTask(FGoalsTaskData TaskData);
|
||||
void RemoveTask(const FGoalsTaskData& TaskData);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void RemoveTaskByGoalType(EGoalType GoalType);
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int GetTaskNum();
|
||||
int32 GetTaskNum() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetTask(int Index, FGoalsTaskData TaskData);
|
||||
void SetTask(int32 Index, const FGoalsTaskData& TaskData);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool GetTask(int Index, FGoalsTaskData& TaskData);
|
||||
bool GetTask(int32 Index, FGoalsTaskData& OutTaskData) const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ReSetTaskList();
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
TArray<FGoalsTaskData> GetTaskList();
|
||||
TArray<FGoalsTaskData> GetTaskList() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DoSetTempTaskValueChange(bool IsClear);
|
||||
void DoSetTempTaskValueChange(bool bIsClear);
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentFolderName(FString FolderName);
|
||||
void SetCurrentFolderName(const FString& FolderName);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentFileName(FString FileName);
|
||||
void SetCurrentFileName(const FString& FileName);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentWritesPerSec(int WritesPerSec);
|
||||
void SetCurrentWritesPerSec(int32 WritesPerSec);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentIsScenario(bool IsScenario);
|
||||
@ -155,77 +154,77 @@ public:
|
||||
void SetCurrentIsRandomPets(bool bPets);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentPetsNumber(int PetsNumber);
|
||||
void SetCurrentPetsNumber(int32 PetsNumber);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentIsRandomPeople(bool bPeople);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentPeopleNumber(int PeopleNumber);
|
||||
void SetCurrentPeopleNumber(int32 PeopleNumber);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentIsRandomObjects(bool bObjects);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentObjectsNumber(int ObjectsNumber);
|
||||
void SetCurrentObjectsNumber(int32 ObjectsNumber);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentRandomMeshes(TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes);
|
||||
void SetCurrentRandomMeshes(const TArray<TSoftObjectPtr<UStaticMeshComponent>>& RandomMeshes);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentIsInfiniteCapture(bool bInfiniteCapture);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetCurrentCaptureNumber(int CaptureNumber);
|
||||
void SetCurrentCaptureNumber(int32 CaptureNumber);
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintPure)
|
||||
FString GetCurrentFolderName();
|
||||
FString GetCurrentFolderName() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
FString GetCurrentFileName();
|
||||
FString GetCurrentFileName() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int GetCurrentWritesPerSec();
|
||||
int32 GetCurrentWritesPerSec() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsScenario();
|
||||
bool GetCurrentIsScenario() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsRandomLight();
|
||||
bool GetCurrentIsRandomLight() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsRandomMaterials();
|
||||
bool GetCurrentIsRandomMaterials() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsRandomRobotPosition();
|
||||
bool GetCurrentIsRandomRobotPosition() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsRandomPets();
|
||||
bool GetCurrentIsRandomPets() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int GetCurrentPetsNumber();
|
||||
int32 GetCurrentPetsNumber() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsRandomPeople();
|
||||
bool GetCurrentIsRandomPeople() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int GetCurrentPeopleNumber();
|
||||
int32 GetCurrentPeopleNumber() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsRandomObjects();
|
||||
bool GetCurrentIsRandomObjects() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int GetCurrentObjectsNumber();
|
||||
int32 GetCurrentObjectsNumber() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
TArray<TSoftObjectPtr<UStaticMeshComponent>> GetCurrentRandomMeshes();
|
||||
TArray<TSoftObjectPtr<UStaticMeshComponent>> GetCurrentRandomMeshes() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
bool GetCurrentIsInfiniteCapture();
|
||||
bool GetCurrentIsInfiniteCapture() const;
|
||||
|
||||
UFUNCTION(BlueprintPure)
|
||||
int GetCurrentCaptureNumber();
|
||||
int32 GetCurrentCaptureNumber() const;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
|
@ -1,5 +1,3 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
@ -7,16 +5,12 @@
|
||||
#include "SharedDef.h"
|
||||
#include "MainScreenUserWidget.generated.h"
|
||||
|
||||
class UDataTable;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class LUCKYROBOTS_API UMainScreenUserWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
protected:
|
||||
virtual void NativeConstruct();
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
@ -26,24 +20,29 @@ public:
|
||||
TArray<FLevelData> LevelDataList;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int iCurrentSelectRobot;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int iCurrentSelectLevel;
|
||||
int32 CurrentRobotIndex;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int iCurrentSelectQuality;
|
||||
int32 CurrentLevelIndex;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 CurrentQualityIndex;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InitData();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InitRobotData();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InitLevelData();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FRobotData GetCurrentRobotData();
|
||||
FRobotData GetCurrentRobotData() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FLevelData GetCurrentLevelData();
|
||||
FLevelData GetCurrentLevelData() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SelectNextRobot();
|
||||
|
@ -2,124 +2,125 @@
|
||||
|
||||
#include "SharedDef.generated.h"
|
||||
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ERobotsCategories : uint8
|
||||
{
|
||||
Wheeled UMETA(DisplayName = "Wheeled Robots"),
|
||||
FourLegged UMETA(DisplayName = "Four-Legged Robots"),
|
||||
TwoLegged UMETA(DisplayName = "Two-Legged Robots"),
|
||||
Stationary UMETA(DisplayName = "Stationary Robots"),
|
||||
IndoorFlying UMETA(DisplayName = "Indoor Flying Robots"),
|
||||
SwimmingUnderwater UMETA(DisplayName = "Swimming/Underwater Robots"),
|
||||
CrawlingModular UMETA(DisplayName = "Crawling/Modular Robots"),
|
||||
Arm UMETA(DisplayName = "Arm-Robots"),
|
||||
OutdoorFlying UMETA(DisplayName = "Outdoor Flying Robots")
|
||||
Wheeled UMETA(DisplayName = "Wheeled Robots"),
|
||||
FourLegged UMETA(DisplayName = "Four-Legged Robots"),
|
||||
TwoLegged UMETA(DisplayName = "Two-Legged Robots"),
|
||||
Stationary UMETA(DisplayName = "Stationary Robots"),
|
||||
IndoorFlying UMETA(DisplayName = "Indoor Flying Robots"),
|
||||
SwimmingUnderwater UMETA(DisplayName = "Swimming/Underwater Robots"),
|
||||
CrawlingModular UMETA(DisplayName = "Crawling/Modular Robots"),
|
||||
Arm UMETA(DisplayName = "Arm-Robots"),
|
||||
OutdoorFlying UMETA(DisplayName = "Outdoor Flying Robots")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ERobotsName : uint8
|
||||
{
|
||||
None UMETA(DisplayName = "None"),
|
||||
Luck_e UMETA(DisplayName = "Luck-e"),
|
||||
Stretch UMETA(DisplayName = "Stretch"),
|
||||
LuckyDrone UMETA(DisplayName = "Lucky Drone"),
|
||||
DJIDrone UMETA(DisplayName = "DJI Drone"),
|
||||
ArmLucky UMETA(DisplayName = "Arm Lucky"),
|
||||
UnitreeG1 UMETA(DisplayName = "Unitree G1"),
|
||||
StretchRobotV1 UMETA(DisplayName = "Stretch Robot V1"),
|
||||
PandaArmRobot UMETA(DisplayName = "Panda Arm Robot"),
|
||||
PuralinkRobot UMETA(DisplayName = "Puralink Robot"),
|
||||
UnitreeGo2 UMETA(DisplayName = "Unitree Go 2"),
|
||||
RevoluteRobot UMETA(DisplayName = "Revolute Robot"),
|
||||
BostonSpotRobot UMETA(DisplayName = "Boston Spot Robot")
|
||||
None UMETA(DisplayName = "None"),
|
||||
Luck_e UMETA(DisplayName = "Luck-e"),
|
||||
Stretch UMETA(DisplayName = "Stretch"),
|
||||
LuckyDrone UMETA(DisplayName = "Lucky Drone"),
|
||||
DJIDrone UMETA(DisplayName = "DJI Drone"),
|
||||
ArmLucky UMETA(DisplayName = "Arm Lucky"),
|
||||
UnitreeG1 UMETA(DisplayName = "Unitree G1"),
|
||||
StretchRobotV1 UMETA(DisplayName = "Stretch Robot V1"),
|
||||
PandaArmRobot UMETA(DisplayName = "Panda Arm Robot"),
|
||||
PuralinkRobot UMETA(DisplayName = "Puralink Robot"),
|
||||
UnitreeGo2 UMETA(DisplayName = "Unitree Go 2"),
|
||||
RevoluteRobot UMETA(DisplayName = "Revolute Robot"),
|
||||
BostonSpotRobot UMETA(DisplayName = "Boston Spot Robot")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ELevelType : uint8
|
||||
{
|
||||
Home UMETA(DisplayName = "Home"),
|
||||
Office UMETA(DisplayName = "Office"),
|
||||
Street UMETA(DisplayName = "Street"),
|
||||
TestLevel UMETA(DisplayName = "TestLevel")
|
||||
Home UMETA(DisplayName = "Home"),
|
||||
Office UMETA(DisplayName = "Office"),
|
||||
Street UMETA(DisplayName = "Street"),
|
||||
TestLevel UMETA(DisplayName = "TestLevel")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ELevelEnum : uint8
|
||||
{
|
||||
None UMETA(DisplayName = "None"),
|
||||
TestLevel UMETA(DisplayName = "Test Level"),
|
||||
Loft UMETA(DisplayName = "Loft"),
|
||||
Rome UMETA(DisplayName = "Rome"),
|
||||
Paris UMETA(DisplayName = "Paris"),
|
||||
Marseille UMETA(DisplayName = "Marseille"),
|
||||
Istanbul UMETA(DisplayName = "Istanbul"),
|
||||
Office UMETA(DisplayName = "Office"),
|
||||
BasicForest UMETA(DisplayName = "Basic Forest"),
|
||||
NaturalForest UMETA(DisplayName = "Natural Forest"),
|
||||
KitchenForArmRobot UMETA(DisplayName = "Kitchen for Arm Robot"),
|
||||
PipeFabric UMETA(DisplayName = "Pipe Fabric")
|
||||
None UMETA(DisplayName = "None"),
|
||||
TestLevel UMETA(DisplayName = "Test Level"),
|
||||
Loft UMETA(DisplayName = "Loft"),
|
||||
Rome UMETA(DisplayName = "Rome"),
|
||||
Paris UMETA(DisplayName = "Paris"),
|
||||
Marseille UMETA(DisplayName = "Marseille"),
|
||||
Istanbul UMETA(DisplayName = "Istanbul"),
|
||||
Office UMETA(DisplayName = "Office"),
|
||||
BasicForest UMETA(DisplayName = "Basic Forest"),
|
||||
NaturalForest UMETA(DisplayName = "Natural Forest"),
|
||||
KitchenForArmRobot UMETA(DisplayName = "Kitchen for Arm Robot"),
|
||||
PipeFabric UMETA(DisplayName = "Pipe Fabric")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EQualityEnum : uint8
|
||||
{
|
||||
Low UMETA(DisplayName = "Low"),
|
||||
Middle UMETA(DisplayName = "Middle"),
|
||||
High UMETA(DisplayName = "High"),
|
||||
Epic UMETA(DisplayName = "Epic")
|
||||
Low UMETA(DisplayName = "Low"),
|
||||
Middle UMETA(DisplayName = "Middle"),
|
||||
High UMETA(DisplayName = "High"),
|
||||
Epic UMETA(DisplayName = "Epic")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EGoalType : uint8
|
||||
{
|
||||
GrabAndPull UMETA(DisplayName = "Grab and Pull"),
|
||||
GrabAndRotate UMETA(DisplayName = "Grab and Rotate"),
|
||||
GrabAndOpen UMETA(DisplayName = "Grab and Open"),
|
||||
PickAndPlace UMETA(DisplayName = "Pick and Place"),
|
||||
Pick UMETA(DisplayName = "Pick"),
|
||||
GrabAndInsert UMETA(DisplayName = "Grab and Insert"),
|
||||
Find UMETA(DisplayName = "Find"),
|
||||
Point UMETA(DisplayName = "Point"),
|
||||
PointWithLaserPointer UMETA(DisplayName = "Point with Laser Pointer"),
|
||||
RotateHand UMETA(DisplayName = "Rotate Hand"),
|
||||
SliceDice UMETA(DisplayName = "Slice/Dice"),
|
||||
Wipe UMETA(DisplayName = "Wipe"),
|
||||
FoldUnfold UMETA(DisplayName = "Fold/Unfold"),
|
||||
ArrangeOrganize UMETA(DisplayName = "Arrange/Organize"),
|
||||
PressButton UMETA(DisplayName = "Press Button"),
|
||||
PourDispense UMETA(DisplayName = "Pour/Dispense"),
|
||||
NavigateSimpleEnvironments UMETA(DisplayName = "Navigate Simple Environments"),
|
||||
NavigateComplexTerrain UMETA(DisplayName = "Navigate Complex Terrain"),
|
||||
ClimbStairsOrRamps UMETA(DisplayName = "Climb Stairs or Ramps"),
|
||||
BalanceStabilize UMETA(DisplayName = "Balance/Stabilize"),
|
||||
DockingAndCharging UMETA(DisplayName = "Docking and Charging"),
|
||||
ChangeGripper UMETA(DisplayName = "Change Gripper"),
|
||||
Place UMETA(DisplayName = "Place")
|
||||
GrabAndPull UMETA(DisplayName = "Grab and Pull"),
|
||||
GrabAndRotate UMETA(DisplayName = "Grab and Rotate"),
|
||||
GrabAndOpen UMETA(DisplayName = "Grab and Open"),
|
||||
PickAndPlace UMETA(DisplayName = "Pick and Place"),
|
||||
Pick UMETA(DisplayName = "Pick"),
|
||||
GrabAndInsert UMETA(DisplayName = "Grab and Insert"),
|
||||
Find UMETA(DisplayName = "Find"),
|
||||
Point UMETA(DisplayName = "Point"),
|
||||
PointWithLaserPointer UMETA(DisplayName = "Point with Laser Pointer"),
|
||||
RotateHand UMETA(DisplayName = "Rotate Hand"),
|
||||
SliceDice UMETA(DisplayName = "Slice/Dice"),
|
||||
Wipe UMETA(DisplayName = "Wipe"),
|
||||
FoldUnfold UMETA(DisplayName = "Fold/Unfold"),
|
||||
ArrangeOrganize UMETA(DisplayName = "Arrange/Organize"),
|
||||
PressButton UMETA(DisplayName = "Press Button"),
|
||||
PourDispense UMETA(DisplayName = "Pour/Dispense"),
|
||||
NavigateSimpleEnvironments UMETA(DisplayName = "Navigate Simple Environments"),
|
||||
NavigateComplexTerrain UMETA(DisplayName = "Navigate Complex Terrain"),
|
||||
ClimbStairsOrRamps UMETA(DisplayName = "Climb Stairs or Ramps"),
|
||||
BalanceStabilize UMETA(DisplayName = "Balance/Stabilize"),
|
||||
DockingAndCharging UMETA(DisplayName = "Docking and Charging"),
|
||||
ChangeGripper UMETA(DisplayName = "Change Gripper"),
|
||||
Place UMETA(DisplayName = "Place")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ESaveDataType : uint8
|
||||
{
|
||||
file UMETA(DisplayName = "file"),
|
||||
webserver UMETA(DisplayName = "webserver"),
|
||||
http UMETA(DisplayName = "http"),
|
||||
debug UMETA(DisplayName = "debug"),
|
||||
none UMETA(DisplayName = "none")
|
||||
file UMETA(DisplayName = "file"),
|
||||
webserver UMETA(DisplayName = "webserver"),
|
||||
http UMETA(DisplayName = "http"),
|
||||
debug UMETA(DisplayName = "debug"),
|
||||
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")
|
||||
Debug UMETA(DisplayName = "Debug"),
|
||||
War UMETA(DisplayName = "War"),
|
||||
Error UMETA(DisplayName = "Error"),
|
||||
Consol UMETA(DisplayName = "Consol")
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FRobotData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ERobotsName Name;
|
||||
@ -147,9 +148,10 @@ USTRUCT(BlueprintType)
|
||||
struct FLevelData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int ID;
|
||||
int32 ID;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ELevelEnum LevelEnum;
|
||||
@ -157,7 +159,6 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ELevelType LevelType;
|
||||
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UWorld> LevelObject;
|
||||
|
||||
@ -178,12 +179,12 @@ public:
|
||||
LevelObject == Other.LevelObject &&
|
||||
LevelImage == Other.LevelImage &&
|
||||
bActive == Other.bActive &&
|
||||
RobotTypeList == Other.RobotTypeList;
|
||||
RobotTypeList == Other.RobotTypeList;
|
||||
}
|
||||
|
||||
FLevelData& operator=(const FLevelData& Other)
|
||||
{
|
||||
if (this != &Other)
|
||||
if (this != &Other)
|
||||
{
|
||||
ID = Other.ID;
|
||||
LevelEnum = Other.LevelEnum;
|
||||
@ -201,6 +202,7 @@ USTRUCT(BlueprintType)
|
||||
struct FGoalsTaskData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
EGoalType GoalType;
|
||||
@ -215,13 +217,13 @@ public:
|
||||
TSoftObjectPtr<UObject> TargetActor;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bIsComplate;
|
||||
bool bIsComplete;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FVector DropOffLocation;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FString ObjectName;
|
||||
FString ObjectName;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bActive;
|
||||
@ -230,9 +232,9 @@ public:
|
||||
{
|
||||
return GoalType == Other.GoalType &&
|
||||
bIsStart == Other.bIsStart &&
|
||||
TargetLocation.Equals(Other.TargetLocation, 0.01f) &&
|
||||
TargetLocation.Equals(Other.TargetLocation, 0.01f) &&
|
||||
TargetActor == Other.TargetActor &&
|
||||
bIsComplate == Other.bIsComplate &&
|
||||
bIsComplete == Other.bIsComplete &&
|
||||
DropOffLocation.Equals(Other.DropOffLocation, 0.01f) &&
|
||||
ObjectName == Other.ObjectName &&
|
||||
bActive == Other.bActive;
|
||||
@ -240,13 +242,13 @@ public:
|
||||
|
||||
FGoalsTaskData& operator=(const FGoalsTaskData& Other)
|
||||
{
|
||||
if (this != &Other)
|
||||
if (this != &Other)
|
||||
{
|
||||
GoalType = Other.GoalType;
|
||||
bIsStart = Other.bIsStart;
|
||||
TargetLocation = Other.TargetLocation;
|
||||
TargetActor = Other.TargetActor;
|
||||
bIsComplate = Other.bIsComplate;
|
||||
bIsComplete = Other.bIsComplete;
|
||||
DropOffLocation = Other.DropOffLocation;
|
||||
ObjectName = Other.ObjectName;
|
||||
bActive = Other.bActive;
|
||||
@ -259,6 +261,7 @@ USTRUCT(BlueprintType)
|
||||
struct FCaptureSettingsData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText FolderName = FText::FromString("robotdata");
|
||||
@ -306,7 +309,7 @@ public:
|
||||
TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool bInfiniteCapture;
|
||||
bool bInfiniteCapture;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText NumberOfCaptures = FText::FromString("1");
|
||||
@ -317,7 +320,7 @@ public:
|
||||
FileName.EqualTo(Other.FileName) &&
|
||||
WritesPerSec.EqualTo(Other.WritesPerSec) &&
|
||||
IsScenario == Other.IsScenario &&
|
||||
TaskList == Other.TaskList &&
|
||||
TaskList == Other.TaskList &&
|
||||
bLight == Other.bLight &&
|
||||
bMaterials == Other.bMaterials &&
|
||||
bRobotPosition == Other.bRobotPosition &&
|
||||
@ -327,14 +330,14 @@ public:
|
||||
NumberOfPeople.EqualTo(Other.NumberOfPeople) &&
|
||||
bObjects == Other.bObjects &&
|
||||
NumberOfObjects.EqualTo(Other.NumberOfObjects) &&
|
||||
RandomMeshes == Other.RandomMeshes &&
|
||||
RandomMeshes == Other.RandomMeshes &&
|
||||
bInfiniteCapture == Other.bInfiniteCapture &&
|
||||
NumberOfCaptures.EqualTo(Other.NumberOfCaptures);
|
||||
}
|
||||
|
||||
FCaptureSettingsData& operator=(const FCaptureSettingsData& Other)
|
||||
{
|
||||
if (this != &Other)
|
||||
if (this != &Other)
|
||||
{
|
||||
FolderName = Other.FolderName;
|
||||
FileName = Other.FileName;
|
||||
@ -362,6 +365,7 @@ USTRUCT(BlueprintType)
|
||||
struct FAllGoalListData : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
EGoalType GoalType;
|
||||
@ -380,9 +384,10 @@ USTRUCT(BlueprintType)
|
||||
struct FLuckyCode : public FTableRowBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int ID;
|
||||
int32 ID;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FString Code;
|
||||
|
@ -16,7 +16,7 @@ class LUCKYROBOTS_API UGameUserWidget : public UUserWidget
|
||||
GENERATED_BODY()
|
||||
|
||||
protected:
|
||||
virtual void NativeConstruct();
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
|
Reference in New Issue
Block a user