105 lines
2.7 KiB
C++
105 lines
2.7 KiB
C++
// Project Lab - NHTV Igad
|
|
|
|
#pragma once
|
|
#include "MenuScreenBase.h"
|
|
#include "ScreenOverlay.generated.h"
|
|
|
|
UENUM(BlueprintType)
|
|
enum class EMessageBoxType : uint8
|
|
{
|
|
Ok,
|
|
OkCancel,
|
|
YesNo
|
|
};
|
|
|
|
UCLASS()
|
|
class UOverlayQueueItem : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
UOverlayQueueItem(const FObjectInitializer& init);
|
|
// Close this overlay item
|
|
UFUNCTION(BlueprintCallable, Category = "Overlay")
|
|
void Close(int32 result = 0);
|
|
|
|
UPROPERTY()
|
|
FOverlayItemClosed onClosed;
|
|
|
|
private:
|
|
friend class UScreenOverlay;
|
|
bool m_remove;
|
|
int32 m_closeResult;
|
|
};
|
|
|
|
UCLASS()
|
|
class UMsgBoxInfo : public UOverlayQueueItem
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
UMsgBoxInfo(const FObjectInitializer& init);
|
|
UPROPERTY(BlueprintReadOnly, Category = "MsgBox")
|
|
FString caption;
|
|
UPROPERTY(BlueprintReadOnly, Category = "MsgBox")
|
|
FString message;
|
|
UPROPERTY(BlueprintReadOnly, Category = "MsgBox")
|
|
TArray<FString> options;
|
|
UPROPERTY(BlueprintReadOnly, Category = "MsgBox")
|
|
FString defaultOption;
|
|
|
|
};
|
|
UCLASS()
|
|
class UOverlayInfo : public UOverlayQueueItem
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
UOverlayInfo(const FObjectInitializer& init);
|
|
UPROPERTY(BlueprintReadOnly, Category = "MsgBox")
|
|
FString message;
|
|
UPROPERTY(BlueprintReadOnly, Category = "Overlay")
|
|
bool blockInput;
|
|
|
|
};
|
|
|
|
UCLASS()
|
|
class UNREALPROJECT_API UScreenOverlay : public UMenuScreenBase
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
UScreenOverlay(const FObjectInitializer& init);
|
|
virtual void NativeConstruct() override;
|
|
virtual void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Overlay")
|
|
UOverlayInfo* ShowOverlay(FString message);
|
|
UMsgBoxInfo* ShowMessageBox(FString caption, FString message, TArray<FString> options, FString def = "");
|
|
UMsgBoxInfo* ShowMessageBoxCallback(FOverlayItemClosed cb, FString caption, FString message, TArray<FString> options, FString def);
|
|
//UFUNCTION(BlueprintCallable, Category = "Overlay")
|
|
//UMsgBoxInfo* ShowMessageBox(FOnOverlayItemClosedSingle cb, FString caption, FString message, TArray<FString> options, FString def = "");
|
|
|
|
UFUNCTION()
|
|
void OnMessageBoxClosed();
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Overlay")
|
|
TArray<UOverlayInfo*>& GetOverlayItems();
|
|
UFUNCTION(BlueprintCallable, Category = "Overlay")
|
|
UMsgBoxInfo* GetMessageBoxItem();
|
|
|
|
private:
|
|
void UpdateOverlays();
|
|
void UpdateMsgBoxes();
|
|
void UpdateVisiblity();
|
|
|
|
UPROPERTY()
|
|
class UOverlayMessageBox* m_msgBox;
|
|
UPROPERTY()
|
|
class UOverlayProgressBar* m_progressBar;
|
|
UPROPERTY()
|
|
class UBorder* m_background;
|
|
|
|
UPROPERTY()
|
|
TArray<UOverlayInfo*> m_overlayItems;
|
|
UPROPERTY()
|
|
TArray<UMsgBoxInfo*> m_messageBoxItems;
|
|
|
|
};
|