Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
DialogPresenter.h
이 파일의 문서화 페이지로 가기
1#pragma once
2
3#include "CK_UE.h"
4#include "Containers/Ticker.h"
9#include "DialogPresenter.generated.h"
10
11class UDialogData;
12class UTexture2D;
14struct FStreamableHandle;
15
17UENUM(BlueprintType)
22
23
25UENUM(BlueprintType)
26enum class EDialogState : uint8
27{
28 Idle,
33 Typing,
39};
40
41
42DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnDialogPresentationRequested, EDialogPresentation, Presentation, bool, bPlayer, int32, RequestID);
43
44
45DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnIllustratedDialogLineChanged, const FDT_DialogTable&, Row, UTexture2D*, Image, bool, bPlayer);
46
47
48DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnIllustratedDialogRefresh);
49
50
51DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnIllustratedDialogFinished);
52
53
54DECLARE_MULTICAST_DELEGATE_OneParam(FOnDialogPresentationFinished, int32);
55
57UCLASS(BlueprintType, Blueprintable)
59{
60 GENERATED_BODY()
61
62public:
63 virtual void InitializePresenter(UUIManagementSubsystem* Subsystem) override;
64 virtual void DeinitializePresenter() override;
65 virtual void OnViewBound(UUserWidgetBase* View) override;
66 virtual void OnViewUnbound(UUserWidgetBase* View) override;
67 virtual bool ShouldReceiveStageEvent_Implementation(const FStageEventMessage& Message, const FInstancedStruct& ListenerContext) override;
68 virtual void HandleStageEvent_Implementation(const FStageEventMessage& Message, const FInstancedStruct& ListenerContext) override;
69
71 UFUNCTION(BlueprintCallable, Category = "Dialog")
72 bool StartScenario(FName ScenarioID);
73
75 bool SetDialogData(UDialogData* Data);
76
78 UFUNCTION(BlueprintCallable, Category = "Dialog|Input")
79 void AdvanceDialog();
80
82 UFUNCTION(BlueprintCallable, Category = "Dialog|Input")
83 void BeginSkipHold();
84
85 UFUNCTION(BlueprintCallable, Category = "Dialog|Input")
86 void ConfirmSkipHold();
87
88 UFUNCTION(BlueprintCallable, Category = "Dialog|Input")
89 FORCEINLINE void CancelSkipHold()
90 {
91 bSkipArmed = false;
92 }
93
94
95 UFUNCTION(BlueprintCallable, Category = "Dialog|Input")
96 void SkipRemainingRows();
97
98 UFUNCTION(BlueprintPure, Category = "Dialog|Input")
99 bool IsDialogInputAvailable() const;
100
101 UFUNCTION()
102 void RefreshInput();
103
105 void CompletePresentation(int32 RequestID);
106
107 UFUNCTION(BlueprintPure, Category = "Dialog")
108 FORCEINLINE EDialogState GetDialogState() const
109 {
110 return State;
111 }
112
113
114 FORCEINLINE TSharedPtr<FRichTextRevealState> GetRevealState() const
115 {
116 return RevealState;
117 }
118
119
120 UPROPERTY(BlueprintAssignable, Category = "Dialog|Events")
121 FOnDialogPresentationRequested OnPresentationRequested;
122
123 UPROPERTY(BlueprintAssignable, Category = "Dialog|Events")
124 FOnIllustratedDialogLineChanged OnLineChanged;
125
126 UPROPERTY(BlueprintAssignable, Category = "Dialog|Events")
127 FOnIllustratedDialogRefresh OnTextRefresh;
128
129 UPROPERTY(BlueprintAssignable, Category = "Dialog|Events")
130 FOnIllustratedDialogFinished OnDialogFinished;
131
132protected:
133 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialog")
134 TSoftObjectPtr<UDialogData> DialogDataAsset;
135
136 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialog", meta = (ClampMin = "1.0"))
137 float CharactersPerSecond = 40.0f;
138
139private:
140 void LoadData();
141 void OnDataLoaded(TSharedPtr<FStreamableHandle> Handle);
142 void TryStartScenario();
143 void ShowCurrentRow();
144 void PresentCurrentRow();
145 void RequestPresentation(EDialogState NewState, EDialogPresentation Presentation, bool bPlayer = false);
146 void StartTyping();
147 void StopTyping();
148 bool UpdateTyping(float DeltaTime);
149 void FinishTyping();
150 void CompleteRow();
151 void BeginClosing();
152 void FinishDialog();
153 void ResetRuntime();
154 void DispatchRowEvent(FName EventID);
155
156 UPROPERTY(Transient)
157 TObjectPtr<UDialogData> LoadedData;
158
159 UPROPERTY(Transient)
160 FStageEventMessage ScenarioMessage;
161
162 TWeakObjectPtr<UUserWidgetBase> ActiveView;
163 TSharedPtr<FStreamableHandle> LoadHandle;
164 TSharedPtr<FRichTextRevealState> RevealState;
165 FTSTicker::FDelegateHandle TypingTicker;
166 TArray<FDT_DialogTable> Rows;
167 FName CurrentCharacterID;
168 FName PendingEndEvent;
170 int32 RowIndex = 0;
171 int32 PresentationID = 0;
172 float TypingProgress = 0.0f;
173 bool bCurrentPlayer = false;
174 bool bInputEnabled = false;
175 bool bSkipArmed = false;
176 bool bClosing = false;
177 bool bDispatching = false;
178};
EDialogPresentation
Definition DialogPresenter.h:19
DECLARE_MULTICAST_DELEGATE_OneParam(FOnDialogPresentationFinished, int32)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnDialogPresentationRequested, EDialogPresentation, Presentation, bool, bPlayer, int32, RequestID)
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnIllustratedDialogRefresh)
EDialogState
Definition DialogPresenter.h:27
Definition RichTextEffectParser.h:46
Definition StageEventBehaviorInterface.h:22
Definition DialogData.h:28
Definition DialogPresenter.h:59
FORCEINLINE TSharedPtr< FRichTextRevealState > GetRevealState() const
Definition DialogPresenter.h:114
Definition UIManagementSubsystem.h:28
Definition UserPresenterBase.h:19
Definition UserWidgetBase.h:35
Definition DT_DialogTable.h:11
Definition StageEventMessage.h:14