KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
ASpeakStageActor 클래스 참조

Speak Stage 시스템 더 자세히 ...

#include <ASpeakStageActor.h>

+ ASpeakStageActor에 대한 상속 다이어그램 :
+ ASpeakStageActor에 대한 협력 다이어그램:

Public 멤버 함수

 ASpeakStageActor ()
 생성자
 
void EndStage ()
 현재 플레이어의 스테이지를 강제로 종료합니다.
 
FString GetCurrentQuestion () const
 
FORCEINLINE class ALingoPlayerStateGetCurrentSpeaker () const
 
FORCEINLINE int32 GetCurrentStepIndex () const
 
virtual void GetLifetimeReplicatedProps (TArray< FLifetimeProperty > &OutLifetimeProps) const override
 Replication 설정
 
int32 GetTotalQuestions () const
 
int32 GetTotalQuestionsCount ()
 
bool IsMyTurn (class ALingoPlayerState *lingo_player_state)
 
void NotifyAnswerComplete (class ALingoPlayerState *Player)
 플레이어 답변 완료 알림 (Server에서 호출됨)
 
void StartStageForPlayer (class ALingoPlayerState *Player)
 특정 플레이어에 대해 Speak Stage를 시작합니다.
 

Public 속성

FOnSpeakerChangedDelegate OnSpeakerChanged
 현재 발화자가 변경될 때 호출되는 이벤트입니다.
 

Protected 멤버 함수

void Multicast_NotifySpeakQuestStarted (const FString &PlayerName)
 모든 클라이언트에게 SpeakQuest 시작 알림 전송 (Multicast RPC)
 
void OnRep_CurrentSpeaker ()
 currentSpeaker 복제 알림
 

Protected 속성

TObjectPtr< class ALingoPlayerStateCurrentSpeaker
 현재 발화 권한을 가진 플레이어. nullptr이면 스테이지가 비어있음을 의미.
 
int32 CurrentStepIndex
 현재 진행 단계 (질문 인덱스)
 

Private 멤버 함수

void AdvanceStep ()
 다음 질문으로 진행합니다.
 

상세한 설명

Speak Stage 시스템

한 번에 한 명의 플레이어와 순차적 음성 대화를 진행하는 액터.

핵심 기능:

  • 한 번에 한 플레이어만 발화 가능 (사용 중/비사용 중 상태)
  • Server Authority로 턴 제어
  • 모든 클라이언트에 상태 복제
  • 순차적 질문 진행 관리

ASpeakStageActor.h 파일의 22 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ ASpeakStageActor()

ASpeakStageActor::ASpeakStageActor ( )

생성자

ASpeakStageActor.cpp 파일의 16 번째 라인에서 정의되었습니다.

17{
18 // Replication 설정
19 bReplicates = true;
20 bAlwaysRelevant = true; // 모든 클라이언트에 항상 복제
21
22 // Tick 비활성화 (이벤트 기반으로 동작)
23 PrimaryActorTick.bCanEverTick = false;
24
25 // 초기값 설정
26 CurrentSpeaker = nullptr;
28}
int32 CurrentStepIndex
현재 진행 단계 (질문 인덱스)
TObjectPtr< class ALingoPlayerState > CurrentSpeaker
현재 발화 권한을 가진 플레이어. nullptr이면 스테이지가 비어있음을 의미.

다음을 참조함 : CurrentSpeaker, CurrentStepIndex.

멤버 함수 문서화

◆ AdvanceStep()

void ASpeakStageActor::AdvanceStep ( )
private

다음 질문으로 진행합니다.

모든 질문 완료 시 EndStage()를 호출합니다.

ASpeakStageActor.cpp 파일의 134 번째 라인에서 정의되었습니다.

