Setup player preview for equipment panel

This commit is contained in:
2026-05-31 15:33:43 +03:00
parent 4218b36ac9
commit 56cc2fce98
42 changed files with 823 additions and 318 deletions
+19
View File
@@ -2,3 +2,22 @@
#include "HUDWidget.h"
#include "Components/ProgressBar.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/Stats/StatsManager.h"
void UHUDWidget::NativeConstruct()
{
Super::NativeConstruct();
const ANakedDesireCharacter* Player = Cast<ANakedDesireCharacter>(GetOwningPlayerPawn());
if (!Player)
return;
Player->StatsManager->EmbarrassmentUpdate.AddUniqueDynamic(this, &UHUDWidget::OnEmbarrassmentUpdated);
}
void UHUDWidget::OnEmbarrassmentUpdated(float CurrentValue, float MaxValue)
{
EmbarrassmentBar->SetPercent(CurrentValue / MaxValue);
}
+12
View File
@@ -6,8 +6,20 @@
#include "CommonUserWidget.h"
#include "HUDWidget.generated.h"
class UProgressBar;
UCLASS(Abstract)
class NAKEDDESIRE_API UHUDWidget : public UCommonUserWidget
{
GENERATED_BODY()
UPROPERTY(meta = (BindWidget))
TObjectPtr<UProgressBar> EmbarrassmentBar;
protected:
virtual void NativeConstruct() override;
private:
UFUNCTION()
void OnEmbarrassmentUpdated(float CurrentValue, float MaxValue);
};
@@ -6,6 +6,7 @@
#include "EquipmentPanelWidget.h"
#include "EquipmentSlotMenuWidget.h"
#include "EquipmentSlotWidget.h"
#include "NakedDesire/Global/PlayerPreviewCaptureSubsystem.h"
void UInventoryScreenWidget::NativeOnActivated()
{
@@ -35,6 +36,22 @@ void UInventoryScreenWidget::NativeOnActivated()
}
CloseMenu();
// Spin up the impostor scene-capture preview only while this screen is open.
if (UPlayerPreviewCaptureSubsystem* Preview = GetWorld()->GetSubsystem<UPlayerPreviewCaptureSubsystem>())
{
Preview->SetPreviewActive(true);
}
}
void UInventoryScreenWidget::NativeOnDeactivated()
{
Super::NativeOnDeactivated();
if (UPlayerPreviewCaptureSubsystem* Preview = GetWorld()->GetSubsystem<UPlayerPreviewCaptureSubsystem>())
{
Preview->SetPreviewActive(false);
}
}
void UInventoryScreenWidget::HandleSlotClicked(UEquipmentSlotWidget* SlotWidget)
@@ -28,6 +28,7 @@ class NAKEDDESIRE_API UInventoryScreenWidget : public UCommonActivatableWidget
protected:
virtual void NativeOnActivated() override;
virtual void NativeOnDeactivated() override;
private:
void HandleSlotClicked(UEquipmentSlotWidget* SlotWidget);