KLingo Project Documentation
1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UPopup_LevelSelect.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 "
UPopup_LevelSelect.h
"
4
#include "
ULevelSelectItem.h
"
5
#include "
UPopupManager.h
"
6
#include "
UTextureButton.h
"
7
#include "
ALingoGameState.h
"
8
#include "
GameLogging.h
"
9
#include "Components/HorizontalBox.h"
10
#include "Components/Button.h"
11
#include "Components/Spacer.h"
12
13
void
UPopup_LevelSelect::NativeConstruct
()
14
{
15
Super::NativeConstruct();
16
}
17
18
void
UPopup_LevelSelect::InitPopup
()
19
{
20
if
(
Btn_Close
)
21
{
22
Btn_Close
->OnButtonClickedEvent.RemoveDynamic(
this
, &
UPopup_LevelSelect::OnClickClose
);
23
Btn_Close
->OnButtonClickedEvent.AddDynamic(
this
, &
UPopup_LevelSelect::OnClickClose
);
24
}
25
26
// 기존 아이템들 제거
27
HorizontalBox
->ClearChildren();
28
29
// 레벨 아이템들 생성 및 추가
30
for
(int32 i = 0; i <
LevelNames
.Num(); ++i)
31
{
32
ULevelSelectItem
* LevelItem = CreateWidget<ULevelSelectItem>(
this
,
LevelSelectItemClass
);
33
if
(LevelItem)
34
{
35
// 레벨은 1부터 시작 (i+1)
36
int32 Level = i + 1;
37
FString LevelName = (i <
LevelNames
.Num()) ?
LevelNames
[i] : FString::Printf(TEXT(
"Level %d"
), Level);
38
39
LevelItem->
InitLevelItem
(Level, LevelName, 3);
40
41
// 델리게이트 바인딩
42
LevelItem->
OnLevelSelected
.BindUObject(
this
, &
UPopup_LevelSelect::OnLevelSelected
);
43
44
HorizontalBox
->AddChildToHorizontalBox(LevelItem);
45
}
46
47
// 마지막 항목이 아니면 Spacer 추가
48
if
(i <
LevelNames
.Num() - 1)
49
{
50
USpacer* Spacer = NewObject<USpacer>(
this
);
51
if
(Spacer)
52
{
53
Spacer->SetSize(FVector2D(45.0f, 0));
54
HorizontalBox
->AddChildToHorizontalBox(Spacer);
55
}
56
}
57
}
58
}
59
60
void
UPopup_LevelSelect::OnLevelSelected
(int32 SelectedLevel)
61
{
62
// GameState의 RoomLevel 설정 (Host만 팝업을 열므로 Host에서만 실행됨)
63
if
(
ALingoGameState
* GameState = GetWorld()->GetGameState<ALingoGameState>())
64
{
65
GameState->SetRoomLevel(SelectedLevel);
66
}
67
else
68
{
69
PRINTLOG
(TEXT(
"Failed to get ALingoGameState"
));
70
}
71
72
OnClickClose
();
73
}
74
75
void
UPopup_LevelSelect::OnClickClose
()
76
{
77
// 팝업 닫힘 델리게이트 실행
78
if
(
OnPopupClosed
.IsBound())
79
OnPopupClosed
.Execute();
80
81
// PopupManager를 통해 팝업 닫기
82
if
(
UPopupManager
* PopupMgr = UPopupManager::Get(GetWorld()))
83
{
84
PopupMgr->HideCurrentPopup();
85
}
86
}
ALingoGameState.h
GameLogging.h
YiSan 전반에서 사용하는 공용 인터페이스를 선언합니다.
PRINTLOG
#define PRINTLOG(fmt,...)
Definition
GameLogging.h:30
ULevelSelectItem.h
UPopupManager.h
UPopup_LevelSelect.h
UTextureButton.h
ALingoGameState
Definition
ALingoGameState.h:29
ULevelSelectItem
레벨 선택 아이템 위젯
Definition
ULevelSelectItem.h:17
ULevelSelectItem::InitLevelItem
void InitLevelItem(int32 InLevel, const FString &InLevelName, int32 InPlayTime)
레벨 정보를 초기화하고 단어 그룹들을 생성
Definition
ULevelSelectItem.cpp:22
ULevelSelectItem::OnLevelSelected
FOnLevelSelectedDelegate OnLevelSelected
레벨 선택 델리게이트
Definition
ULevelSelectItem.h:46
UPopupManager
팝업 관리자
Definition
UPopupManager.h:31
UPopup_LevelSelect::OnLevelSelected
void OnLevelSelected(int32 SelectedLevel)
레벨 선택 이벤트 핸들러
Definition
UPopup_LevelSelect.cpp:60
UPopup_LevelSelect::NativeConstruct
virtual void NativeConstruct() override
Definition
UPopup_LevelSelect.cpp:13
UPopup_LevelSelect::Btn_Close
TObjectPtr< class UTextureButton > Btn_Close
팝업 닫기 버튼 (우측 상단)
Definition
UPopup_LevelSelect.h:52
UPopup_LevelSelect::OnClickClose
void OnClickClose()
Definition
UPopup_LevelSelect.cpp:75
UPopup_LevelSelect::OnPopupClosed
FOnPopupClosedDelegate OnPopupClosed
팝업이 닫힐 때 호출되는 델리게이트
Definition
UPopup_LevelSelect.h:43
UPopup_LevelSelect::HorizontalBox
TObjectPtr< class UHorizontalBox > HorizontalBox
레벨 아이템들이 배치될 Horizontal Box
Definition
UPopup_LevelSelect.h:48
UPopup_LevelSelect::LevelNames
TArray< FString > LevelNames
레벨 이름 배열
Definition
UPopup_LevelSelect.h:64
UPopup_LevelSelect::LevelSelectItemClass
TSubclassOf< class ULevelSelectItem > LevelSelectItemClass
생성할 LevelSelectItem 위젯 클래스
Definition
UPopup_LevelSelect.h:56
UPopup_LevelSelect::InitPopup
void InitPopup()
팝업을 초기화하고 레벨 아이템들을 생성
Definition
UPopup_LevelSelect.cpp:18
Source
Onepiece
MessageBox
Private
UPopup_LevelSelect.cpp
생성시간 : 금 1월 9 2026 00:25:57, 프로젝트명 : KLingo Project Documentation, 생성자 :
1.9.8