搬了lyra的hudlayout
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/CancellableAsyncAction.h"
|
||||
#include "UObject/SoftObjectPtr.h"
|
||||
|
||||
#include "AsyncAction_CreateWidgetAsync.generated.h"
|
||||
|
||||
class APlayerController;
|
||||
class UGameInstance;
|
||||
class UUserWidget;
|
||||
class UWorld;
|
||||
struct FFrame;
|
||||
struct FStreamableHandle;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCreateWidgetAsyncDelegate, UUserWidget*, UserWidget);
|
||||
|
||||
/**
|
||||
* Load the widget class asynchronously, the instance the widget after the loading completes, and return it on OnComplete.
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class COMMONGAME_API UAsyncAction_CreateWidgetAsync : public UCancellableAsyncAction
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
public:
|
||||
virtual void Cancel() override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintCosmetic, meta=(WorldContext = "WorldContextObject", BlueprintInternalUseOnly="true"))
|
||||
static UAsyncAction_CreateWidgetAsync* CreateWidgetAsync(UObject* WorldContextObject, TSoftClassPtr<UUserWidget> UserWidgetSoftClass, APlayerController* OwningPlayer, bool bSuspendInputUntilComplete = true);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FCreateWidgetAsyncDelegate OnComplete;
|
||||
|
||||
private:
|
||||
|
||||
void OnWidgetLoaded();
|
||||
|
||||
FName SuspendInputToken;
|
||||
TWeakObjectPtr<APlayerController> OwningPlayer;
|
||||
TWeakObjectPtr<UWorld> World;
|
||||
TWeakObjectPtr<UGameInstance> GameInstance;
|
||||
bool bSuspendInputUntilComplete;
|
||||
TSoftClassPtr<UUserWidget> UserWidgetSoftClass;
|
||||
TSharedPtr<FStreamableHandle> StreamingHandle;
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/CancellableAsyncAction.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "UObject/SoftObjectPtr.h"
|
||||
|
||||
#include "AsyncAction_PushContentToLayerForPlayer.generated.h"
|
||||
|
||||
class APlayerController;
|
||||
class UCommonActivatableWidget;
|
||||
class UObject;
|
||||
struct FFrame;
|
||||
struct FStreamableHandle;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPushContentToLayerForPlayerAsyncDelegate, UCommonActivatableWidget*, UserWidget);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS(BlueprintType)
|
||||
class COMMONGAME_API UAsyncAction_PushContentToLayerForPlayer : public UCancellableAsyncAction
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
public:
|
||||
virtual void Cancel() override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintCosmetic, meta=(WorldContext = "WorldContextObject", BlueprintInternalUseOnly="true"))
|
||||
static UAsyncAction_PushContentToLayerForPlayer* PushContentToLayerForPlayer(APlayerController* OwningPlayer, UPARAM(meta = (AllowAbstract=false)) TSoftClassPtr<UCommonActivatableWidget> WidgetClass, UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerName, bool bSuspendInputUntilComplete = true);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FPushContentToLayerForPlayerAsyncDelegate BeforePush;
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FPushContentToLayerForPlayerAsyncDelegate AfterPush;
|
||||
|
||||
private:
|
||||
|
||||
FGameplayTag LayerName;
|
||||
bool bSuspendInputUntilComplete = false;
|
||||
TWeakObjectPtr<APlayerController> OwningPlayerPtr;
|
||||
TSoftClassPtr<UCommonActivatableWidget> WidgetClass;
|
||||
|
||||
TSharedPtr<FStreamableHandle> StreamingHandle;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Kismet/BlueprintAsyncActionBase.h"
|
||||
|
||||
#include "UObject/ObjectPtr.h"
|
||||
#include "AsyncAction_ShowConfirmation.generated.h"
|
||||
|
||||
enum class ECommonMessagingResult : uint8;
|
||||
|
||||
class FText;
|
||||
class UCommonGameDialogDescriptor;
|
||||
class ULocalPlayer;
|
||||
struct FFrame;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FCommonMessagingResultMCDelegate, ECommonMessagingResult, Result);
|
||||
|
||||
/**
|
||||
* Allows easily triggering an async confirmation dialog in blueprints that you can then wait on the result.
|
||||
*/
|
||||
UCLASS()
|
||||
class UAsyncAction_ShowConfirmation : public UBlueprintAsyncActionBase
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable, BlueprintCosmetic, meta = (BlueprintInternalUseOnly = "true", WorldContext = "InWorldContextObject"))
|
||||
static UAsyncAction_ShowConfirmation* ShowConfirmationYesNo(
|
||||
UObject* InWorldContextObject, FText Title, FText Message
|
||||
);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintCosmetic, meta = (BlueprintInternalUseOnly = "true", WorldContext = "InWorldContextObject"))
|
||||
static UAsyncAction_ShowConfirmation* ShowConfirmationOkCancel(
|
||||
UObject* InWorldContextObject, FText Title, FText Message
|
||||
);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintCosmetic, meta = (BlueprintInternalUseOnly = "true", WorldContext = "InWorldContextObject"))
|
||||
static UAsyncAction_ShowConfirmation* ShowConfirmationCustom(
|
||||
UObject* InWorldContextObject, UCommonGameDialogDescriptor* Descriptor
|
||||
);
|
||||
|
||||
virtual void Activate() override;
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FCommonMessagingResultMCDelegate OnResult;
|
||||
|
||||
private:
|
||||
void HandleConfirmationResult(ECommonMessagingResult ConfirmationResult);
|
||||
|
||||
UPROPERTY(Transient)
|
||||
TObjectPtr<UObject> WorldContextObject;
|
||||
|
||||
UPROPERTY(Transient)
|
||||
TObjectPtr<ULocalPlayer> TargetLocalPlayer;
|
||||
|
||||
UPROPERTY(Transient)
|
||||
TObjectPtr<UCommonGameDialogDescriptor> Descriptor;
|
||||
};
|
||||
Reference in New Issue
Block a user