// 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 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 options, FString def = ""); UMsgBoxInfo* ShowMessageBoxCallback(FOverlayItemClosed cb, FString caption, FString message, TArray options, FString def); //UFUNCTION(BlueprintCallable, Category = "Overlay") //UMsgBoxInfo* ShowMessageBox(FOnOverlayItemClosedSingle cb, FString caption, FString message, TArray options, FString def = ""); UFUNCTION() void OnMessageBoxClosed(); UFUNCTION(BlueprintCallable, Category = "Overlay") TArray& 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 m_overlayItems; UPROPERTY() TArray m_messageBoxItems; };