Fix common ui input settings, equipment menu initialization order

This commit is contained in:
2026-05-27 20:52:56 +03:00
parent 7776083897
commit bc498d98a8
12 changed files with 27 additions and 31 deletions
@@ -4,12 +4,17 @@
#include "EquipmentPanelWidget.h"
#include "EquipmentSlotWidget.h"
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Clothing/ClothingManager.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
void UEquipmentPanelWidget::NativeConstruct()
{
Super::NativeConstruct();
InitSlotTypes();
const ANakedDesireCharacter* Player = Cast<ANakedDesireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
const TArray<UEquipmentSlotWidget*> AllSlots = {
NipplesSlot, AnalSlot, VaginaSlot,
@@ -20,11 +25,15 @@ void UEquipmentPanelWidget::NativeConstruct()
WristRestraintSlot, AnkleRestraintSlot, NeckRestraintSlot
};
for (UEquipmentSlotWidget* Slot : AllSlots)
for (UEquipmentSlotWidget* SlotWidget : AllSlots)
{
if (Slot)
if (SlotWidget)
{
Slot->OnEquipmentSlotClicked.BindUObject(this, &UEquipmentPanelWidget::HandleSlotClicked);
SlotWidget->OnEquipmentSlotClicked.BindUObject(this, &UEquipmentPanelWidget::HandleSlotClicked);
if (UClothingItemInstance* Item = Player->ClothingManager->GetSlotClothing(SlotWidget->GetSlotType()))
SlotWidget->SetItem(Item);
else
SlotWidget->ClearItem();
}
}
}
@@ -15,6 +15,7 @@ void UEquipmentSlotWidget::SetItem(UClothingItemInstance* InItem)
IconImage->SetBrushFromTexture(InItem->GetClothingItem()->Icon);
IconImage->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
PlaceholderImage->SetVisibility(ESlateVisibility::Hidden);
SetIsEnabled(true);
}
@@ -24,6 +25,7 @@ void UEquipmentSlotWidget::ClearItem()
IconImage->SetBrushFromTexture(nullptr);
IconImage->SetVisibility(ESlateVisibility::Hidden);
PlaceholderImage->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
SetIsEnabled(false);
}
@@ -81,9 +83,4 @@ void UEquipmentSlotWidget::NativeConstruct()
Player->ClothingManager->OnClothingEquip.AddUniqueDynamic(this, &UEquipmentSlotWidget::OnClothingEquip);
Player->ClothingManager->OnClothingUnequip.AddUniqueDynamic(this, &UEquipmentSlotWidget::OnClothingUnequip);
if (UClothingItemInstance* Item = Player->ClothingManager->GetSlotClothing(SlotType))
SetItem(Item);
else
ClearItem();
}
@@ -37,13 +37,6 @@ void UInventoryScreenWidget::NativeOnActivated()
CloseMenu();
}
void UInventoryScreenWidget::NativeOnDeactivated()
{
Super::NativeOnDeactivated();
CloseMenu();
}
void UInventoryScreenWidget::HandleSlotClicked(UEquipmentSlotWidget* SlotWidget)
{
if (!EquipmentSlotMenuWidget || !SlotWidget)
@@ -28,7 +28,6 @@ class NAKEDDESIRE_API UInventoryScreenWidget : public UCommonActivatableWidget
protected:
virtual void NativeOnActivated() override;
virtual void NativeOnDeactivated() override;
private:
void HandleSlotClicked(UEquipmentSlotWidget* SlotWidget);