@ -0,0 +1,6 @@
|
||||
#include "CSBlueprintAsyncActionBase.h"
|
||||
|
||||
void UCSBlueprintAsyncActionBase::Activate()
|
||||
{
|
||||
ReceiveActivate();
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Kismet/BlueprintAsyncActionBase.h"
|
||||
#include "CSBlueprintAsyncActionBase.generated.h"
|
||||
|
||||
UCLASS(Blueprintable, BlueprintType, Abstract)
|
||||
class UNREALSHARPCORE_API UCSBlueprintAsyncActionBase : public UBlueprintAsyncActionBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
// UBlueprintAsyncActionBase interface
|
||||
virtual void Activate() override;
|
||||
//~UBlueprintAsyncActionBase interface
|
||||
|
||||
protected:
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Activate"))
|
||||
void ReceiveActivate();
|
||||
|
||||
};
|
||||
@ -0,0 +1,24 @@
|
||||
#include "CSCancellableAsyncAction.h"
|
||||
|
||||
void UCSCancellableAsyncAction::Activate()
|
||||
{
|
||||
ReceiveActivate();
|
||||
|
||||
#if WITH_EDITOR
|
||||
FEditorDelegates::PrePIEEnded.AddWeakLambda(this, [this](bool)
|
||||
{
|
||||
Cancel();
|
||||
FEditorDelegates::PrePIEEnded.RemoveAll(this);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void UCSCancellableAsyncAction::Cancel()
|
||||
{
|
||||
if (HasAnyFlags(RF_ClassDefaultObject | RF_ArchetypeObject) || !IsValid(this) || IsUnreachable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ReceiveCancel();
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/CancellableAsyncAction.h"
|
||||
#include "CSCancellableAsyncAction.generated.h"
|
||||
|
||||
UCLASS(Blueprintable, BlueprintType, Abstract)
|
||||
class UNREALSHARPCORE_API UCSCancellableAsyncAction : public UCancellableAsyncAction
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
// Start UCancellableAsyncAction Functions
|
||||
virtual void Activate() override;
|
||||
virtual void Cancel() override;
|
||||
// End UCancellableAsyncAction Functions
|
||||
|
||||
protected:
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Activate"))
|
||||
void ReceiveActivate();
|
||||
|
||||
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Cancel"))
|
||||
void ReceiveCancel();
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user