Files

73 lines
2.0 KiB
C
Raw Permalink Normal View History

2023-08-28 03:38:23 +08:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CommonActivatableWidget.h"
#include "CommonMessagingSubsystem.h"
#include "CommonGameDialog.generated.h"
2025-07-15 00:36:32 +08:00
#define UE_API COMMONGAME_API
2023-08-28 03:38:23 +08:00
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);
}
};
2025-07-15 00:36:32 +08:00
UCLASS(MinimalAPI)
class UCommonGameDialogDescriptor : public UObject
2023-08-28 03:38:23 +08:00
{
GENERATED_BODY()
public:
2025-07-15 00:36:32 +08:00
static UE_API UCommonGameDialogDescriptor* CreateConfirmationOk(const FText& Header, const FText& Body);
static UE_API UCommonGameDialogDescriptor* CreateConfirmationOkCancel(const FText& Header, const FText& Body);
static UE_API UCommonGameDialogDescriptor* CreateConfirmationYesNo(const FText& Header, const FText& Body);
static UE_API UCommonGameDialogDescriptor* CreateConfirmationYesNoCancel(const FText& Header, const FText& Body);
2023-08-28 03:38:23 +08:00
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;
};
2025-07-15 00:36:32 +08:00
UCLASS(MinimalAPI, Abstract)
class UCommonGameDialog : public UCommonActivatableWidget
2023-08-28 03:38:23 +08:00
{
GENERATED_BODY()
public:
2025-07-15 00:36:32 +08:00
UE_API UCommonGameDialog();
2023-08-28 03:38:23 +08:00
2025-07-15 00:36:32 +08:00
UE_API virtual void SetupDialog(UCommonGameDialogDescriptor* Descriptor, FCommonMessagingResultDelegate ResultCallback);
2023-08-28 03:38:23 +08:00
2025-07-15 00:36:32 +08:00
UE_API virtual void KillDialog();
2023-08-28 03:38:23 +08:00
};
2025-07-15 00:36:32 +08:00
#undef UE_API