Save and load inventory tests
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,6 +21,18 @@ const FInventoryContent& USlotInventoryComponent::GetContent() const
|
||||
return Content;
|
||||
}
|
||||
|
||||
void USlotInventoryComponent::SetContent(const FInventoryContent& NewContent)
|
||||
{
|
||||
if (NewContent.Slots.Num() != GetContentCapacity())
|
||||
{
|
||||
SetContentCapacity(NewContent.Slots.Num());
|
||||
}
|
||||
for (int32 SlotIndex = 0; SlotIndex < NewContent.Slots.Num(); SlotIndex++)
|
||||
{
|
||||
SetSlotValueAtIndex(SlotIndex, NewContent.Slots[SlotIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
int32 USlotInventoryComponent::GetContentCapacity() const
|
||||
{
|
||||
return Content.Slots.Num();
|
||||
|
||||
@@ -31,6 +31,9 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category = "Content")
|
||||
const FInventoryContent& GetContent() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Content")
|
||||
void SetContent(const FInventoryContent& NewContent);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Content|Capacity")
|
||||
int32 GetContentCapacity() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user