Compare commits
No commits in common. "b2a0e7b3acf3333e41521f3d5077a9a423c2ff33" and "42a78f9c9ac8189b5c177d8708b5c7714acaa65e" have entirely different histories.
b2a0e7b3ac
...
42a78f9c9a
@ -4,8 +4,6 @@
|
|||||||
#include "LuckyRobotsFunctionLibrary.h"
|
#include "LuckyRobotsFunctionLibrary.h"
|
||||||
#include "LuckyRobotsGameInstance.h"
|
#include "LuckyRobotsGameInstance.h"
|
||||||
#include "GameFramework/GameUserSettings.h"
|
#include "GameFramework/GameUserSettings.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
|
||||||
#include "SG_CaptureSetting.h"
|
|
||||||
|
|
||||||
ULuckyRobotsGameInstance* ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(const UObject* WorldContextObject)
|
ULuckyRobotsGameInstance* ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(const UObject* WorldContextObject)
|
||||||
{
|
{
|
||||||
@ -78,49 +76,4 @@ void ULuckyRobotsFunctionLibrary::UpdateQualitySettings(const UObject* WorldCont
|
|||||||
GameUserSettings->ApplySettings(true);
|
GameUserSettings->ApplySettings(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FCaptureSettingsData ULuckyRobotsFunctionLibrary::LoadCaptureSettings()
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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(FCaptureSettingsData 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -3,80 +3,3 @@
|
|||||||
|
|
||||||
#include "LuckyRobotsGameInstance.h"
|
#include "LuckyRobotsGameInstance.h"
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::ClearTaskList()
|
|
||||||
{
|
|
||||||
TaskList.Empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::AddTask(FGoalsTaskData TaskData)
|
|
||||||
{
|
|
||||||
TaskList.Add(TaskData);
|
|
||||||
}
|
|
||||||
void ULuckyRobotsGameInstance::RemoveTask(FGoalsTaskData TaskData)
|
|
||||||
{
|
|
||||||
TaskList.Remove(TaskData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::RemoveTaskByGoalType(EGoalType GoalType)
|
|
||||||
{
|
|
||||||
for (auto Task : TaskList)
|
|
||||||
{
|
|
||||||
if (Task.GoalType == GoalType)
|
|
||||||
{
|
|
||||||
RemoveTask(Task);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ULuckyRobotsGameInstance::GetTaskNum()
|
|
||||||
{
|
|
||||||
return TaskList.Num();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::SetTask(int Index, FGoalsTaskData TaskData)
|
|
||||||
{
|
|
||||||
if (TaskList.IsValidIndex(Index))
|
|
||||||
{
|
|
||||||
TaskList[Index] = TaskData;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = TaskList.Num(); i < Index; i++)
|
|
||||||
{
|
|
||||||
FGoalsTaskData TempTaskData;
|
|
||||||
AddTask(TempTaskData);
|
|
||||||
}
|
|
||||||
AddTask(TaskData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ULuckyRobotsGameInstance::GetTask(int Index, FGoalsTaskData& TaskData)
|
|
||||||
{
|
|
||||||
if (TaskList.IsValidIndex(Index))
|
|
||||||
{
|
|
||||||
TaskData = TaskList[Index];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ULuckyRobotsGameInstance::ReSetTaskList()
|
|
||||||
{
|
|
||||||
TArray<FGoalsTaskData> TempTaskList;
|
|
||||||
for (auto Task : TaskList)
|
|
||||||
{
|
|
||||||
Task.bIsStart = false;
|
|
||||||
Task.bIsStart = false;
|
|
||||||
Task.bActive = false;
|
|
||||||
TempTaskList.Add(Task);
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskList = TempTaskList;
|
|
||||||
}
|
|
||||||
|
|
||||||
TArray<FGoalsTaskData> ULuckyRobotsGameInstance::GetTaskList()
|
|
||||||
{
|
|
||||||
return TaskList;
|
|
||||||
}
|
|
@ -8,7 +8,6 @@
|
|||||||
#include "LuckyRobotsFunctionLibrary.generated.h"
|
#include "LuckyRobotsFunctionLibrary.generated.h"
|
||||||
|
|
||||||
class ULuckyRobotsGameInstance;
|
class ULuckyRobotsGameInstance;
|
||||||
class USG_CaptureSetting;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -28,10 +27,4 @@ public:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
|
UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"))
|
||||||
static void UpdateQualitySettings(const UObject* WorldContextObject);
|
static void UpdateQualitySettings(const UObject* WorldContextObject);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
static FCaptureSettingsData LoadCaptureSettings();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
static void SaveCaptureSettings(FCaptureSettingsData CaptureSetting);
|
|
||||||
};
|
};
|
||||||
|
@ -33,40 +33,7 @@ public:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
EQualityEnum CurrentSelectQuality = EQualityEnum::Epic;
|
EQualityEnum CurrentSelectQuality = EQualityEnum::Epic;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
TArray<FGoalsTaskData> TaskList;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
FGoalsTaskData TempTask;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintImplementableEvent)
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
void DoGetDispatch(const FString& EventName, USIOJsonValue* EventData);
|
void DoGetDispatch(const FString& EventName, USIOJsonValue* EventData);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ClearTaskList();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void AddTask(FGoalsTaskData TaskData);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void RemoveTask(FGoalsTaskData TaskData);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void RemoveTaskByGoalType(EGoalType GoalType);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure)
|
|
||||||
int GetTaskNum();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void SetTask(int Index, FGoalsTaskData TaskData);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
bool GetTask(int Index, FGoalsTaskData& TaskData);
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable)
|
|
||||||
void ReSetTaskList();
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure)
|
|
||||||
TArray<FGoalsTaskData> GetTaskList();
|
|
||||||
};
|
};
|
||||||
|
@ -75,27 +75,7 @@ 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"),
|
|
||||||
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")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
@ -151,32 +131,6 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TArray<ERobotsCategories> RobotTypeList;
|
TArray<ERobotsCategories> RobotTypeList;
|
||||||
|
|
||||||
bool operator==(const FLevelData& Other) const
|
|
||||||
{
|
|
||||||
return ID == Other.ID &&
|
|
||||||
LevelEnum == Other.LevelEnum &&
|
|
||||||
LevelType == Other.LevelType &&
|
|
||||||
LevelObject == Other.LevelObject &&
|
|
||||||
LevelImage == Other.LevelImage &&
|
|
||||||
bActive == Other.bActive &&
|
|
||||||
RobotTypeList == Other.RobotTypeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLevelData& operator=(const FLevelData& Other)
|
|
||||||
{
|
|
||||||
if (this != &Other)
|
|
||||||
{
|
|
||||||
ID = Other.ID;
|
|
||||||
LevelEnum = Other.LevelEnum;
|
|
||||||
LevelType = Other.LevelType;
|
|
||||||
LevelObject = Other.LevelObject;
|
|
||||||
LevelImage = Other.LevelImage;
|
|
||||||
bActive = Other.bActive;
|
|
||||||
RobotTypeList = Other.RobotTypeList;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
@ -194,7 +148,7 @@ public:
|
|||||||
FTransform TargetLocation;
|
FTransform TargetLocation;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TSoftObjectPtr<UObject> TargetActor;
|
AActor* TargetActor;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
bool bIsComplate;
|
bool bIsComplate;
|
||||||
@ -207,34 +161,6 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
bool bActive;
|
bool bActive;
|
||||||
|
|
||||||
bool operator==(const FGoalsTaskData& Other) const
|
|
||||||
{
|
|
||||||
return GoalType == Other.GoalType &&
|
|
||||||
bIsStart == Other.bIsStart &&
|
|
||||||
TargetLocation.Equals(Other.TargetLocation, 0.01f) &&
|
|
||||||
TargetActor == Other.TargetActor &&
|
|
||||||
bIsComplate == Other.bIsComplate &&
|
|
||||||
DropOffLocation.Equals(Other.DropOffLocation, 0.01f) &&
|
|
||||||
ObjectName == Other.ObjectName &&
|
|
||||||
bActive == Other.bActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
FGoalsTaskData& operator=(const FGoalsTaskData& Other)
|
|
||||||
{
|
|
||||||
if (this != &Other)
|
|
||||||
{
|
|
||||||
GoalType = Other.GoalType;
|
|
||||||
bIsStart = Other.bIsStart;
|
|
||||||
TargetLocation = Other.TargetLocation;
|
|
||||||
TargetActor = Other.TargetActor;
|
|
||||||
bIsComplate = Other.bIsComplate;
|
|
||||||
DropOffLocation = Other.DropOffLocation;
|
|
||||||
ObjectName = Other.ObjectName;
|
|
||||||
bActive = Other.bActive;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
USTRUCT(BlueprintType)
|
||||||
@ -243,13 +169,13 @@ struct FCaptureSettingsData : public FTableRowBase
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
public:
|
public:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText FolderName = FText::FromString("robotdata");
|
FText FolderName;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText FileName = FText::FromString("FILE");
|
FText FileName;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText WritesPerSec = FText::FromString("1");
|
FText WritesPerSec;
|
||||||
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
@ -277,84 +203,20 @@ public:
|
|||||||
bool bPeople;
|
bool bPeople;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText NumberOfPeople = FText::FromString("1");
|
FText NumberOfPeople;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
bool bObjects;
|
bool bObjects;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText NumberOfObjects = FText::FromString("1");
|
FText NumberOfObjects;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
TArray<TSoftObjectPtr<UStaticMeshComponent>> RandomMeshes;
|
TArray<UStaticMeshComponent*> RandomMeshes;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
bool bInfiniteCapture;
|
bool bInfiniteCapture;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||||
FText NumberOfCaptures = FText::FromString("1");
|
FText NumberOfCaptures;
|
||||||
|
|
||||||
bool operator==(const FCaptureSettingsData& Other) const
|
|
||||||
{
|
|
||||||
return FolderName.EqualTo(Other.FolderName) &&
|
|
||||||
FileName.EqualTo(Other.FileName) &&
|
|
||||||
WritesPerSec.EqualTo(Other.WritesPerSec) &&
|
|
||||||
IsScenario == Other.IsScenario &&
|
|
||||||
TaskList == Other.TaskList &&
|
|
||||||
bLight == Other.bLight &&
|
|
||||||
bMaterials == Other.bMaterials &&
|
|
||||||
bRobotPosition == Other.bRobotPosition &&
|
|
||||||
bPets == Other.bPets &&
|
|
||||||
NumberOfPets.EqualTo(Other.NumberOfPets) &&
|
|
||||||
bPeople == Other.bPeople &&
|
|
||||||
NumberOfPeople.EqualTo(Other.NumberOfPeople) &&
|
|
||||||
bObjects == Other.bObjects &&
|
|
||||||
NumberOfObjects.EqualTo(Other.NumberOfObjects) &&
|
|
||||||
RandomMeshes == Other.RandomMeshes &&
|
|
||||||
bInfiniteCapture == Other.bInfiniteCapture &&
|
|
||||||
NumberOfCaptures.EqualTo(Other.NumberOfCaptures);
|
|
||||||
}
|
|
||||||
|
|
||||||
FCaptureSettingsData& operator=(const FCaptureSettingsData& Other)
|
|
||||||
{
|
|
||||||
if (this != &Other)
|
|
||||||
{
|
|
||||||
FolderName = Other.FolderName;
|
|
||||||
FileName = Other.FileName;
|
|
||||||
WritesPerSec = Other.WritesPerSec;
|
|
||||||
IsScenario = Other.IsScenario;
|
|
||||||
TaskList = Other.TaskList;
|
|
||||||
bLight = Other.bLight;
|
|
||||||
bMaterials = Other.bMaterials;
|
|
||||||
bRobotPosition = Other.bRobotPosition;
|
|
||||||
bPets = Other.bPets;
|
|
||||||
NumberOfPets = Other.NumberOfPets;
|
|
||||||
bPeople = Other.bPeople;
|
|
||||||
NumberOfPeople = Other.NumberOfPeople;
|
|
||||||
bObjects = Other.bObjects;
|
|
||||||
NumberOfObjects = Other.NumberOfObjects;
|
|
||||||
RandomMeshes = Other.RandomMeshes;
|
|
||||||
bInfiniteCapture = Other.bInfiniteCapture;
|
|
||||||
NumberOfCaptures = Other.NumberOfCaptures;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
USTRUCT(BlueprintType)
|
|
||||||
struct FAllGoalListData : public FTableRowBase
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
public:
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
EGoalType GoalType;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
FString Example;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
TSubclassOf<UUserWidget> Widget;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
|
||||||
bool bIsActive;
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user