This commit is contained in:
2026-05-17 22:44:49 +03:00
commit 26fedadcd8
9071 changed files with 44364 additions and 0 deletions
@@ -0,0 +1,20 @@
// © 2025 Naked People Team. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "ClothingItemSaveData.generated.h"
class UClothingItem;
/**
*
*/
USTRUCT(BlueprintType)
struct FClothingItemSaveData
{
GENERATED_BODY()
UPROPERTY()
TSoftObjectPtr<UClothingItem> ClothingItem;
};
@@ -0,0 +1,67 @@
// © 2025 Naked People Team. All Rights Reserved.
#include "GlobalSaveGameData.h"
#include "NakedDesire/Global/Constants.h"
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Clothing/ClothingItemData.h"
#include "NakedDesire/Clothing/ClothingList.h"
UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing)
{
UGlobalSaveGameData* NewSave = Cast<UGlobalSaveGameData>(
UGameplayStatics::CreateSaveGameObject(UGlobalSaveGameData::StaticClass())
);
if (!NewSave)
{
return nullptr;
}
for (const UClothingItemData* Item : CurrentWardrobeClothing)
{
NewSave->WardrobeClothing.Add(Item->ToSaveData());
}
for (const UClothingItemData* Item : CurrentPlayerClothing)
{
NewSave->PlayerClothing.Add(Item->ToSaveData());
}
return NewSave;
}
UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame(UClothingList* DefaultPlayerClothing, UClothingList* DefaultWardrobeClothing)
{
if (UGameplayStatics::DoesSaveGameExist(SLOT_NAME, SLOT_PLAYER))
{
return Cast<UGlobalSaveGameData>(
UGameplayStatics::LoadGameFromSlot(SLOT_NAME, SLOT_PLAYER)
);
}
UGlobalSaveGameData* NewSave = nullptr;
if (DefaultWardrobeClothing && DefaultPlayerClothing)
{
NewSave = CreateNewSaveGame(DefaultWardrobeClothing->ClothingItems, DefaultPlayerClothing->ClothingItems);
}
if (NewSave)
{
UGameplayStatics::SaveGameToSlot(NewSave, SLOT_NAME, SLOT_PLAYER);
}
return NewSave;
}
bool UGlobalSaveGameData::SaveGame(const TArray<UClothingItemData*> CurrentWardrobeClothing,
const TArray<UClothingItemData*> CurrentPlayerClothing)
{
if (UGlobalSaveGameData* SaveGame = CreateNewSaveGame(CurrentWardrobeClothing, CurrentPlayerClothing))
{
return UGameplayStatics::SaveGameToSlot(SaveGame, SLOT_NAME, SLOT_PLAYER);
}
return false;
}
@@ -0,0 +1,41 @@
// © 2025 Naked People Team. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ClothingItemSaveData.h"
#include "GameFramework/SaveGame.h"
#include "GlobalSaveGameData.generated.h"
class UClothingList;
class UClothingItemData;
/**
*
*/
UCLASS()
class NAKEDDESIRE_API UGlobalSaveGameData : public USaveGame
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, SaveGame)
bool HaveSeenTutorial = false;
UPROPERTY(BlueprintReadWrite, SaveGame)
float Money = 0;
UPROPERTY(BlueprintReadWrite)
TArray<FClothingItemSaveData> WardrobeClothing;
UPROPERTY(BlueprintReadWrite)
TArray<FClothingItemSaveData> PlayerClothing;
UFUNCTION(BlueprintCallable)
static UGlobalSaveGameData* LoadOrCreateSaveGame(UClothingList* DefaultPlayerClothing, UClothingList* DefaultWardrobeClothing);
UFUNCTION(BlueprintCallable)
static bool SaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing);
private:
static UGlobalSaveGameData* CreateNewSaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing);
};