KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
UPopup_MsgBox.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
4#include "UPopup_MsgBox.h"
5
6#include "UImageButton.h"
7#include "UTextureButton.h"
8#include "UPopupManager.h"
9#include "Components/Spacer.h"
10#include "Components/TextBlock.h"
11
13{
14 Super::NativeConstruct();
15}
16
17void UPopup_MsgBox::SetTitle(const FString& InTitle) { Txt_Title->SetText(FText::FromString(InTitle)); }
18void UPopup_MsgBox::SetDesc(const FString& InDescription) { Txt_Desc->SetText(FText::FromString(InDescription)); }
19
21{
22 // 중복 바인딩 방지: 기존 바인딩 제거 후 재바인딩
23 if (Btn_Close)
24 {
27 }
28 if (Btn_Ok)
29 {
32 }
33 if (Btn_Cancel)
34 {
37 }
38
39 switch (InType)
40 {
41 case EMsgBoxType::OK:
42 Btn_Ok->SetVisibility(ESlateVisibility::Visible);
43 Btn_Cancel->SetVisibility(ESlateVisibility::Collapsed);
44 Spacing_OkCancel->SetVisibility(ESlateVisibility::Collapsed);
45 break;
46
48 Btn_Ok->SetVisibility(ESlateVisibility::Visible);
49 Btn_Cancel->SetVisibility(ESlateVisibility::Visible);
50 Spacing_OkCancel->SetVisibility(ESlateVisibility::Visible);
51 break;
52 }
53}
54
56{
57 // PopupManager를 통해 팝업 닫기 (마우스 커서 처리 포함)
58 if (UPopupManager* PopupMgr = UPopupManager::Get(GetWorld()))
59 {
60 PopupMgr->HideCurrentPopup();
61 }
62
63 if (OnOkDelegate.IsBound())
64 OnOkDelegate.Execute();
65}
66
68{
69 // PopupManager를 통해 팝업 닫기 (마우스 커서 처리 포함)
70 if (UPopupManager* PopupMgr = UPopupManager::Get(GetWorld()))
71 {
72 PopupMgr->HideCurrentPopup();
73 }
74
75 if (OnCancelDelegate.IsBound())
76 OnCancelDelegate.Execute();
77}
78
79
81 const FString& InTitle,
82 const FString& InDescription,
83 EMsgBoxType InType,
84 const FOnMsgBoxOkDelegate& InOkDelegate)
85{
86 this->SetTitle(InTitle);
87 this->SetDesc(InDescription);
88 this->InitButton(InType);
89
90 OnOkDelegate = InOkDelegate;
91 OnCancelDelegate.Unbind();
92}
93
95 const FString& InTitle,
96 const FString& InDescription,
97 EMsgBoxType InType,
98 const FOnMsgBoxOkDelegate& InOkDelegate,
99 const FOnMsgBoxCancelDelegate& InCancelDelegate )
100{
101 this->SetTitle(InTitle);
102 this->SetDesc(InDescription);
103 this->InitButton(InType);
104
105 OnOkDelegate = InOkDelegate;
106 OnCancelDelegate = InCancelDelegate;
107}
EMsgBoxType
Definition EPopupType.h:49
FOnImageButtonClickedEvent OnButtonClickedEvent
버튼 클릭 시 발생하는 이벤트
팝업 관리자
void InitPopup(const FString &InTitle, const FString &InDescription, EMsgBoxType InType, const FOnMsgBoxOkDelegate &InOkDelegate, const FOnMsgBoxCancelDelegate &InCancelDelegate)
virtual void NativeConstruct() override
FOnMsgBoxOkDelegate OnOkDelegate
class UImageButton * Btn_Ok
class UTextBlock * Txt_Desc
void InitButton(EMsgBoxType InType)
class UTextureButton * Btn_Close
FOnMsgBoxCancelDelegate OnCancelDelegate
class USpacer * Spacing_OkCancel
void SetTitle(const FString &InTitle)
class UTextBlock * Txt_Title
void SetDesc(const FString &InDescription)
class UImageButton * Btn_Cancel
FOnTextureButtonClickedEvent OnButtonClickedEvent
버튼 클릭 이벤트