KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UCountDown.cpp
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
3#include "UCountDown.h"
4
5#include "Components/Border.h"
6#include "Components/TextBlock.h"
7#include "Animation/WidgetAnimation.h"
8#include "GameLogging.h"
9
11{
12 Super::NativeDestruct();
13
14 // 타이머 정리
15 if (GetWorld())
16 {
17 GetWorld()->GetTimerManager().ClearTimer(CountDownTimerHandle);
18 }
19}
20
21void UCountDown::StartCountDown(int32 InStartValue)
22{
23 if (InStartValue <= 0)
24 {
25 PRINTLOG(TEXT("[CountDown] Invalid start value: %d"), InStartValue);
26 return;
27 }
28
29 CountDownValue = InStartValue;
30
31 // 위젯 표시
33 {
34 Border_CountDown->SetVisibility(ESlateVisibility::Visible);
35 }
36
37 // 첫 번째 숫자 표시
39
40 // 1초마다 업데이트
41 GetWorld()->GetTimerManager().SetTimer(
43 this,
45 1.0f,
46 true
47 );
48}
49
51{
53
54 if (CountDownValue > 0)
55 {
56 // 다음 숫자 표시
58 }
59 else
60 {
61 // 카운트다운 종료
62 GetWorld()->GetTimerManager().ClearTimer(CountDownTimerHandle);
63
64 // 위젯 숨기기
66 {
67 Border_CountDown->SetVisibility(ESlateVisibility::Hidden);
68 }
69
70 // Delegate 호출
71 OnCountDownFinished.Broadcast();
72 }
73}
74
76{
77 // 텍스트 업데이트
78 if (Txt_CountDown)
79 {
80 Txt_CountDown->SetText(FText::AsNumber(CountDownValue));
81 }
82
83 // 애니메이션 재생 (블루프린트에서 설정된 경우)
85 {
86 PlayAnimation(Anim_CountDown);
87 }
88}
YiSan 전반에서 사용하는 공용 인터페이스를 선언합니다.
#define PRINTLOG(fmt,...)
Definition GameLogging.h:30
TObjectPtr< class UWidgetAnimation > Anim_CountDown
숫자 표시 애니메이션 (블루프린트에서 설정)
Definition UCountDown.h:77
FTimerHandle CountDownTimerHandle
카운트다운 타이머
Definition UCountDown.h:88
TObjectPtr< class UBorder > Border_CountDown
카운트다운 컨테이너
Definition UCountDown.h:65
void UpdateCountDown()
카운트다운 업데이트 (타이머 콜백)
void DisplayCurrentNumber()
현재 숫자를 표시하고 애니메이션을 재생합니다.
void StartCountDown(int32 InStartValue)
카운트다운을 시작합니다.
int32 CountDownValue
현재 카운트다운 값
Definition UCountDown.h:85
TObjectPtr< class UTextBlock > Txt_CountDown
카운트다운 텍스트
Definition UCountDown.h:69
FOnCountDownFinished OnCountDownFinished
카운트다운 종료 시 호출되는 Delegate
Definition UCountDown.h:42
virtual void NativeDestruct() override