KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
ULevelSelectItem.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 "ULevelSelectItem.h"
4#include "ULevelWordGroup.h"
5#include "EWordType.h"
6#include "Components/TextBlock.h"
7#include "Components/VerticalBox.h"
8#include "UImageButton.h"
9#include "Components/Spacer.h"
10
12{
13 Super::NativeConstruct();
14
15 if (Btn_Select)
16 {
17 Btn_Select->OnButtonClickedEvent.RemoveDynamic(this, &ULevelSelectItem::OnSelectButtonClicked);
18 Btn_Select->OnButtonClickedEvent.AddDynamic(this, &ULevelSelectItem::OnSelectButtonClicked);
19 }
20}
21
22void ULevelSelectItem::InitLevelItem(int32 InLevel, const FString& InLevelName, int32 InPlayTime)
23{
24 Level = InLevel;
25 LevelName = InLevelName;
26 PlayTime = InPlayTime;
27
28 Txt_Title->SetText(FText::FromString(LevelName));
29 Txt_PlayTime->SetText(FText::FromString(FString::Printf(TEXT("%d"), PlayTime)));
30
31 if (VerticalBox)
32 VerticalBox->ClearChildren();
33
34 // 새 WordGroup들 생성
35 if ( WordGroupClass )
36 {
41 }
42}
43
45{
46 ULevelWordGroup* WordGroup = CreateWidget<ULevelWordGroup>(this, WordGroupClass);
47 if (WordGroup)
48 {
50 VerticalBox->AddChildToVerticalBox(WordGroup);
51
52 USpacer* Spacer = NewObject<USpacer>(this);
53 if (Spacer)
54 {
55 Spacer->SetSize(FVector2D(0.0f, 15.0f));
56 VerticalBox->AddChildToVerticalBox(Spacer);
57 }
58 }
59}
60
62{
63 ULevelWordGroup* WordGroup = CreateWidget<ULevelWordGroup>(this, WordGroupClass);
64 if (WordGroup)
65 {
66 WordGroup->InitGroup(EWordType::Color, Level);
67 VerticalBox->AddChildToVerticalBox(WordGroup);
68
69 USpacer* Spacer = NewObject<USpacer>(this);
70 if (Spacer)
71 {
72 Spacer->SetSize(FVector2D(0.0f, 15.0f));
73 VerticalBox->AddChildToVerticalBox(Spacer);
74 }
75 }
76}
77
79{
80 ULevelWordGroup* WordGroup = CreateWidget<ULevelWordGroup>(this, WordGroupClass);
81 if (WordGroup)
82 {
84 VerticalBox->AddChildToVerticalBox(WordGroup);
85
86 USpacer* Spacer = NewObject<USpacer>(this);
87 if (Spacer)
88 {
89 Spacer->SetSize(FVector2D(0.0f, 15.0f));
90 VerticalBox->AddChildToVerticalBox(Spacer);
91 }
92 }
93}
94
96{
97 ULevelWordGroup* WordGroup = CreateWidget<ULevelWordGroup>(this, WordGroupClass);
98 if (WordGroup)
99 {
100 WordGroup->InitGroup(EWordType::Food, Level);
101 VerticalBox->AddChildToVerticalBox(WordGroup);
102 }
103}
104
105
107{
108 if (OnLevelSelected.IsBound())
109 OnLevelSelected.Execute(Level);
110}
EWordType 클래스를 선언합니다.
FString LevelName
레벨 이름
TObjectPtr< class UVerticalBox > VerticalBox
단어 그룹들이 배치될 Vertical Box
virtual void NativeConstruct() override
void InitLevelItem(int32 InLevel, const FString &InLevelName, int32 InPlayTime)
레벨 정보를 초기화하고 단어 그룹들을 생성
TObjectPtr< class UTextBlock > Txt_PlayTime
void OnSelectButtonClicked()
선택 버튼 클릭 이벤트
FOnLevelSelectedDelegate OnLevelSelected
레벨 선택 델리게이트
TObjectPtr< class UImageButton > Btn_Select
선택 버튼
int32 Level
현재 레벨
TSubclassOf< class ULevelWordGroup > WordGroupClass
생성할 WordGroup 위젯 클래스
TObjectPtr< class UTextBlock > Txt_Title
레벨 타이틀 텍스트 (Begginer, Intermediate 등)
int32 PlayTime
현재 레벨
특정 WordType의 단어 아이템들을 그룹으로 묶어서 표시하는 위젯
void InitGroup(EWordType InWordType, int32 InCurrentLevel)
그룹 정보를 초기화하고 아이템들을 생성