KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
ChatBoxWidget.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 "ChatBoxWidget.h"
5
7#include "UGameDataManager.h"
8#include "Components/Border.h"
9#include "Components/Image.h"
10#include "Components/TextBlock.h"
11
12void UChatBoxWidget::SetPlayerName(FText InPlayerName)
13{
14 Txt_Name->SetText(InPlayerName);
15}
16
17void UChatBoxWidget::SetMessage(FText InMessage)
18{
19 Txt_Message->SetText(InMessage);
20
21 // 여러 줄 텍스트의 경우 레이아웃을 강제로 갱신
22 ForceLayoutPrepass();
23
24 // 메시지를 포함하는 Border의 레이아웃 무효화
25 Border_ChatBubble->InvalidateLayoutAndVolatility();
26}
27
29 FLinearColor InBgColor,
30 EResourceTextureType InProfileType)
31{
32 Border_ProfileBG->SetBrushColor(InBgColor);
33
34 UTexture2D* Texture = UGameDataManager::Get(this)->GetTexture(InProfileType);
35 if (!Texture)
36 return;
37
38 FSlateBrush Brush = Image_Profile->GetBrush();
39 Brush.SetResourceObject(Texture);
40 Image_Profile->SetBrush(Brush);
41}
42
44{
45 auto BubbleColor = IsMine ? FLinearColor::Green : FLinearColor::White;
46
47 Txt_Name->SetColorAndOpacity(BubbleColor);
48 Image_ChatTail->SetColorAndOpacity(BubbleColor);
49 Border_ChatBubble->SetContentColorAndOpacity(BubbleColor);
50}
EResourceTextureType
UGameDataManager 클래스를 선언합니다.
TObjectPtr< class UBorder > Border_ChatBubble
TObjectPtr< class UBorder > Border_ProfileBG
TObjectPtr< class UImage > Image_Profile
TObjectPtr< class UTextBlock > Txt_Name
void SetMessage(FText InMessage)
void SetPlayerName(FText InPlayerName)
void SetPlayerProfile(FLinearColor InBgColor, EResourceTextureType InProfileType)
TObjectPtr< class UImage > Image_ChatTail
void SetChatBubbleColor(bool IsMine) const
TObjectPtr< class UTextBlock > Txt_Message