搬了lyra的hudlayout
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CommonActivatableWidget.h"
|
||||
#include "CommonMessagingSubsystem.h"
|
||||
|
||||
#include "CommonGameDialog.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FConfirmationDialogAction
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
/** Required: The dialog option to provide. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ECommonMessagingResult Result = ECommonMessagingResult::Unknown;
|
||||
|
||||
/** Optional: Display Text to use instead of the action name associated with the result. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText OptionalDisplayText;
|
||||
|
||||
bool operator==(const FConfirmationDialogAction& Other) const
|
||||
{
|
||||
return Result == Other.Result &&
|
||||
OptionalDisplayText.EqualTo(Other.OptionalDisplayText);
|
||||
}
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
class COMMONGAME_API UCommonGameDialogDescriptor : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
static UCommonGameDialogDescriptor* CreateConfirmationOk(const FText& Header, const FText& Body);
|
||||
static UCommonGameDialogDescriptor* CreateConfirmationOkCancel(const FText& Header, const FText& Body);
|
||||
static UCommonGameDialogDescriptor* CreateConfirmationYesNo(const FText& Header, const FText& Body);
|
||||
static UCommonGameDialogDescriptor* CreateConfirmationYesNoCancel(const FText& Header, const FText& Body);
|
||||
|
||||
public:
|
||||
/** The header of the message to display */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText Header;
|
||||
|
||||
/** The body of the message to display */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText Body;
|
||||
|
||||
/** The confirm button's input action to use. */
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TArray<FConfirmationDialogAction> ButtonActions;
|
||||
};
|
||||
|
||||
|
||||
UCLASS(Abstract)
|
||||
class COMMONGAME_API UCommonGameDialog : public UCommonActivatableWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCommonGameDialog();
|
||||
|
||||
virtual void SetupDialog(UCommonGameDialogDescriptor* Descriptor, FCommonMessagingResultDelegate ResultCallback);
|
||||
|
||||
virtual void KillDialog();
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Subsystems/LocalPlayerSubsystem.h"
|
||||
|
||||
#include "CommonMessagingSubsystem.generated.h"
|
||||
|
||||
class FSubsystemCollectionBase;
|
||||
class UCommonGameDialogDescriptor;
|
||||
class UObject;
|
||||
|
||||
/** Possible results from a dialog */
|
||||
UENUM(BlueprintType)
|
||||
enum class ECommonMessagingResult : uint8
|
||||
{
|
||||
/** The "yes" button was pressed */
|
||||
Confirmed,
|
||||
/** The "no" button was pressed */
|
||||
Declined,
|
||||
/** The "ignore/cancel" button was pressed */
|
||||
Cancelled,
|
||||
/** The dialog was explicitly killed (no user input) */
|
||||
Killed,
|
||||
Unknown UMETA(Hidden)
|
||||
};
|
||||
|
||||
DECLARE_DELEGATE_OneParam(FCommonMessagingResultDelegate, ECommonMessagingResult /* Result */);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS(config = Game)
|
||||
class COMMONGAME_API UCommonMessagingSubsystem : public ULocalPlayerSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UCommonMessagingSubsystem() { }
|
||||
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||
virtual void Deinitialize() override;
|
||||
virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
|
||||
|
||||
virtual void ShowConfirmation(UCommonGameDialogDescriptor* DialogDescriptor, FCommonMessagingResultDelegate ResultCallback = FCommonMessagingResultDelegate());
|
||||
virtual void ShowError(UCommonGameDialogDescriptor* DialogDescriptor, FCommonMessagingResultDelegate ResultCallback = FCommonMessagingResultDelegate());
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user