Finished phase 1
This commit is contained in:
@@ -23,8 +23,8 @@ bSupportsTouch=False
|
|||||||
bSupportsGamepad=True
|
bSupportsGamepad=True
|
||||||
DefaultGamepadName=Generic
|
DefaultGamepadName=Generic
|
||||||
bCanChangeGamepadType=True
|
bCanChangeGamepadType=True
|
||||||
+ControllerData=/Game/Input/KeyboardControllerData.KeyboardControllerData_C
|
+ControllerData=/Game/Input/CommonUI/GamepadControllerData.GamepadControllerData_C
|
||||||
+ControllerData=/Game/Input/GamepadControllerData.GamepadControllerData_C
|
+ControllerData=/Game/Input/CommonUI/KeyboardControllerData.KeyboardControllerData_C
|
||||||
|
|
||||||
[/Script/UnrealEd.ProjectPackagingSettings]
|
[/Script/UnrealEd.ProjectPackagingSettings]
|
||||||
Build=IfProjectHasCode
|
Build=IfProjectHasCode
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ bool UClothingManager::IsBodyPartExposed(const EBodyPart BodyPart)
|
|||||||
void UClothingManager::HydrateClothing()
|
void UClothingManager::HydrateClothing()
|
||||||
{
|
{
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
for (const FItemSaveRecord& ItemSaveRecord : SaveSubsystem->GetCurrentSave()->EquippedItems)
|
for (const FItemSaveRecord& ItemSaveRecord : SaveSubsystem->GetCurrentSave()->GetEquippedItems())
|
||||||
{
|
{
|
||||||
UClothingItemInstance* ClothingItemInstance = UClothingItemInstance::CreateFromSave(this, ItemSaveRecord);
|
UClothingItemInstance* ClothingItemInstance = UClothingItemInstance::CreateFromSave(this, ItemSaveRecord);
|
||||||
PutOnClothing(ClothingItemInstance);
|
PutOnClothing(ClothingItemInstance);
|
||||||
@@ -125,10 +125,7 @@ void UClothingManager::SpawnClothingPickup(UClothingItemInstance* ItemInstance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
FItemSaveRecord ItemSaveRecord;
|
SaveSubsystem->GetCurrentSave()->AddWorldItem(ItemInstance, NewItemPickup->GetActorTransform());
|
||||||
ItemSaveRecord.Init(ItemInstance);
|
|
||||||
ItemSaveRecord.WorldTransform = NewItemPickup->GetActorTransform();
|
|
||||||
SaveSubsystem->GetCurrentSave()->WorldItems.Push(ItemSaveRecord);
|
|
||||||
|
|
||||||
NewItemPickup->SetItem(ItemInstance);
|
NewItemPickup->SetItem(ItemInstance);
|
||||||
}
|
}
|
||||||
@@ -186,29 +183,17 @@ void UClothingManager::TakeClothing(UClothingItemInstance* ClothingItemInstance)
|
|||||||
SetClothingSlotItem(SlotType, ClothingItemInstance);
|
SetClothingSlotItem(SlotType, ClothingItemInstance);
|
||||||
|
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
FItemSaveRecord ItemSaveRecord;
|
SaveSubsystem->GetCurrentSave()->AddEquippedItem(ClothingItemInstance);
|
||||||
ItemSaveRecord.Init(ClothingItemInstance);
|
|
||||||
|
|
||||||
SaveSubsystem->GetCurrentSave()->EquippedItems.Push(ItemSaveRecord);
|
|
||||||
|
|
||||||
PutOnClothing(ClothingItemInstance);
|
PutOnClothing(ClothingItemInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
UClothingItemInstance* UClothingManager::RemoveClothing(const EClothingSlotType ClothingSlotType)
|
UClothingItemInstance* UClothingManager::RemoveClothing(const EClothingSlotType ClothingSlotType)
|
||||||
{
|
{
|
||||||
TObjectPtr<UClothingItemInstance>* ExistingItemRef = EquippedClothing.Find(ClothingSlotType);
|
if (!EquippedClothing.Contains(ClothingSlotType))
|
||||||
if (!ExistingItemRef)
|
|
||||||
{
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::RemoveClothing ExistingItemRef == nullptr"));
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
UClothingItemInstance* ExistingItem = *ExistingItemRef;
|
UClothingItemInstance* ExistingItem = EquippedClothing[ClothingSlotType];
|
||||||
if (!ExistingItem)
|
|
||||||
{
|
|
||||||
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::RemoveClothing ExistingItem == nullptr"));
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetClothingSlotItem(ClothingSlotType, nullptr);
|
SetClothingSlotItem(ClothingSlotType, nullptr);
|
||||||
|
|
||||||
@@ -223,10 +208,7 @@ UClothingItemInstance* UClothingManager::RemoveClothing(const EClothingSlotType
|
|||||||
OnClothingUnequip.Broadcast(ExistingItem);
|
OnClothingUnequip.Broadcast(ExistingItem);
|
||||||
|
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
SaveSubsystem->GetCurrentSave()->EquippedItems.RemoveAll([ExistingItem](const FItemSaveRecord& Item)
|
SaveSubsystem->GetCurrentSave()->RemoveEquippedItem(ExistingItem);
|
||||||
{
|
|
||||||
return Item.InstanceId == ExistingItem->GetInstanceId();
|
|
||||||
});
|
|
||||||
|
|
||||||
return ExistingItem;
|
return ExistingItem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void ANakedDesireGameMode::BeginPlay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
for (const auto& Item : SaveSubsystem->GetCurrentSave()->WorldItems)
|
for (const auto& Item : SaveSubsystem->GetCurrentSave()->GetWorldItems())
|
||||||
{
|
{
|
||||||
UClothingItemInstance* NewItemInstance = NewObject<UClothingItemInstance>(this);
|
UClothingItemInstance* NewItemInstance = NewObject<UClothingItemInstance>(this);
|
||||||
NewItemInstance->Init(Item.Definition.Get());
|
NewItemInstance->Init(Item.Definition.Get());
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||||
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
|
|
||||||
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
||||||
|
|
||||||
AItemPickup::AItemPickup()
|
AItemPickup::AItemPickup()
|
||||||
@@ -33,10 +32,7 @@ void AItemPickup::Interact_Implementation(ANakedDesireCharacter* Player)
|
|||||||
{
|
{
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
Player->ClothingManager->TakeClothing(ClothingItemInstance);
|
Player->ClothingManager->TakeClothing(ClothingItemInstance);
|
||||||
SaveSubsystem->GetCurrentSave()->WorldItems.RemoveAll([this](const FItemSaveRecord& Item)
|
SaveSubsystem->GetCurrentSave()->RemoveWorldItem(ClothingItemInstance);
|
||||||
{
|
|
||||||
return ClothingItemInstance->GetInstanceId() == Item.InstanceId;
|
|
||||||
});
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,22 +10,14 @@
|
|||||||
void AWardrobe::AddItem(UClothingItemInstance* ClothingItemInstance)
|
void AWardrobe::AddItem(UClothingItemInstance* ClothingItemInstance)
|
||||||
{
|
{
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
|
SaveSubsystem->GetCurrentSave()->AddWardrobeItem(ClothingItemInstance);
|
||||||
ClothingItems.Push(ClothingItemInstance);
|
|
||||||
FItemSaveRecord ItemSaveRecord;
|
|
||||||
ItemSaveRecord.Init(ClothingItemInstance);
|
|
||||||
|
|
||||||
SaveSubsystem->GetCurrentSave()->WardrobeItems.Push(ItemSaveRecord);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWardrobe::RemoveItem(UClothingItemInstance* ClothingItemInstance) const
|
void AWardrobe::RemoveItem(UClothingItemInstance* ClothingItemInstance) const
|
||||||
{
|
{
|
||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
|
|
||||||
SaveSubsystem->GetCurrentSave()->WardrobeItems.RemoveAll([ClothingItemInstance](const FItemSaveRecord& Item)
|
SaveSubsystem->GetCurrentSave()->RemoveWardrobeItem(ClothingItemInstance);
|
||||||
{
|
|
||||||
return Item.InstanceId == ClothingItemInstance->GetInstanceId();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWardrobe::BeginPlay()
|
void AWardrobe::BeginPlay()
|
||||||
@@ -35,7 +27,7 @@ void AWardrobe::BeginPlay()
|
|||||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||||
UGlobalSaveGameData* SaveGame = SaveSubsystem->GetCurrentSave();
|
UGlobalSaveGameData* SaveGame = SaveSubsystem->GetCurrentSave();
|
||||||
|
|
||||||
for (const FItemSaveRecord& ItemSaveRecord : SaveGame->WardrobeItems)
|
for (const FItemSaveRecord& ItemSaveRecord : SaveGame->GetWardrobeItems())
|
||||||
{
|
{
|
||||||
UClothingItemInstance* NewItemInstance = UClothingItemInstance::CreateFromSave(this, ItemSaveRecord);
|
UClothingItemInstance* NewItemInstance = UClothingItemInstance::CreateFromSave(this, ItemSaveRecord);
|
||||||
ClothingItems.Push(NewItemInstance);
|
ClothingItems.Push(NewItemInstance);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ void UMissionsManager::BeginPlay()
|
|||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
Player = Cast<ANakedDesireCharacter>(GetOwner());
|
Player = Cast<ANakedDesireCharacter>(GetOwner());
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Player is NULL %s"), Player == nullptr ? TEXT("True") : TEXT("False"));
|
|
||||||
|
|
||||||
for (const auto& Mission : AvailableMissions)
|
for (const auto& Mission : AvailableMissions)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -219,6 +219,12 @@ bool ANakedDesireCharacter::CheckSight(const FVector& StartLocation, const FVect
|
|||||||
return bHit;
|
return bHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ANakedDesireCharacter::LogTest()
|
||||||
|
{
|
||||||
|
UClothingItemInstance* ClothingItemInstance = ClothingManager->GetSlotClothing(EClothingSlotType::UnderwearTop);
|
||||||
|
UE_LOG(LogTemp, Warning, TEXT("ANakedDesireCharacter::LogTest %s"), *ClothingItemInstance->GetInstanceId().ToString());
|
||||||
|
}
|
||||||
|
|
||||||
void ANakedDesireCharacter::OnClothingEquip(UClothingItemInstance* ClothingItemInstance)
|
void ANakedDesireCharacter::OnClothingEquip(UClothingItemInstance* ClothingItemInstance)
|
||||||
{
|
{
|
||||||
if (ClothingItemInstance->GetClothingItem()->HiddenBodyParts.Contains(EBodyPart::Ass))
|
if (ClothingItemInstance->GetClothingItem()->HiddenBodyParts.Contains(EBodyPart::Ass))
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ private:
|
|||||||
|
|
||||||
bool CheckSight(const FVector& StartLocation, const FVector& EndLocation, FHitResult& HitResult, const AActor* IgnoreActor);
|
bool CheckSight(const FVector& StartLocation, const FVector& EndLocation, FHitResult& HitResult, const AActor* IgnoreActor);
|
||||||
|
|
||||||
|
UFUNCTION(Exec)
|
||||||
|
void LogTest();
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TObjectPtr<ANakedDesireHUD> HUD;
|
TObjectPtr<ANakedDesireHUD> HUD;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "GlobalSaveGameData.h"
|
#include "GlobalSaveGameData.h"
|
||||||
|
|
||||||
|
#include "ItemSaveRecord.h"
|
||||||
#include "NakedDesire/Global/Constants.h"
|
#include "NakedDesire/Global/Constants.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
@@ -29,4 +31,102 @@ UGlobalSaveGameData* UGlobalSaveGameData::LoadGame(const FString& SlotName)
|
|||||||
bool UGlobalSaveGameData::SaveGame(UGlobalSaveGameData* SaveGameData, const FString& SlotName)
|
bool UGlobalSaveGameData::SaveGame(UGlobalSaveGameData* SaveGameData, const FString& SlotName)
|
||||||
{
|
{
|
||||||
return UGameplayStatics::SaveGameToSlot(SaveGameData, SlotName, SLOT_PLAYER);
|
return UGameplayStatics::SaveGameToSlot(SaveGameData, SlotName, SLOT_PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FItemSaveRecord UGlobalSaveGameData::AddWardrobeItem(const UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
FItemSaveRecord NewSaveRecord;
|
||||||
|
NewSaveRecord.Init(ItemInstance);
|
||||||
|
WardrobeItems.Push(NewSaveRecord);
|
||||||
|
return NewSaveRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UGlobalSaveGameData::UpdateWardrobeItem(UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
for (auto& ItemSaveRecord : WardrobeItems)
|
||||||
|
{
|
||||||
|
if (ItemSaveRecord.InstanceId == ItemInstance->GetInstanceId())
|
||||||
|
{
|
||||||
|
ItemSaveRecord.Init(ItemInstance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UGlobalSaveGameData::RemoveWardrobeItem(UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
const int32 RemovedElementsCount = WardrobeItems.RemoveAll([ItemInstance](const FItemSaveRecord& Item)
|
||||||
|
{
|
||||||
|
return Item.InstanceId == ItemInstance->GetInstanceId();
|
||||||
|
});
|
||||||
|
|
||||||
|
return RemovedElementsCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FItemSaveRecord UGlobalSaveGameData::AddEquippedItem(const UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
FItemSaveRecord NewSaveRecord;
|
||||||
|
NewSaveRecord.Init(ItemInstance);
|
||||||
|
EquippedItems.Push(NewSaveRecord);
|
||||||
|
return NewSaveRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UGlobalSaveGameData::UpdateEquippedItem(UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
for (auto& ItemSaveRecord : EquippedItems)
|
||||||
|
{
|
||||||
|
if (ItemSaveRecord.InstanceId == ItemInstance->GetInstanceId())
|
||||||
|
{
|
||||||
|
ItemSaveRecord.Init(ItemInstance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UGlobalSaveGameData::RemoveEquippedItem(UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
const int32 RemovedElementsCount = EquippedItems.RemoveAll([ItemInstance](const FItemSaveRecord& Item)
|
||||||
|
{
|
||||||
|
return Item.InstanceId == ItemInstance->GetInstanceId();
|
||||||
|
});
|
||||||
|
|
||||||
|
return RemovedElementsCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FItemSaveRecord UGlobalSaveGameData::AddWorldItem(const UClothingItemInstance* ItemInstance, FTransform Transform)
|
||||||
|
{
|
||||||
|
FItemSaveRecord NewSaveRecord;
|
||||||
|
NewSaveRecord.Init(ItemInstance);
|
||||||
|
NewSaveRecord.WorldTransform = Transform;
|
||||||
|
WorldItems.Push(NewSaveRecord);
|
||||||
|
return NewSaveRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UGlobalSaveGameData::UpdateWorldItem(UClothingItemInstance* ItemInstance, FTransform Transform)
|
||||||
|
{
|
||||||
|
for (auto& ItemSaveRecord : WorldItems)
|
||||||
|
{
|
||||||
|
if (ItemSaveRecord.InstanceId == ItemInstance->GetInstanceId())
|
||||||
|
{
|
||||||
|
ItemSaveRecord.Init(ItemInstance);
|
||||||
|
ItemSaveRecord.WorldTransform = Transform;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UGlobalSaveGameData::RemoveWorldItem(UClothingItemInstance* ItemInstance)
|
||||||
|
{
|
||||||
|
const int32 RemovedElementsCount = WorldItems.RemoveAll([ItemInstance](const FItemSaveRecord& Item)
|
||||||
|
{
|
||||||
|
return Item.InstanceId == ItemInstance->GetInstanceId();
|
||||||
|
});
|
||||||
|
|
||||||
|
return RemovedElementsCount > 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,9 +5,10 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "GameFramework/SaveGame.h"
|
#include "GameFramework/SaveGame.h"
|
||||||
#include "NakedDesire/Global/Constants.h"
|
#include "NakedDesire/Global/Constants.h"
|
||||||
|
#include "ItemSaveRecord.h"
|
||||||
#include "GlobalSaveGameData.generated.h"
|
#include "GlobalSaveGameData.generated.h"
|
||||||
|
|
||||||
struct FItemSaveRecord;
|
class UClothingItemInstance;
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class NAKEDDESIRE_API UGlobalSaveGameData : public USaveGame
|
class NAKEDDESIRE_API UGlobalSaveGameData : public USaveGame
|
||||||
@@ -24,19 +25,35 @@ public:
|
|||||||
|
|
||||||
UPROPERTY(SaveGame)
|
UPROPERTY(SaveGame)
|
||||||
float Money = 0;
|
float Money = 0;
|
||||||
|
|
||||||
UPROPERTY(SaveGame)
|
FItemSaveRecord AddWardrobeItem(const UClothingItemInstance* ItemInstance);
|
||||||
TArray<FItemSaveRecord> WardrobeItems;
|
bool UpdateWardrobeItem(UClothingItemInstance* ItemInstance);
|
||||||
|
bool RemoveWardrobeItem(UClothingItemInstance* ItemInstance);
|
||||||
UPROPERTY(SaveGame)
|
TArray<FItemSaveRecord> GetWardrobeItems() const { return WardrobeItems; }
|
||||||
TArray<FItemSaveRecord> EquippedItems;
|
|
||||||
|
FItemSaveRecord AddEquippedItem(const UClothingItemInstance* ItemInstance);
|
||||||
UPROPERTY(SaveGame)
|
bool UpdateEquippedItem(UClothingItemInstance* ItemInstance);
|
||||||
TArray<FItemSaveRecord> WorldItems;
|
bool RemoveEquippedItem(UClothingItemInstance* ItemInstance);
|
||||||
|
TArray<FItemSaveRecord> GetEquippedItems() const { return EquippedItems; }
|
||||||
|
|
||||||
|
FItemSaveRecord AddWorldItem(const UClothingItemInstance* ItemInstance, FTransform Transform);
|
||||||
|
bool UpdateWorldItem(UClothingItemInstance* ItemInstance, FTransform Transform);
|
||||||
|
bool RemoveWorldItem(UClothingItemInstance* ItemInstance);
|
||||||
|
TArray<FItemSaveRecord> GetWorldItems() const { return WorldItems; }
|
||||||
|
|
||||||
UPROPERTY(SaveGame)
|
UPROPERTY(SaveGame)
|
||||||
int32 DaysPassed = 0;
|
int32 DaysPassed = 0;
|
||||||
|
|
||||||
UPROPERTY(SaveGame)
|
UPROPERTY(SaveGame)
|
||||||
float HourOfDay = 0.0f;
|
float HourOfDay = 0.0f;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY(SaveGame)
|
||||||
|
TArray<FItemSaveRecord> WardrobeItems;
|
||||||
|
|
||||||
|
UPROPERTY(SaveGame)
|
||||||
|
TArray<FItemSaveRecord> EquippedItems;
|
||||||
|
|
||||||
|
UPROPERTY(SaveGame)
|
||||||
|
TArray<FItemSaveRecord> WorldItems;
|
||||||
};
|
};
|
||||||
@@ -67,11 +67,9 @@ void USaveSubsystem::PopulateStartingData(UGlobalSaveGameData* Save) const
|
|||||||
if (!ClothingDef)
|
if (!ClothingDef)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// TODO: Refactor. Skip converting to ClothingItemInstance
|
||||||
UClothingItemInstance* Instance = NewObject<UClothingItemInstance>(Save);
|
UClothingItemInstance* Instance = NewObject<UClothingItemInstance>(Save);
|
||||||
Instance->Init(ClothingDef);
|
Instance->Init(ClothingDef);
|
||||||
|
Save->AddEquippedItem(Instance);
|
||||||
FItemSaveRecord Record;
|
|
||||||
Record.Init(Instance);
|
|
||||||
Save->EquippedItems.Add(Record);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user