Save and load inventory tests
This commit is contained in:
@@ -44,16 +44,6 @@
|
||||
{
|
||||
"Name": "FunctionalTestingEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "RestartEditor",
|
||||
"Enabled": true,
|
||||
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/a00eb1e478ae4a8fb655aa22f9125b07"
|
||||
},
|
||||
{
|
||||
"Name": "BlueprintAssist",
|
||||
"Enabled": true,
|
||||
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/content/9e895371fa3a471c87337860d6f341ff"
|
||||
}
|
||||
]
|
||||
}
|
||||
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