// © 2025 Naked People Team. All Rights Reserved.


#include "EquipmentSlotMenuWidget.h"

#include "Components/Button.h"
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Clothing/ClothingManager.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"

void UEquipmentSlotMenuWidget::Init(const EClothingSlotType InSlotType)
{
	SlotType = InSlotType;
}

void UEquipmentSlotMenuWidget::NativeConstruct()
{
	Super::NativeConstruct();
	
	Player = Cast<ANakedDesireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
	
	DropClothingBtn->OnClicked.AddUniqueDynamic(this, &UEquipmentSlotMenuWidget::OnDropClothingClicked);
}

void UEquipmentSlotMenuWidget::OnDropClothingClicked()
{
	Player->ClothingManager->DropClothing(SlotType);
	OnActionPerformed.Broadcast();
}