135{
136 if (!HasAuthority())
137 {
138 return;
139 }
140
142
143 // 모든 질문 완료?
144 auto TotalQuestionsCount = GetTotalQuestionsCount();
145 if( CurrentStepIndex >= TotalQuestionsCount )
146 {
147 PRINTLOG(TEXT("[SpeakStage] All steps completed for: %s"), *ULingoGameHelper::GetPlayerNameFromState(CurrentSpeaker));
148 // 스테이지 종료
149 EndStage();
150 }
151 else
152 {
153 PRINTLOG(TEXT("[SpeakStage] Advanced to step: %d/%d"), CurrentStepIndex + 1, TotalQuestionsCount);
154
155 // 클라이언트에게 현재 단계 정보(Toast, TTS)를 전송하고 UI 업데이트를 요청합니다.
156 if (APlayerControl* PC = Cast<APlayerControl>(CurrentSpeaker->GetOwner()))
157 {
158 // 클라이언트에게 StepIndex를 전달하여 스스로 UI와 TTS를 처리하도록 합니다.
159 PC->Client_UpdateSpeakQuest(CurrentStepIndex);
160 PRINTLOG(TEXT("[SpeakStage] Sent StepIndex %d to client for update."), CurrentStepIndex);
161 }
162 }
163}
#define PRINTLOG(fmt,...)
Definition GameLogging.h:30
void EndStage()
현재 플레이어의 스테이지를 강제로 종료합니다.
static FString GetPlayerNameFromState(const class ALingoPlayerState *PlayerState)
PlayerState에서 PlayerControl을 통해 사용자 이름 가져오기

다음을 참조함 : CurrentSpeaker, CurrentStepIndex, EndStage(), ULingoGameHelper::GetPlayerNameFromState(), GetTotalQuestionsCount(), PRINTLOG.

다음에 의해서 참조됨 : NotifyAnswerComplete().

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ EndStage()

void ASpeakStageActor::EndStage ( )

현재 플레이어의 스테이지를 강제로 종료합니다.

currentSpeaker를 nullptr로 만들고 상태를 초기화합니다.

ASpeakStageActor.cpp 파일의 165 번째 라인에서 정의되었습니다.

166{
167 if (!HasAuthority() || !CurrentSpeaker)
168 return;
169
170 // SpeakQuest 완료 처리 (PlayerState에 플래그 설정)
171 if (ALingoPlayerState* PS = Cast<ALingoPlayerState>(CurrentSpeaker))
172 {
173 PS->SetSpeakQuestCompleted();
174 }
175
176 // 클라이언트 측에서 완료 UI 처리 및 위젯 업데이트를 하도록 단일 RPC 호출
177 if (APlayerControl* PC = Cast<APlayerControl>(CurrentSpeaker->GetOwner()))
178 {
179 PC->Client_EndSpeakQuest();
180 PRINTLOG(TEXT("[SpeakStage] Sent FinalizeSpeakQuest to client: %s"), *ULingoGameHelper::GetPlayerNameFromState(CurrentSpeaker));
181 }
182
183 // 서버 상태 초기화
184 CurrentSpeaker = nullptr;
186
187 // 서버 측 리스너에게 알림
189}
FOnSpeakerChangedDelegate OnSpeakerChanged
현재 발화자가 변경될 때 호출되는 이벤트입니다.

다음을 참조함 : CurrentSpeaker, CurrentStepIndex, ULingoGameHelper::GetPlayerNameFromState(), OnSpeakerChanged, PRINTLOG.

다음에 의해서 참조됨 : AdvanceStep().

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetCurrentQuestion()

FString ASpeakStageActor::GetCurrentQuestion ( ) const

ASpeakStageActor.cpp 파일의 112 번째 라인에서 정의되었습니다.

113{
114 if (!CurrentSpeaker)
115 return TEXT("");
116
117 // PlayerState에서 데이터 가져오기
118 if (auto PS = Cast<ALingoPlayerState>(CurrentSpeaker))
119 {
120 if (PS->SpeakScenarioData.speak_quest_data.IsValidIndex(CurrentStepIndex))
121 return PS->SpeakScenarioData.speak_quest_data[CurrentStepIndex].GetQuestionMessage();
122 }
123
124 return TEXT("");
125}

