CustomUI๋ Unreal Engine 5 ํ๋ก์ ํธ์์ ๊ณตํต UMG ์์ ฏ ๊ธฐ๋ฐ ํด๋์ค, ํ์
/๋ฑ๋ก ์์ ฏ ๊ด๋ฆฌ, ๋ฒํผ ๊ณ์ด ์ปดํฌ๋ํธ, ๋ฆฌ์น ํ
์คํธ ํ์ดํ, ๋งํค(ํ๋ฅด๋) ์์ ฏ, String Table ์กฐํ ํฌํผ๋ฅผ ์ ๊ณตํ๋ ๋ฐํ์ UI ํ๋ฌ๊ทธ์ธ์ด๋ค.
์ด ๋ฌธ์๋ Plugins/CustomUIPlugin์ ํ์ฌ ์ฝ๋ ๊ธฐ์ค์ผ๋ก ์ ์ง๋๋ ๊ธฐ์ README๋ค. ์ค์ ์ฌ์ฉ ์ ์ฐจ ์ค์ฌ ๋ฌธ์๋ UserGuide.md๋ฅผ ์ฐธ๊ณ ํ๋ค.
- ํ๋ฌ๊ทธ์ธ์
CustomUI๋ฐํ์ ๋ชจ๋ ํ๋๋ก ๊ตฌ์ฑ๋๋ค. CommonLibraryํ๋ฌ๊ทธ์ธ์ ์์กดํ๋ค.- ์ ์ญ UI ์ค์ ์
UCustomUIDeveloperSettings์ ์ ์ฅํ๋ค. UWidgetSubsystem์ LocalPlayer ๋จ์๋ก ๋ฑ๋ก ์์ ฏ๊ณผ ํ์ ์คํ์ ๊ด๋ฆฌํ๋ค.UWidgetHelper๋ Blueprint/C++์์ ๋ฑ๋ก ์์ ฏ ์กฐํ, ํ์ ์ด๊ธฐ/๋ซ๊ธฐ, String Table ํ ์คํธ ์กฐํ๋ฅผ ์ ๊ณตํ๋ค.UWidgetBase๋Show/Idle/Hide์ํ์ShowAnim,IdleAnim,HideAnim์ ๋๋ฉ์ด์ ํ๋ฆ์ ํ์คํํ๋ค.UPopupBase๋OpenPopup์ผ๋ก Viewport์ ์ถ๊ฐ๋๊ณ ,Close์ ํ์ ์คํ์์ ์ ๋ฆฌ๋๋ค.UPageBase์ Page API๋ ํ์ฌFEATURE_PAGE=0์ด๊ณ Deprecated ์ฒ๋ฆฌ๋์ด ์ฌ์ฉํ์ง ์๋ ๊ฐ๋ ์ด๋ค.- ๋ฒํผ ๊ณ์ด์
UButtonBase๋ฅผ ๊ธฐ๋ฐ์ผ๋ก Click, Toggle, Radio, RadioButtonGroup์ ์ ๊ณตํ๋ค. UTypingRichTextBlock์ RichText ๋งํฌ์ ์ ์ ์งํ๋ฉด์ ๊ธ์ ๋จ์ ํ์ดํ์ ์ํํ๋ค.UMarqueeWidgetBase๋ ์ฌ๋กฏ ์ฝํ ์ธ ๋ฅผ ๊ฐ๋ก/์ธ๋ก๋ก ์คํฌ๋กค ๋๋ ์๋ณต ์คํฌ๋กคํ๋ค.
ํ๋ฌ๊ทธ์ธ์ CommonLibrary ํ๋ฌ๊ทธ์ธ์ ์์กดํ๋ค.
| ๋ชจ๋ | ์ญํ |
|---|---|
CustomUI |
๋ฐํ์ UI ๊ธฐ๋ฐ ํด๋์ค, LocalPlayer Subsystem, Widget Helper, Widget Registry, Popup ๊ด๋ฆฌ, ๋ฒํผ/ํ ์คํธ/๋งํค ์์ ฏ ์ปดํฌ๋ํธ |
CustomUI.Build.cs์ ์ฃผ์ ์์กด ๋ชจ๋:
Core,CoreUObject,EngineInputCoreUMGCommonLibraryDeveloperSettingsSlate,SlateCore(Private)
๋น๋ ์ ์:
| ์ ์ | ํ์ฌ ๊ฐ | ์๋ฏธ |
|---|---|---|
FEATURE_PAGE |
0 |
Page ์์คํ
๋นํ์ฑํ. UPageBase/OpenPage๋ Deprecated ๊ฒฝ๋ก๋ค. |
ํ์ผ: Source/CustomUI/Public/CustomUIDeveloperSettings.h
Project Settings์ ์ ์ฅ๋๋ ์ ์ญ ์ค์ ์ด๋ค.
| ์ค์ | ์๋ฏธ |
|---|---|
_StringTables |
UStringTableSubsystem์ด ์์ ์ ๋ก๋ํ String Table ๋ชฉ๋ก |
_WidgetRegistryDataAsset |
UWidgetSubsystem์ด ๋ฑ๋ก ์์ ฏ ๋ชฉ๋ก์ผ๋ก ์ฌ์ฉํ Data Asset |
ํ์ผ: Source/CustomUI/Public/StringTableSubsystem.h
UGameInstanceSubsystem์ด๋ค. ์์ ์ UCustomUIDeveloperSettings::_StringTables๋ฅผ ๋๊ธฐ ๋ก๋ํ๊ณ , String Table ์์
์ด๋ฆ์ StringTableId๋ก ๋งคํํ๋ค.
์ฃผ์ API:
FText UStringTableSubsystem::FindTextFromTable(const FString& _table_name, const FString& _key);UWidgetHelper::GetStringTableText์ GETTEXT(_table_name, _key) ๋งคํฌ๋ก๊ฐ ์ด API๋ฅผ ๊ฐ์ผ๋ค.
์ฃผ์:
_table_name์ ํ์ฌ ์ฝ๋์ String Table ์์ ์GetName()๊ธฐ์ค์ด๋ค.- ์ค์ ์ ์๋ ํ
์ด๋ธ ์ด๋ฆ์ ๋๊ธฐ๋ฉด ๋น
FName๊ธฐ๋ฐ์ผ๋ก ์กฐํ๋๋ฏ๋ก, Project Settings์_StringTables๋ฑ๋ก์ ๋จผ์ ํ์ธํด์ผ ํ๋ค.
ํ์ผ: Source/CustomUI/Public/WidgetRegistryDataAsset.h
๊ณต์ฉ ์์ ฏ ํด๋์ค๋ฅผ ์ด๋ฆ์ผ๋ก ๋ฑ๋กํ๋ Data Asset์ด๋ค.
| ๋ฐ์ดํฐ | ์๋ฏธ |
|---|---|
_WidgetClassMap |
FName -> TSubclassOf<UWidgetBase> ๋งคํ |
UWidgetSubsystem์ ์ด๊ธฐํ ์ ์ด ๋งต์ ์ฝ์ด _RegisteredWidgetDataMap์ ๋ง๋ ๋ค. GetRegisteredWidget ํธ์ถ ์ ์ธ์คํด์ค๊ฐ ์์ผ๋ฉด ์ง์ฐ ์์ฑํ๊ณ ์ดํ ๊ฐ์ ์ธ์คํด์ค๋ฅผ ์ฌ์ฌ์ฉํ๋ค.
ํ์ผ: Source/CustomUI/Public/WidgetSubsystem.h
ULocalPlayerSubsystem์ด๋ค. LocalPlayer/PlayerController ๊ธฐ์ค์ผ๋ก UI ์ธ์คํด์ค๋ฅผ ๊ด๋ฆฌํ๋ค.
์ฃผ์ ์ฑ ์:
- Widget Registry ๋ก๋ ๋ฐ ๋ฑ๋ก ์์ ฏ ์ง์ฐ ์์ฑ
- Popup ์์ฑ, Viewport ์ถ๊ฐ, ์คํ ๊ด๋ฆฌ
- Popup ์ค๋ณต/์ฐจ๋จ ๊ท์น ์ ์ฉ
- Level ๋ณ๊ฒฝ ๋๋ PlayerController ๋ณ๊ฒฝ ์ ๋จ๊ธธ Popup ๋ณต๊ตฌ
UInputSettings::DoubleClickTime์UClickButton๋๋ธํด๋ฆญ ์๊ณ๊ฐ์ผ๋ก ๋ฐ์- Page ์์คํ ์ฝ๋ ๋ณด์ (ํ์ฌ ๋นํ์ฑ/Deprecated)
์ฃผ์ ๋ด๋ถ ํ๋ฆ:
| ํจ์ | ์๋ฏธ |
|---|---|
Initialize |
Registry ์์ ฏ๊ณผ ๋ฒํผ ์ค์ ์ด๊ธฐํ |
PlayerControllerChanged |
๊ธฐ์กด UI ์ ๋ฆฌ ํ Remaining Page/Popup ๋ณต๊ตฌ |
GetRegisteredWidget |
Registry์ ๋ฑ๋ก๋ ์์ ฏ ์ธ์คํด์ค๋ฅผ ์ง์ฐ ์์ฑ/๋ฐํ |
OpenPopup |
Popup ์์ ฏ ์์ฑ, EWidgetZOrder::Popup์ผ๋ก Viewport ์ถ๊ฐ |
OnHidePopup |
RemoveFromParent๋ก ๋ซํ Popup์ ์คํ๊ณผ Remaining ๋ชฉ๋ก์์ ์ ๊ฑฐ |
GetTopPopup |
ํ์ฌ ํ์ ์คํ์ ๋ง์ง๋ง Popup ๋ฐํ |
CheckCanOpenPopup |
์ ํจ์ฑ, ์ค๋ณต ํ์ฉ, ์๋จ Popup์ IgnoreOtherPopup ๊ท์น ๊ฒ์ฌ |
ํ์ผ: Source/CustomUI/Public/WidgetHelper.h
Blueprint/C++์์ ์ฌ์ฉํ๋ ์ ์ ํฌํผ๋ค.
| ํจ์ | ์๋ฏธ |
|---|---|
IsDesignTime |
์์ ฏ์ Design Time ์ฌ๋ถ ํ์ธ |
GetStringTableText |
๋ฑ๋ก๋ String Table์์ FText ์กฐํ |
GetRegisteredWidget |
Registry์ ๋ฑ๋ก๋ ๊ณต์ฉ ์์ ฏ ์ธ์คํด์ค ์กฐํ |
OpenPopup |
Popup Class๋ก Popup ์ด๊ธฐ |
ClosePopup |
Popup ๋ซ๊ธฐ |
GetTopPopup |
ํ์ฌ ์ต์๋จ Popup ์กฐํ |
OpenPage |
Deprecated. FEATURE_PAGE=0์์๋ ๋์ํ์ง ์์ |
C++ ํ ํ๋ฆฟ ์ค๋ฒ๋ก๋๋ ๊ตฌ์ฒด ํ์ ๋ฐํ์ ๋๋๋ค.
auto Popup = UWidgetHelper::OpenPopup<UMyPopup>(this, UMyPopup::StaticClass());ํ์ผ: Source/CustomUI/Public/WidgetPlayerController.h
BeginPlay์์ ์ด๊ธฐ Input Mode์ Mouse Cursor ์ํ๋ฅผ ์ ์ฉํ๋ PlayerController ๊ธฐ๋ฐ ํด๋์ค๋ค.
| ์ค์ | ์๋ฏธ |
|---|---|
_InitialInputMode |
GameAndUI, GameOnly, UIOnly ์ค ์ด๊ธฐ ์
๋ ฅ ๋ชจ๋ |
_InMouseLockMode |
UI/GameAndUI ๋ชจ๋์์ ๋ง์ฐ์ค ๋ฝ ๋ฐฉ์ |
_HideCursorDuringCapture |
GameAndUI ์ ๋ ฅ ์ค ์บก์ฒ ์ ์ปค์ ์จ๊น ์ฌ๋ถ |
_ConsumeCaptureMouseDown |
GameOnly ์ ๋ ฅ ๋ชจ๋์์ ์บก์ฒ ๋ง์ฐ์ค ๋ค์ด ์๋น ์ฌ๋ถ |
_ShowMouseCursor |
BeginPlay ํ ์ปค์ ํ์ ์ฌ๋ถ |
_InitialPageClass |
Deprecated. Page ์์คํ ์ฉ ์์ฌ ์ค์ |
UWidgetSubsystem::OpenPopup์ LocalPlayer์ PlayerController๋ฅผ AWidgetPlayerController๋ก ์บ์คํ
ํ๋ค. ํ์
์์คํ
์ ์ฌ์ฉํ๋ ค๋ฉด ํ๋ก์ ํธ PlayerController๊ฐ ์ด ํด๋์ค๋ฅผ ์์ํ๋ ๊ฒ์ด ์์ ํ๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/WidgetBase.h
๋ชจ๋ CustomUI ์์ ฏ์ ๊ธฐ๋ณธ ํด๋์ค๋ค. UUserWidget ์์ ํ์/์จ๊น ์ํ, ์ ๋๋ฉ์ด์
, ์ฌ์ด๋, ์ด๋ฒคํธ๋ฅผ ์น๋๋ค.
์ฃผ์ ๋ฐ์ดํฐ:
| ๋ฐ์ดํฐ | ์๋ฏธ |
|---|---|
_WidgetID |
Registry/๊ทธ๋ฃน ์ ํ ๋ฑ์ ์ฌ์ฉํ๋ ์์ ฏ ์๋ณ์ |
_IsPreventInitialFlicker |
ShowAnim์ด ์์ ๋ ์ฒซ ํ๋ ์ Opacity 0์ผ๋ก ๊น๋นก์ ๋ฐฉ์ง |
_IsTraverseWidgetToShow |
Show ์ ํ์ UWidgetBase๋ค๋ Showing ์ํ๋ก ์ํํ ์ง |
ShowAnim |
์ ํ์ Show ์ ๋๋ฉ์ด์
. BindWidgetAnimOptional |
IdleAnim |
์ ํ์ Idle ๋ฐ๋ณต/์ํ ์ ๋๋ฉ์ด์ |
HideAnim |
์ ํ์ Hide ์ ๋๋ฉ์ด์ |
_ShowAnimConfig, _IdleAnimConfig, _HideAnimConfig |
์ ๋๋ฉ์ด์ ์ฌ์ ๋ฐฉํฅ/๋ณต์ ์ค์ |
_ShowSound, _HideSound |
Show/Hide ์ฌ์ด๋ |
์ํ:
| ์ํ | ์๋ฏธ |
|---|---|
Hide |
์จ๊น/์ ๊ฑฐ ์ํ |
Showing |
ShowAnim ์ฌ์ ์ค ๋๋ Show ์ง์ ์ค |
Idle |
ํ์ ์๋ฃ ์ํ |
Hiding |
HideAnim ์ฌ์ ์ค |
์ฃผ์ API:
void Show(EWidgetShowType _show_type, bool _is_skip_anim = false);
void Hide(EWidgetHideType _hide_type, bool _is_skip_anim = false);
void Close(bool _is_skip_anim = false);
EWidgetState GetWidgetState() const;์ด๋ฒคํธ:
| ์ด๋ฒคํธ | ํธ์ถ ์์ |
|---|---|
_OnShowEvent / OnShow |
Showing ์ง์
์งํ |
_OnIdleEvent / OnIdle |
ํ์ ์๋ฃ ํ Idle ์ง์
|
_OnStartHideEvent / OnStartHide |
Hide/Close ์์ฒญ ์งํ |
_OnHideEvent / OnHide |
์ค์ ์จ๊น/์ ๊ฑฐ ์ง์ |
OnSynchronizeProperties |
SynchronizeProperties์์ Blueprint๋ก ์ ๋ฌ |
์ค์ ์ ์ฑ :
- ์ง์
SetVisibility๋ฅผ ํธ์ถํ๋ฉด ๊ฒฝ๊ณ ๋ฅผ ์ถ๋ ฅํ๋ค. ํ์/์จ๊น์Show,Hide,Close๋ฅผ ์ฌ์ฉํ๋ค. Close()๋Hide(EWidgetHideType::RemoveFromParent)์ ๊ฐ๋ค.Hide(Collapsed/Hidden)๋ Viewport์์ ์ ๊ฑฐํ์ง ์๊ณ Visibility๋ง ๋ณ๊ฒฝํ๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/PopupBase.h
Popup ์ ์ฉ ๊ธฐ๋ณธ ํด๋์ค๋ค. UWidgetBase๋ฅผ ์์ํ๊ณ Construct ์ Focusable์ true๋ก ์ค์ ํ๋ค.
์ค์ :
| ์ค์ | ์๋ฏธ |
|---|---|
_PopupConfig.IgnoreOtherPopup |
์ด Popup์ด ์ด๋ ค ์๋ ๋์ ๋ค๋ฅธ Popup ์ด๊ธฐ๋ฅผ ์ฐจ๋จ |
_PopupConfig.AllowDuplicate |
๊ฐ์ Popup Class ์ค๋ณต ์ด๊ธฐ ํ์ฉ |
_PopupConfig.ShowMouseCursor |
Popup์ด ์ด๋ ธ์ ๋ PlayerController ์ปค์ ํ์ ์ฌ๋ถ |
_PopupConfig.RemainOnLevelChanged |
PlayerController ๋ณ๊ฒฝ/๋ ๋ฒจ ๋ณ๊ฒฝ ํ ๋ค์ ์ด Popup ๋ชฉ๋ก์ ์ ์ง |
ํ์ผ: Source/CustomUI/Public/Widgets/PageBase.h
๊ณผ๊ฑฐ Page ์์คํ
์ฉ ๊ธฐ๋ณธ ํด๋์ค๋ค. ํ์ฌ FEATURE_PAGE=0์ผ๋ก ๋น๋๋๋ฉฐ ํด๋์ค์ Helper API๊ฐ Deprecated ์ฒ๋ฆฌ๋์ด ์๋ค.
ํ์ฌ ์ ์ฑ :
- ์ ๊ท UI๋
UWidgetBase๋๋UPopupBase๋ฅผ ์ฌ์ฉํ๋ค. OpenPage๊ฒฝ๋ก์ ์์กดํ์ง ์๋๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/Components/ButtonBase.h
Click/Toggle/Radio ๋ฒํผ์ ๊ณตํต ๊ธฐ๋ฐ์ด๋ค.
ํ์ BindWidget ๊ตฌ์ฑ:
| ์ด๋ฆ | ํ์ | ์๋ฏธ |
|---|---|---|
SizeBox |
USizeBox |
๊ณ ์ ํญ/๋์ด ์ ์ฉ |
Border |
UBorder |
์ํ๋ณ Brush/ContentColor ์ ์ฉ |
NS_Content |
UNamedSlot |
๋ฒํผ ๋ด๋ถ ์ฝํ ์ธ ์ฌ๋กฏ |
์ํ:
NormalHoveredPressedDisabled
์ฃผ์ ๊ธฐ๋ฅ:
_StateStyles๋ก ์ํ๋ณ Brush/ContentColor ์ ์ฉ_UseFixedWidth,_UseFixedHeight,_FixedSize๋ก ํฌ๊ธฐ ์ ์ด_ContentHorizontalAlignment,_ContentVerticalAlignment,_ContentPadding์ผ๋ก ์ฝํ ์ธ ์ ๋ ฌ/ํจ๋ฉ ์ ์ด_HoverSound,_ClickSound์ฌ์_OnClicked,_OnButtonStateChanged์ด๋ฒคํธ ์ ๊ณตSetButtonDisabled๋ก Disabled ์ํ ์ ํ
์ ์ฑ :
SetIsEnabled(false)๋์SetButtonDisabled(true)์ฌ์ฉ์ ๊ถ์ฅํ๋ฉฐ, ์ง์ ๋นํ์ฑํ ์ ๊ฒฝ๊ณ ๋ฅผ ์ถ๋ ฅํ๋ค.- ๊ธฐ๋ณธ ํด๋ฆญ ํค๋
LeftMouseButton์ด๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/Components/ClickButton.h
์ผ๋ฐ ํด๋ฆญ ๋ฒํผ์ด๋ค.
์ถ๊ฐ ๊ธฐ๋ฅ:
- ์ขํด๋ฆญ
_OnClicked - ์ฐํด๋ฆญ ๋ฑ ๋ณด์กฐ ํด๋ฆญ
_OnSubClicked - ๋๋ธํด๋ฆญ
_OnDoubleClicked _DontResetButtonStateOnMouseLeaveWhenPressed_UseSubClick_SubClickSound
์ ์ฑ :
- ๋ณด์กฐ ํด๋ฆญ ๊ธฐ๋ณธ ํค๋
RightMouseButton์ด๋ค. - ๋๋ธํด๋ฆญ ์๊ณ๊ฐ์
UInputSettings::DoubleClickTime์ผ๋ก ์ด๊ธฐํ๋๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/Components/ToggleButton.h
ํด๋ฆญํ ๋ ์ ํ ์ํ๋ฅผ ํ ๊ธํ๋ ๋ฒํผ์ด๋ค.
์ฃผ์ API:
void SetIsSelected(bool _is_selected, bool _force_update = false);
bool ToggleSelected();
bool GetIsSelected() const;์ ํ ์ํ์ผ ๋๋ _SelectedStateStyles๋ฅผ ์ฐ์ ์ ์ฉํ๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/Components/RadioButton.h
๊ทธ๋ฃน ์์์ ํ๋๋ง ์ ํ๋๋ ๋ฒํผ์ด๋ค. ๊ฐ๋ณ ๋ฒํผ์ _IsSelected์ _SelectedStateStyles๋ฅผ ๊ฐ์ง๋ค.
์ฃผ์ API:
void SetIsSelected(bool _is_selected, bool _force_update = false);
bool GetIsSelected() const;ํด๋ฆญ ์ _OnClicked๋ฅผ Broadcastํ๊ณ ์์ ์ ์ ํ ์ํ๋ก ๋ง๋ ๋ค. ์ผ๋ฐ์ ์ผ๋ก URadioButtonGroup ์์์ ์ฌ์ฉํ๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/Components/RadioButtonGroup.h
์ฌ๋ฌ URadioButton์ ํ๋์ ์ ํ ๊ทธ๋ฃน์ผ๋ก ๊ด๋ฆฌํ๋ค.
ํ์ BindWidget ๊ตฌ์ฑ:
| ์ด๋ฆ | ํ์ | ์๋ฏธ |
|---|---|---|
StackBox |
UStackBox |
RadioButton ์์๋ค์ ๋ด๋ ์ปจํ ์ด๋ |
์ฃผ์ ๊ธฐ๋ฅ:
StackBoxOrientation ์ค์ - ๋ฒํผ ์ฌ๋กฏ Padding/Alignment/SizeRule ์ ์ฉ
- ์์์ด
URadioButton์ด ์๋๋ฉด ์ค๋ฅ ์ถ๋ ฅ WidgetID๋๋ Index๋ก ์ ํ- ์ ํ ์
_OnRadioButtonSelectedBroadcast
์ฃผ์ API:
void SelectRadioButtonByWidgetID(FName _widget_id);
void SelectRadioButtonByIndex(int32 _index);์ฃผ์:
SelectRadioButtonByWidgetID๋ฅผ ์ฐ๋ ค๋ฉด ๊ฐURadioButton์_WidgetID๊ฐ ์ค์ ๋์ด ์์ด์ผ ํ๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/Components/TypingRichTextBlock.h
URichTextBlock์ ์์ํ ํ์ดํ ํ
์คํธ ์ปดํฌ๋ํธ๋ค.
์ฃผ์ ๋ฐ์ดํฐ:
| ๋ฐ์ดํฐ | ์๋ฏธ |
|---|---|
_AutoStart |
๋ฐํ์ SynchronizeProperties ํ ์๋ ํ์ดํ ์์ |
_FullText |
์ ์ฒด ํ ์คํธ |
_TypingSpeed |
์ด๋น ์ถ๋ ฅ ํ ํฐ ์. ์ต์ 1๋ก ๋ณด์ |
์ฃผ์ API:
void StartTyping(bool _is_resume);
void StopTyping(bool _is_clear);
void SetTypingSpeed(float _speed);
bool GetIsTyping() const;
float GetTypingSpeed() const;๋งํฌ์ ์ฒ๋ฆฌ:
<Style>๋ฌธ์</>ํํ์ RichText ์คํ์ผ์ ๊ฐ ๋ฌธ์ ํ ํฐ์ ๋ค์ ๊ฐ์ธ์ ๋์ ํ์ํ๋ค.\r\n,\r,\n์ ์ค๋ฐ๊ฟ ํ ํฐ์ผ๋ก ์ ์งํ๋ค.<img .../>๊ฐ์ ์ ํ ํด๋ก์ง ํ๊ทธ๋ ํ๋์ ํ ํฐ์ผ๋ก ์ ์งํ๋ค.- Design Time์์๋ ์ ์ฒด ํ ์คํธ๋ฅผ ์ฆ์ ํ์ํ๋ค.
ํ์ผ: Source/CustomUI/Public/Widgets/MarqueeWidgetBase.h
NamedSlot ์ฝํ ์ธ ๋ฅผ ๊ฐ๋ก/์ธ๋ก๋ก ์์ง์ด๋ ๋งํค ์์ ฏ์ด๋ค.
ํ์ BindWidget ๊ตฌ์ฑ:
| ์ด๋ฆ | ํ์ | ์๋ฏธ |
|---|---|---|
CanvasPanel |
UCanvasPanel |
์ฝํ
์ธ ๊ฐ ์๋ฆด ์์ญ. ์๋์ผ๋ก ClipToBounds ์ค์ |
NS_Content |
UNamedSlot |
์ด๋ํ ์ฝํ ์ธ ์ฌ๋กฏ |
์ค์ :
| ์ค์ | ์๋ฏธ |
|---|---|
_MarqueeType |
NA, Scroll, AlternateScroll |
_Orientation |
Horizontal ๋๋ Vertical |
_IsReverse |
์ด๋ ๋ฐฉํฅ ๋ฐ์ |
_MarqueeSpeed |
์ด๋ ์๋ |
_DelayTime |
๋์ ๋๋ฌ ํ ๋๊ธฐ ์๊ฐ |
ํ์ :
Scroll: ์ฝํ ์ธ ๊ฐ ์์ญ ๋ฐ์์ ๋ฐ๋์ชฝ ๋ฐ๊น์ง ํ๋ฅธ ๋ค ์์ ์์น๋ก ๋์๊ฐ๋ค.AlternateScroll: ์์ญ ์์์ ์์์ ๊ณผ ๋์ ์ ์๋ณตํ๋ค.
ํ์ผ: Source/CustomUI/Public/AdvancedDragDropOperation.h
UDragDropOperation์ ๋๋๊ทธ ์์/๋ก์ปฌ ์คํ์
์ ๋ณด๋ฅผ ์ถ๊ฐํ ๊ฐ๋จํ ๋ฐ์ดํฐ ํด๋์ค๋ค.
| ๋ฐ์ดํฐ | ์๋ฏธ |
|---|---|
_LocalOffset |
์์ ฏ ๋ด๋ถ์์ Pivot ๊ธฐ์ค ๋ง์ฐ์ค Offset |
_DragStartScreenPos |
๋๋๊ทธ ์์ Screen Position |
UWidgetSubsystem์ด ์ด๊ธฐํ๋๋ค.UCustomUIDeveloperSettings::_WidgetRegistryDataAsset์ ๋๊ธฐ ๋ก๋ํ๋ค.- Registry์
_WidgetClassMap์FName -> Class๋ก ์ ์ฅํ๋ค. UWidgetHelper::GetRegisteredWidget(WorldContext, WidgetName)ํธ์ถ ์ ์ธ์คํด์ค๊ฐ ์์ผ๋ฉด ์์ฑํ๋ค.- ์์ฑ๋ ์ธ์คํด์ค๋ ๊ฐ์ LocalPlayer Subsystem ์์์ ์ฌ์ฌ์ฉ๋๋ค.
๋ฑ๋ก ์์ ฏ์ ๋ฐํ๋ง ํ๋ค. Viewport ์ถ๊ฐ, ๋ถ๋ชจ ํจ๋ ๋ฐฐ์น, ์ด๋ฒคํธ ๋ฐ์ธ๋ฉ/ํด์ ๋ ํธ์ถ์๊ฐ ์ฒ๋ฆฌํ๋ค.
UWidgetHelper::OpenPopupํธ์ถ- LocalPlayer์
UWidgetSubsystem์กฐํ - PlayerController๋ฅผ
AWidgetPlayerController๋ก ์บ์คํ - Popup Class ์ ํจ์ฑ ๊ฒ์ฌ
AllowDuplicate == false๋ฉด ๊ฐ์ Class๊ฐ ์ด๋ฏธ ์ด๋ ค ์๋์ง ๊ฒ์ฌ- ์ต์๋จ Popup์
IgnoreOtherPopup์ด true๋ฉด ์ Popup ์ด๊ธฐ ์ฐจ๋จ CreateWidget<UPopupBase>์คํ- Popup
_OnHideEvent์ Subsystem ์ ๋ฆฌ ์ฝ๋ฐฑ ๋ฐ์ธ๋ฉ EWidgetZOrder::Popup์ผ๋ก Viewport ์ถ๊ฐRemainOnLevelChanged์ด๋ฉด Remaining ๋ชฉ๋ก์ Class ๋ณด๊ด- Popup ์ค์ ์ ๋ง์ถฐ PlayerController Mouse Cursor ๊ฐฑ์
_CurrentPopups์คํ์ ์ถ๊ฐ
UWidgetHelper::ClosePopup(Popup, SkipAnim)๋๋Popup->Close(SkipAnim)ํธ์ถUWidgetBase::Hide(RemoveFromParent)์คํ- HideAnim์ด ์์ผ๋ฉด ์ฌ์, ์๊ฑฐ๋ skip์ด๋ฉด ์ฆ์ Hide ์ํ
_OnHideEventBroadcast- Subsystem์ด RemoveFromParent ๋ซํ์ ๊ฐ์งํด ์คํ/Remaining ๋ชฉ๋ก์์ ์ ๊ฑฐ
- ๋ค์ ์ต์๋จ Popup ๋๋ PlayerController ๊ธฐ๋ณธ๊ฐ์ ๋ฐ๋ผ Mouse Cursor ๊ฐฑ์
์ฃผ์:
- Popup์
Hide(Collapsed/Hidden)์ผ๋ก ์จ๊ธฐ๋ฉด RemoveFromParent๊ฐ ์๋๋ฏ๋ก_CurrentPopups์์ ์ ๊ฑฐ๋์ง ์๋๋ค. - ํ์
์คํ ์ ๋ฆฌ๊น์ง ๊ธฐ๋ํ๋ค๋ฉด
Close()๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์์ ํ๋ค.
Show:
Show() -> Visibility ์ค์ -> Showing -> OnShow/_OnShowEvent -> ShowAnim -> Idle -> OnIdle/_OnIdleEvent
Hide/Close:
Hide()/Close() -> OnStartHide/_OnStartHideEvent -> Hiding -> HideAnim -> Hide -> OnHide/_OnHideEvent -> Remove/Collapsed/Hidden
_IsTraverseWidgetToShow๊ฐ true์ด๋ฉด Show ์ง์
์ ํ์ ์ค์ธ ํ์ UWidgetBase๋ค๋ Showing ์ํ๋ก ์ํํ๋ค. WidgetSwitcher์ ๋นํ์ฑ ์์์ ์ํํ์ง ์๋๋ค.
ํ๋ฌ๊ทธ์ธ์ CanContainContent=true์ด๋ฉฐ ์ํ ์ฝํ
์ธ ๋ฅผ ํฌํจํ๋ค.
์ฃผ์ ์ํ ๊ฒฝ๋ก:
| ๊ฒฝ๋ก | ๋ด์ฉ |
|---|---|
Content/Sample/DA_SampleWidgetRegistry.uasset |
Widget Registry ์ํ Data Asset |
Content/Sample/L_Sample.umap |
์ํ ๋ ๋ฒจ |
Content/Sample/L_Sample2.umap |
์ํ ๋ ๋ฒจ 2 |
Content/Sample/Widgets/... |
Popup, Button, Toggle, Radio, Marquee ๋ฑ ์ํ ์์ ฏ Blueprint |
Content/Sample/RichTextBlock/... |
RichText ์คํ์ผ/์ด๋ฏธ์ง ๋ฐ์ฝ๋ ์ดํฐ ์ํ |
Content/Sample/ST_Sample.uasset |
String Table ์ํ |
FEATURE_PAGE=0์ด๋ฏ๋ก Page ์์คํ ์ ๋นํ์ฑํ๋์ด ์๋ค.UPageBase์UWidgetHelper::OpenPage๋ Deprecated ๊ฒฝ๋ก๋ค.OpenPopup์AWidgetPlayerController์บ์คํ ์ ์์กดํ๋ค.GetRegisteredWidget์ ์์ ฏ์ ์์ฑ/๋ฐํ๋ง ํ๋ฉฐ ์๋์ผ๋ก Viewport์ ์ถ๊ฐํ์ง ์๋๋ค.- Registry์ String Table์ ์ค์ ๋ Soft Object๋ฅผ ์ด๊ธฐํ ์ ๋๊ธฐ ๋ก๋ํ๋ค.
SetVisibility์SetIsEnabled(false)๋ ์ง์ ์ฌ์ฉ๋ณด๋คShow/Hide์SetButtonDisabled์ฌ์ฉ์ ๊ถ์ฅํ๋ค.GETTEXT๋งคํฌ๋ก๋ ๋์ ์ธ๋ฏธ์ฝ๋ก ์ด ํฌํจ๋์ด ์์ผ๋ฏ๋ก ํํ์ ์์น์์ ์ฌ์ฉํ ๋ ์ฃผ์ํ๋ค.- Editor ์ ์ฉ ๋ชจ๋์ด๋ ์ ์ฉ Asset Factory๋ ์ ๊ณตํ์ง ์๋๋ค. Data Asset/Widget Blueprint๋ ์ผ๋ฐ Unreal ์์ฑ ํ๋ฆ์ ์ฌ์ฉํ๋ค.
CustomUI.Build.csWidgetDefines.hCustomUIDeveloperSettings.hWidgetRegistryDataAsset.hWidgetSubsystem.h/.cppWidgetHelper.h/.cppStringTableSubsystem.h/.cppWidgets/WidgetBase.h/.cppWidgets/PopupBase.h/.cppWidgets/Components/ButtonBase.h/.cppWidgets/Components/ClickButton.h/.cppWidgets/Components/ToggleButton.h/.cppWidgets/Components/RadioButton.h/.cppWidgets/Components/RadioButtonGroup.h/.cppWidgets/Components/TypingRichTextBlock.h/.cppWidgets/MarqueeWidgetBase.h/.cppWidgetPlayerController.h/.cppAdvancedDragDropOperation.h/.cpp
- User Guide โ ํ๋ฌ๊ทธ์ธ์ ์ฌ์ฉํ๋ ๋์์ด๋/๊ฐ๋ฐ์์ฉ ์์ ๊ฐ์ด๋