Added wardrobe

This commit is contained in:
2026-05-31 21:00:55 +03:00
parent 49310a992b
commit f94dce1bfb
39 changed files with 787 additions and 111 deletions
@@ -0,0 +1,48 @@
// © 2025 Naked People Team. All Rights Reserved.
#include "EquipmentSlotMenuWidget.h"
#include "Components/Button.h"
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Clothing/ClothingItemInstance.h"
#include "NakedDesire/Clothing/ClothingManager.h"
#include "NakedDesire/Inventory/InventorySubsystem.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
void UEquipmentSlotMenuWidget::Init(const EClothingSlotType InSlotType, const bool bInAtWardrobe)
{
SlotType = InSlotType;
bAtWardrobe = bInAtWardrobe;
}
void UEquipmentSlotMenuWidget::NativeConstruct()
{
Super::NativeConstruct();
Player = Cast<ANakedDesireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
RemoveClothingBtn->OnClicked.AddUniqueDynamic(this, &UEquipmentSlotMenuWidget::OnRemoveClothingClicked);
}
void UEquipmentSlotMenuWidget::OnRemoveClothingClicked()
{
if (Player && Player->ClothingManager)
{
if (bAtWardrobe)
{
// At the wardrobe the garment is stored, not dropped on the ground.
if (UClothingItemInstance* Equipped = Player->ClothingManager->GetSlotClothing(SlotType))
{
if (UInventorySubsystem* Inventory = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<UInventorySubsystem>())
Inventory->UnequipToWardrobe(Equipped);
}
}
else
{
Player->ClothingManager->DropClothing(SlotType);
}
}
OnActionPerformed.Broadcast();
}