Payback 0.0.1
CK Graduation Project
로딩중...
검색중...
일치하는것 없음
ScenarioCutscenePresenter.h
이 파일의 문서화 페이지로 가기
1#pragma once
2
3#include "CK_UE.h"
4#include "Containers/Ticker.h"
7#include "ScenarioCutscenePresenter.generated.h"
8
10
12UENUM(BlueprintType)
13enum class EScenarioCutsceneState : uint8
14{
15 None = 0,
16 Typing = 1,
17 Finished = 2,
18 WaitingInput = 4
19};
20
21
22DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnScenarioCutsceneStarted);
23
24
25DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnScenarioCutsceneLineChanged, const FDT_ScenarioCutsceneTable&, CutsceneRow, const FText&, SpeakerNameText, const FText&, DialogTextValue, const FText&, CutscenePathText);
26
27
28DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnScenarioCutsceneDialogTextChanged, const FText&, DialogTextValue);
29
30
31DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnScenarioCutsceneWaitingInput);
32
33
34DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnScenarioCutsceneFinished);
35
36
38UCLASS(BlueprintType, Blueprintable)
40{
41 GENERATED_BODY()
42
43public:
44 virtual void InitializePresenter(UUIManagementSubsystem* Subsystem) override;
45 virtual void DeinitializePresenter() override;
46 virtual void OnViewBound(UUserWidgetBase* View) override;
47 virtual void OnViewUnbound(UUserWidgetBase* View) override;
48
50 UFUNCTION(BlueprintCallable, Category = "Cutscene")
51 void StartCutscene(const TArray<FDT_ScenarioCutsceneTable>& InCutsceneRows);
52
54 UFUNCTION(BlueprintCallable, Category = "Cutscene|Input")
55 void AdvanceCutscene();
56
58 UFUNCTION(BlueprintCallable, Category = "Cutscene|Input")
59 void SkipCutscene();
60
62 UFUNCTION(BlueprintCallable, Category = "Cutscene|Input")
63 void BeginSkipHold();
64
66 UFUNCTION(BlueprintCallable, Category = "Cutscene|Input")
67 void ConfirmSkipHold();
68
70 UFUNCTION(BlueprintPure, Category = "Cutscene|Input")
71 bool IsCutsceneInputAvailable() const;
72
74 UFUNCTION()
75 void RefreshInput();
76
77public:
79 UFUNCTION(BlueprintCallable, Category = "Cutscene|Input")
80 FORCEINLINE void CancelSkipHold()
81 {
82 bSkipArmed = false;
83 }
84
85
87 UFUNCTION(BlueprintCallable, Category = "Cutscene")
88 FORCEINLINE void ConfigureTypewriter(bool bInUseTypewriter, float InCharactersPerSecond)
89 {
90 bUseTypewriter = bInUseTypewriter;
91 CharactersPerSecond = FMath::Max(InCharactersPerSecond, 1.0f);
92 }
93
94
95 UFUNCTION(BlueprintPure, Category = "Cutscene")
96 FORCEINLINE bool IsCutsceneFinished() const
97 {
98 return CutsceneState == EScenarioCutsceneState::Finished;
99 }
100
101
102 UFUNCTION(BlueprintPure, Category = "Cutscene")
103 FORCEINLINE EScenarioCutsceneState GetCutsceneState() const
104 {
105 return CutsceneState;
106 }
107
109 FORCEINLINE TSharedPtr<FRichTextRevealState> GetDialogRevealState() const { return DialogRevealState; }
110
111public:
112 UPROPERTY(BlueprintAssignable, Category = "Cutscene|Events")
113 FOnScenarioCutsceneStarted OnCutsceneStarted;
114
115 UPROPERTY(BlueprintAssignable, Category = "Cutscene|Events")
116 FOnScenarioCutsceneLineChanged OnCutsceneLineChanged;
117
118 UPROPERTY(BlueprintAssignable, Category = "Cutscene|Events")
119 FOnScenarioCutsceneDialogTextChanged OnCutsceneDialogTextChanged;
120
121 UPROPERTY(BlueprintAssignable, Category = "Cutscene|Events")
122 FOnScenarioCutsceneWaitingInput OnCutsceneWaitingInput;
123
124 UPROPERTY(BlueprintAssignable, Category = "Cutscene|Events")
125 FOnScenarioCutsceneFinished OnCutsceneFinished;
126
127private:
129 void RefreshView();
130 void ShowCurrentLine();
131 void StartTyping();
132 void StopTyping();
133 bool UpdateTyping(float DeltaTime);
134 void FinishTypingCurrentLine();
135 void FinishCutscene();
136
137private:
138 TWeakObjectPtr<UUserWidgetBase> ActiveView;
139 FTSTicker::FDelegateHandle TypingTicker;
140 TArray<FDT_ScenarioCutsceneTable> CutsceneRows;
141 FText CurrentDialogText;
142 TSharedPtr<FRichTextRevealState> DialogRevealState;
144 int32 CurrentRowIndex = INDEX_NONE;
145 bool bUseTypewriter = false;
146 bool bInputEnabled = false;
147 bool bSkipArmed = false;
148 float CharactersPerSecond = 40.0f;
149 float TypingProgress = 0.0f;
150};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOnScenarioCutsceneLineChanged, const FDT_ScenarioCutsceneTable &, CutsceneRow, const FText &, SpeakerNameText, const FText &, DialogTextValue, const FText &, CutscenePathText)
EScenarioCutsceneState
Definition ScenarioCutscenePresenter.h:14
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnScenarioCutsceneStarted)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnScenarioCutsceneDialogTextChanged, const FText &, DialogTextValue)
Definition RichTextEffectParser.h:46
Definition ScenarioCutscenePresenter.h:40
FORCEINLINE TSharedPtr< FRichTextRevealState > GetDialogRevealState() const
Definition ScenarioCutscenePresenter.h:109
Definition UIManagementSubsystem.h:28
Definition UserPresenterBase.h:19
Definition UserWidgetBase.h:35
Definition DT_ScenarioCutsceneTable.h:10