Added ClothingItemInstance and cleanup the project
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
// © 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;
|
||||
};
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
|
||||
#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, float InMoney)
|
||||
UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame()
|
||||
{
|
||||
UGlobalSaveGameData* NewSave = Cast<UGlobalSaveGameData>(
|
||||
UGameplayStatics::CreateSaveGameObject(UGlobalSaveGameData::StaticClass())
|
||||
@@ -19,22 +16,22 @@ UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame(TArray<UClothingItem
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NewSave->Money = InMoney;
|
||||
// NewSave->Money = InMoney;
|
||||
|
||||
for (const UClothingItemData* Item : CurrentWardrobeClothing)
|
||||
{
|
||||
NewSave->WardrobeClothing.Add(Item->ToSaveData());
|
||||
}
|
||||
|
||||
for (const UClothingItemData* Item : CurrentPlayerClothing)
|
||||
{
|
||||
NewSave->PlayerClothing.Add(Item->ToSaveData());
|
||||
}
|
||||
// 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)
|
||||
UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame()
|
||||
{
|
||||
if (UGameplayStatics::DoesSaveGameExist(SLOT_NAME, SLOT_PLAYER))
|
||||
{
|
||||
@@ -44,10 +41,10 @@ UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame(UClothingList* De
|
||||
}
|
||||
|
||||
UGlobalSaveGameData* NewSave = nullptr;
|
||||
if (DefaultWardrobeClothing && DefaultPlayerClothing)
|
||||
{
|
||||
NewSave = CreateNewSaveGame(DefaultWardrobeClothing->ClothingItems, DefaultPlayerClothing->ClothingItems, STARTING_MONEY);
|
||||
}
|
||||
// if (DefaultWardrobeClothing && DefaultPlayerClothing)
|
||||
// {
|
||||
// NewSave = CreateNewSaveGame(DefaultWardrobeClothing->ClothingItems, DefaultPlayerClothing->ClothingItems, STARTING_MONEY);
|
||||
// }
|
||||
|
||||
if (NewSave)
|
||||
{
|
||||
@@ -57,13 +54,12 @@ UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame(UClothingList* De
|
||||
return NewSave;
|
||||
}
|
||||
|
||||
bool UGlobalSaveGameData::SaveGame(const TArray<UClothingItemData*> CurrentWardrobeClothing,
|
||||
const TArray<UClothingItemData*> CurrentPlayerClothing, int32 InMoney)
|
||||
bool UGlobalSaveGameData::SaveGame()
|
||||
{
|
||||
if (UGlobalSaveGameData* Save = CreateNewSaveGame(CurrentWardrobeClothing, CurrentPlayerClothing, (float)InMoney))
|
||||
{
|
||||
return UGameplayStatics::SaveGameToSlot(Save, SLOT_NAME, SLOT_PLAYER);
|
||||
}
|
||||
// if (UGlobalSaveGameData* Save = CreateNewSaveGame(CurrentWardrobeClothing, CurrentPlayerClothing, (float)InMoney))
|
||||
// {
|
||||
// return UGameplayStatics::SaveGameToSlot(Save, SLOT_NAME, SLOT_PLAYER);
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,11 @@
|
||||
#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
|
||||
{
|
||||
@@ -24,18 +20,12 @@ public:
|
||||
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);
|
||||
static UGlobalSaveGameData* LoadOrCreateSaveGame();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
static bool SaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing, int32 InMoney);
|
||||
static bool SaveGame();
|
||||
|
||||
private:
|
||||
static UGlobalSaveGameData* CreateNewSaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing, float InMoney);
|
||||
static UGlobalSaveGameData* CreateNewSaveGame();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user