다음을 참조함 : CurrentSpeaker, CurrentStepIndex.

다음에 의해서 참조됨 : ANPCExaminer::GetCurrentQuestion().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetCurrentSpeaker()

FORCEINLINE class ALingoPlayerState * ASpeakStageActor::GetCurrentSpeaker ( ) const
inline

ASpeakStageActor.h 파일의 35 번째 라인에서 정의되었습니다.

35{ return CurrentSpeaker; }

다음에 의해서 참조됨 : UMainWidget::CanShowSpeakWidget().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetCurrentStepIndex()

FORCEINLINE int32 ASpeakStageActor::GetCurrentStepIndex ( ) const
inline

ASpeakStageActor.h 파일의 38 번째 라인에서 정의되었습니다.

38{ return CurrentStepIndex; }

◆ GetLifetimeReplicatedProps()

void ASpeakStageActor::GetLifetimeReplicatedProps ( TArray< FLifetimeProperty > &  OutLifetimeProps) const
overridevirtual

Replication 설정

ASpeakStageActor.cpp 파일의 30 번째 라인에서 정의되었습니다.

31{
32 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
33
34 DOREPLIFETIME(ASpeakStageActor, CurrentSpeaker);
35 DOREPLIFETIME(ASpeakStageActor, CurrentStepIndex);
36}
Speak Stage 시스템

다음을 참조함 : CurrentSpeaker, CurrentStepIndex.

◆ GetTotalQuestions()

int32 ASpeakStageActor::GetTotalQuestions ( ) const

ASpeakStageActor.cpp 파일의 103 번째 라인에서 정의되었습니다.

104{
105 if (ALingoPlayerState* PS = Cast<ALingoPlayerState>(CurrentSpeaker))
106 {
107 return PS->SpeakScenarioData.speak_quest_data.Num();
108 }
109 return 0;
110}

다음을 참조함 : CurrentSpeaker.

다음에 의해서 참조됨 : USpeakWidget::UpdateSpeakStage().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetTotalQuestionsCount()

int32 ASpeakStageActor::GetTotalQuestionsCount ( )

ASpeakStageActor.cpp 파일의 127 번째 라인에서 정의되었습니다.

128{
129 if (ALingoPlayerState* PS = Cast<ALingoPlayerState>(CurrentSpeaker))
130 return PS->SpeakScenarioData.speak_quest_data.Num();
131 return 0;
132}

다음을 참조함 : CurrentSpeaker.

다음에 의해서 참조됨 : AdvanceStep().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ IsMyTurn()

bool ASpeakStageActor::IsMyTurn ( class ALingoPlayerState lingo_player_state)

ASpeakStageActor.cpp 파일의 191 번째 라인에서 정의되었습니다.

192{
193 if ( PlayerState == nullptr)
194 return false;
195
196 if ( CurrentSpeaker == nullptr)
197 return false;
198
199 return CurrentSpeaker == PlayerState;
200}

다음을 참조함 : CurrentSpeaker.

◆ Multicast_NotifySpeakQuestStarted()

void ASpeakStageActor::Multicast_NotifySpeakQuestStarted ( const FString &  PlayerName)
protected

모든 클라이언트에게 SpeakQuest 시작 알림 전송 (Multicast RPC)

매개변수
PlayerName[in] Quest를 시작한 플레이어 이름

다음에 의해서 참조됨 : StartStageForPlayer().

+ 이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ NotifyAnswerComplete()

void ASpeakStageActor::NotifyAnswerComplete ( class ALingoPlayerState Player)

플레이어 답변 완료 알림 (Server에서 호출됨)

매개변수
Player[in] 답변을 완료한 플레이어

ASpeakStageActor.cpp 파일의 90 번째 라인에서 정의되었습니다.

91{
92 if (!HasAuthority() || !Player)
93 return;
94
95 // 현재 발화자가 아니면 무시
96 if (CurrentSpeaker != Player)
97 return;
98
99 // 다음 단계로 진행
100 AdvanceStep();
101}
void AdvanceStep()
다음 질문으로 진행합니다.

