#pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include "Components/SlateWrapperTypes.h" #include "Templates/SubclassOf.h" #include "WindowManagerDelegateDelegate.h" #include "WindowManager.generated.h" class USoundCue; class UUserWidget; class UWindowWidget; UCLASS(Blueprintable, ClassGroup=Custom, meta=(BlueprintSpawnableComponent)) class FSD_API UWindowManager : public UActorComponent { GENERATED_BODY() public: UPROPERTY(BlueprintAssignable, BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) FWindowManagerDelegate OnFirstWindowOpened; UPROPERTY(BlueprintAssignable, BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) FWindowManagerDelegate OnLastWindowClosed; protected: UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) USoundCue* AudioWindowOpen; UPROPERTY(BlueprintReadWrite, EditAnywhere, Instanced, Transient, meta=(AllowPrivateAccess=true)) TArray WindowStack; UPROPERTY(BlueprintReadWrite, EditAnywhere, Instanced, Transient, meta=(AllowPrivateAccess=true)) TMap, UWindowWidget*> WindowList; UPROPERTY(EditAnywhere, Export, Transient, meta=(AllowPrivateAccess=true)) TMap, TWeakObjectPtr> WidgetSingletonCache; UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true)) bool ResolutionDownscaleActive; public: UWindowManager(); UFUNCTION(BlueprintCallable) void SetSingletonWidgetVisibility(TSubclassOf WidgetClass, ESlateVisibility Visibility); UFUNCTION(BlueprintCallable) void ReplaceWindow(UWindowWidget* Window); UFUNCTION(BlueprintCallable) UWindowWidget* OpenWindowFromClass(TSubclassOf WindowClass, int32 ZOrder, bool ShowCursor); UFUNCTION(BlueprintCallable) void OpenWindow(UWindowWidget* Window, bool PlayAudio, bool ShowCursor); UFUNCTION(BlueprintCallable) UWindowWidget* OpenSingleUseWindow(TSubclassOf WindowClass, int32 ZOrder); UFUNCTION(BlueprintCallable, BlueprintPure) bool IsWindowOpen(UWindowWidget* Window) const; UFUNCTION(BlueprintCallable, BlueprintPure) bool IsTopWindow(UWindowWidget* Window) const; UFUNCTION(BlueprintCallable) UUserWidget* GetOrCreateSingletonWidget(TSubclassOf WidgetClass, bool& WidgetCreated); UFUNCTION(BlueprintCallable, BlueprintPure) UWindowWidget* GetCurrentWindow() const; UFUNCTION(BlueprintCallable) void CloseWindow(UWindowWidget* Window); UFUNCTION(BlueprintCallable) void CloseTopWindow(); UFUNCTION(BlueprintCallable) void CloseAllWindows(); protected: UFUNCTION(BlueprintCallable) void CenterCursor(); public: UFUNCTION(BlueprintCallable, BlueprintPure) bool AnyWindowsOpen() const; };