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