Moved all code to C++.
This commit is contained in:
parent
75ae7a10d6
commit
a78d861a7a
@ -3,15 +3,33 @@
|
||||
#include "LoadingScreenWidget.h"
|
||||
|
||||
|
||||
void ULoadingScreenWidget::NativePreConstruct()
|
||||
{
|
||||
FWidgetAnimationDynamicEvent LoadScreenOpened;
|
||||
LoadScreenOpened.BindUFunction(this, TEXT("LoadScreenOpened"));
|
||||
this->BindToAnimationFinished(this->Fade, LoadScreenOpened);
|
||||
|
||||
this->PlayAnimationForward(this->Fade);
|
||||
}
|
||||
void ULoadingScreenWidget::LoadScreenOpened()
|
||||
{
|
||||
this->UnbindAllFromAnimationFinished(this->Fade);
|
||||
#if !WITH_EDITOR
|
||||
this->OnLoadScreenOpened.ExecuteIfBound();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ULoadingScreenWidget::BeginFadeOut_Implementation()
|
||||
{
|
||||
FWidgetAnimationDynamicEvent LoadScreenClosed;
|
||||
LoadScreenClosed.BindUFunction(this, TEXT("LoadScreenClosed"));
|
||||
this->BindToAnimationFinished(this->Fade, LoadScreenClosed);
|
||||
|
||||
this->PlayAnimationReverse(this->Fade);
|
||||
}
|
||||
void ULoadingScreenWidget::LoadScreenClosed()
|
||||
{
|
||||
this->UnbindAllFromAnimationFinished(this->Fade);
|
||||
#if !WITH_EDITOR
|
||||
this->OnLoadScreenClosed.ExecuteIfBound();
|
||||
#endif
|
||||
|
||||
@ -18,15 +18,21 @@ class COMMONLOADINGSCREEN_API ULoadingScreenWidget : public UUserWidget
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual void NativePreConstruct() override;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void LoadScreenOpened();
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void LoadScreenClosed();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
UFUNCTION(BlueprintNativeEvent)
|
||||
void BeginFadeOut();
|
||||
|
||||
DECLARE_DELEGATE(FOnLoadScreenEvent)
|
||||
FOnLoadScreenEvent OnLoadScreenOpened;
|
||||
FOnLoadScreenEvent OnLoadScreenClosed;
|
||||
|
||||
protected:
|
||||
UPROPERTY(Transient, BlueprintReadOnly, meta=(BindWidgetAnim))
|
||||
TObjectPtr<UWidgetAnimation> Fade;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user