다음을 참조함 : AdvanceStep(), CurrentSpeaker.

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ OnRep_CurrentSpeaker()

void ASpeakStageActor::OnRep_CurrentSpeaker ( )
protected

currentSpeaker 복제 알림

ASpeakStageActor.cpp 파일의 42 번째 라인에서 정의되었습니다.

43{
45}

다음을 참조함 : CurrentSpeaker, OnSpeakerChanged.

◆ StartStageForPlayer()

void ASpeakStageActor::StartStageForPlayer ( class ALingoPlayerState Player)

특정 플레이어에 대해 Speak Stage를 시작합니다.

(서버에서만 호출)

매개변수
Player[in] 스테이지를 시작할 플레이어의 PlayerState.

ASpeakStageActor.cpp 파일의 51 번째 라인에서 정의되었습니다.

52{
53 if (!HasAuthority() || !Player)
54 return;
55
56 // 이미 사용 중인 경우
57 if (CurrentSpeaker != nullptr)
58 return;
59
60 // 플레이어를 현재 발화자로 설정
61 CurrentSpeaker = Player;
63
64 // 서버 측 리스너에게 즉시 알림
66
67 // 모든 클라이언트에게 SpeakQuest 시작 알림 브로드캐스트
68 FString PlayerName = ULingoGameHelper::GetPlayerNameFromState(Player);
70
71 // 클라이언트에게 현재 단계 정보(Toast, TTS)를 전송하고 UI 업데이트를 요청합니다.
72 if (APlayerControl* PC = Cast<APlayerControl>(CurrentSpeaker->GetOwner()))
73 {
74 // 클라이언트에게 StepIndex를 전달하여 스스로 UI와 TTS를 처리하도록 합니다.
75 PC->Client_UpdateSpeakQuest(CurrentStepIndex);
76 PRINTLOG(TEXT("[SpeakStage] Sent StepIndex %d to client for update."), CurrentStepIndex);
77 }
78}
void Multicast_NotifySpeakQuestStarted(const FString &PlayerName)
모든 클라이언트에게 SpeakQuest 시작 알림 전송 (Multicast RPC)

다음을 참조함 : CurrentSpeaker, CurrentStepIndex, ULingoGameHelper::GetPlayerNameFromState(), Multicast_NotifySpeakQuestStarted(), OnSpeakerChanged, PRINTLOG.

+ 이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ CurrentSpeaker

TObjectPtr<class ALingoPlayerState> ASpeakStageActor::CurrentSpeaker
protected

현재 발화 권한을 가진 플레이어. nullptr이면 스테이지가 비어있음을 의미.

ASpeakStageActor.h 파일의 98 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : ASpeakStageActor(), AdvanceStep(), EndStage(), GetCurrentQuestion(), GetLifetimeReplicatedProps(), GetTotalQuestions(), GetTotalQuestionsCount(), IsMyTurn(), NotifyAnswerComplete(), OnRep_CurrentSpeaker(), StartStageForPlayer().

◆ CurrentStepIndex

int32 ASpeakStageActor::CurrentStepIndex
protected

현재 진행 단계 (질문 인덱스)

ASpeakStageActor.h 파일의 102 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : ASpeakStageActor(), AdvanceStep(), EndStage(), GetCurrentQuestion(), GetLifetimeReplicatedProps(), StartStageForPlayer().

◆ OnSpeakerChanged

FOnSpeakerChangedDelegate ASpeakStageActor::OnSpeakerChanged

현재 발화자가 변경될 때 호출되는 이벤트입니다.

ASpeakStageActor.h 파일의 93 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : EndStage(), OnRep_CurrentSpeaker(), AWheatly::SetSpeakStageActor(), StartStageForPlayer().


이 클래스에 대한 문서화 페이지는 다음의 파일들로부터 생성되었습니다.: