RealtimeStyleTransferRuntime/Source/LyraGame/UI/Weapons/HitMarkerConfirmationWidget...

43 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "HitMarkerConfirmationWidget.h"
#include "Blueprint/UserWidget.h"
#include "Components/SlateWrapperTypes.h"
#include "Containers/EnumAsByte.h"
#include "Engine/LocalPlayer.h"
#include "Misc/Attribute.h"
#include "SHitMarkerConfirmationWidget.h"
#include "Widgets/DeclarativeSyntaxSupport.h"
class SWidget;
UHitMarkerConfirmationWidget::UHitMarkerConfirmationWidget(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
SetVisibility(ESlateVisibility::HitTestInvisible);
bIsVolatile = true;
AnyHitsMarkerImage.DrawAs = ESlateBrushDrawType::NoDrawType;
}
void UHitMarkerConfirmationWidget::ReleaseSlateResources(bool bReleaseChildren)
{
Super::ReleaseSlateResources(bReleaseChildren);
MyMarkerWidget.Reset();
}
TSharedRef<SWidget> UHitMarkerConfirmationWidget::RebuildWidget()
{
UUserWidget* OuterUserWidget = GetTypedOuter<UUserWidget>();
FLocalPlayerContext DummyContext;
const FLocalPlayerContext& PlayerContextRef = (OuterUserWidget != nullptr) ? OuterUserWidget->GetPlayerContext() : DummyContext;
MyMarkerWidget = SNew(SHitMarkerConfirmationWidget, PlayerContextRef, PerHitMarkerZoneOverrideImages)
.PerHitMarkerImage(&(this->PerHitMarkerImage))
.AnyHitsMarkerImage(&(this->AnyHitsMarkerImage))
.HitNotifyDuration(this->HitNotifyDuration);
return MyMarkerWidget.ToSharedRef();
}