Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
UIManagementSubsystem.h
이 파일의 문서화 페이지로 가기
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "GameplayTagContainer.h"
7#include "Data/UI/UIContext.h"
9#include "Subsystems/GameInstanceSubsystem.h"
10#include "UIManagementSubsystem.generated.h"
11
12class UUILayer;
13class UUserWidgetBase;
14struct FUILayerConfig;
15
16
20UCLASS()
21class CK_UE_API UUIManagementSubsystem : public UGameInstanceSubsystem, public IStreamingEventListenerInterface
22{
23 GENERATED_BODY()
24
25public:
27
28public:
29 virtual void Initialize(FSubsystemCollectionBase& Collection) override;
30 virtual void Deinitialize() override;
31
32public:
33 virtual void OnLevelLoaded(ULevel* NewLevel, const ULevelStreamingData* LevelStreamingData) override { }
34 virtual void OnLevelUnloaded() override;
35 virtual void OnLevelStreamingStarted() override { }
36 virtual void OnLevelStreamingEnded() override { }
37
38public:
39 // 위젯을 생성해 레이어에 푸시한다.
40 // Context.bActivateOnPush == true(기본값)이고 레이어가 보이는 상태면 Activate(), 숨김 상태면 Collapsed.
41 // Context.bActivateOnPush == false면 레이어 가시성과 무관하게 Activate()를 호출하지 않는다.
42 // Context.bCanIncludeInSnapshot == true면 체크포인트 롤백 시 Pop되도록 SnapshotSubsystem에 기록할 수 있다.
43 UFUNCTION(BlueprintCallable, Category = "UI")
44 UUserWidgetBase* PushWidget(const FUIContext& Context, AActor* OwningActor, UUILayer*& OutLayer);
45
46 // PushWidget 의 PlayerController 자동 주입 버전. 활성화 규칙은 PushWidget 과 동일.
47 UFUNCTION(BlueprintCallable, Category = "UI")
48 UUserWidgetBase* PushPlayerWidget(const FUIContext& Context, UUILayer*& OutLayer);
49
50 // 이미 생성된 위젯 인스턴스를 푸시한다. Widget->PushToLayer()를 통해 BP 오버라이드를 거친다.
51 UFUNCTION(BlueprintCallable, Category = "UI")
52 UUserWidgetBase* PushWidgetInstance(UUserWidgetBase* Widget, int32 ZOrder, UUILayer*& OutLayer);
53
54 // PushToLayer_Implementation 에서 호출하는 직접 경로. BP 오버라이드를 거치지 않는다.
55 void PushWidgetDirect(UUserWidgetBase* Widget, int32 ZOrder, UUILayer*& OutLayer);
56
57 UFUNCTION(BlueprintCallable, Category = "UI", meta = (DefaultToSelf = "Widget", HidePin = "Widget"))
58 bool PopWidget(UUserWidgetBase* Widget);
59
60 UFUNCTION(BlueprintCallable, Category = "UI", meta = (DefaultToSelf = "Widget"))
61 void PopWidgetFromLayer(UUserWidgetBase* Widget, UUILayer* Layer);
62
63 UFUNCTION(BlueprintCallable, Category = "UI")
64 void PopAllWidgetsInLayer(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag);
65
66 UFUNCTION(BlueprintCallable, Category = "UI")
67 void PopAllLayer(bool WithPrimaryWidgets = false);
68
69 UFUNCTION(BlueprintCallable, Category = "UI")
70 UUILayer* GetLayer(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag) const;
71
72 UFUNCTION(BlueprintCallable, Category = "UI")
73 UUserWidgetBase* FindFirstWidgetByArgs(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag, const TSubclassOf<UUserWidget> ClassType) const;
74
75 UFUNCTION(BlueprintCallable, Category = "UI")
76 UUILayer* GetTopLayer() const;
77
78 UFUNCTION(BlueprintCallable, Category = "UI")
79 UUILayer* GetRootLayer() const;
80
81 UFUNCTION(BlueprintCallable, Category = "UI")
82 UUILayer* CreateLayer(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag, TSubclassOf<UUILayer> LayerClass = nullptr);
83
84 UFUNCTION(BlueprintCallable, Category = "UI")
85 void RemoveLayer(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag);
86
87 UFUNCTION(BlueprintCallable, Category = "UI")
88 void ShowLayer(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag);
89
90 UFUNCTION(BlueprintCallable, Category = "UI")
91 void HideLayer(UPARAM(meta = (Categories = "UI.Layer")) FGameplayTag LayerTag);
92
93 UFUNCTION(BlueprintCallable, Category = "UI")
94 void ClearAllLayers();
95
96 UFUNCTION(BlueprintCallable, Category = "UI")
97 int32 GetWidgetCountInLayer(UPARAM(meta = (Categories = "UI.Layer")) const FGameplayTagContainer& UILayerTags);
98
99#if WITH_EDITOR
100 void PrintAllLayers();
101#endif
102
103private:
104 // 푸시 단일 진입점. 레이어 확보 → 뷰포트 부착 → 활성화(bActivateOnPush && 레이어 보임 → Activate(),
105 // bActivateOnPush && 레이어 숨김 → Collapsed, !bActivateOnPush → 아무것도 안 함) → 입력 모드 갱신.
106 UUserWidgetBase* PushWidgetToLayer(UUserWidgetBase* Widget, FGameplayTag LayerTag, int32 ZOrder, UUILayer*& OutLayer, bool bActivateOnPush = true, bool bCanIncludeInSnapshot = false);
107 UUILayer* GetOrCreateLayer(FGameplayTag LayerTag);
108 void UpdateInputMode();
109
110 // 최상위 레이어가 요구하는 배율을 TimeManagementSubsystem 에 반영한다.
111 void ApplyLayerTimeScale(float LayerTimeScale);
112
113 // 현재 최상위 레이어가 요구하는 전역 시간 배율.
114 float GetActiveLayerTimeScale() const;
115
116 // 다른 시스템이 시간을 되돌렸을 때, 아직 떠 있는 레이어의 요구를 다시 주장한다.
117 void HandleTimeScaleRaised(float NewTimeScale);
118
119private:
120 UPROPERTY(Transient)
121 TArray<TObjectPtr<UUILayer>> LayerStack;
122};
Definition StreamingEventListenerInterface.h:23
Definition LevelStreamingData.h:19
Definition UILayer.h:14
Definition UIManagementSubsystem.h:22
virtual void OnLevelLoaded(ULevel *NewLevel, const ULevelStreamingData *LevelStreamingData) override
Definition UIManagementSubsystem.h:33
virtual void OnLevelStreamingEnded() override
Definition UIManagementSubsystem.h:36
virtual void OnLevelStreamingStarted() override
Definition UIManagementSubsystem.h:35
Definition UserWidgetBase.h:33
Definition UIContext.h:10
Definition UILayerSettings.h:13