Space Plunder
Loading...
Searching...
No Matches
UChatTextWidget Class Reference

#include <ChatTextWidget.h>

Inheritance diagram for UChatTextWidget:

Public Member Functions

virtual void NativeConstruct () override
 
void SetTypeColor ()
 
ESlateVisibility PrefixVisibility ()
 
void StartTimeoutText (const float Lifetime)
 

Public Attributes

FString PlayerName
 
FString ChatMessage
 
EChatSystemCategory ChatCategory
 
EChatSystemMessageType MessageType
 
bool bPlayerOwnedChat = false
 

Protected Attributes

class UTextBlock * PlayerNameTextBlock
 
class UTextBlock * ChatTextBlock
 
class UTextBlock * TimeTextBlock
 
class UTextBlock * PrefixTextBlock
 

Private Member Functions

void TimeoutText ()
 

Private Attributes

FTimerHandle LifetimeTimerHandle
 

Member Function Documentation

◆ NativeConstruct()

void UChatTextWidget::NativeConstruct ( )
overridevirtual
10{
11 Super::NativeConstruct();
12 PlayerNameTextBlock->SetText(FText::FromString(PlayerName));
13 const FDateTime CurrentTime = UKismetMathLibrary::Now();
14 const FText FormattedCurrentTime = FText::Format( NSLOCTEXT("","","{0}:{1}"),
15 FText::AsNumber(CurrentTime.GetHour()),
16 FText::AsNumber(CurrentTime.GetMinute()));
17 TimeTextBlock->SetText(FormattedCurrentTime);
18 ChatTextBlock->SetText(FText::FromString(ChatMessage));
19 const UEnum* ChatCategoryEnum = StaticEnum<EChatSystemCategory>();
20 if(ChatCategoryEnum == nullptr){return;}
21 ChatCategoryEnum->GetDisplayValueAsText(ChatCategory);
22 const FText FormattedPrefix = FText::Format(NSLOCTEXT("","","[{0}]"),
23 ChatCategoryEnum->GetDisplayValueAsText(ChatCategory));
24 PrefixTextBlock->SetText(FormattedPrefix);
26 // PrefixTextBlock->VisibilityDelegate.BindUFunction(GetOwningPlayer(), FName("PrefixVisibility"));
27}
FString PlayerName
Definition ChatTextWidget.h:28
class UTextBlock * PlayerNameTextBlock
Definition ChatTextWidget.h:44
class UTextBlock * TimeTextBlock
Definition ChatTextWidget.h:48
class UTextBlock * PrefixTextBlock
Definition ChatTextWidget.h:50
void SetTypeColor()
Definition ChatTextWidget.cpp:29
class UTextBlock * ChatTextBlock
Definition ChatTextWidget.h:46
FString ChatMessage
Definition ChatTextWidget.h:30
EChatSystemCategory ChatCategory
Definition ChatTextWidget.h:32

◆ PrefixVisibility()

ESlateVisibility UChatTextWidget::PrefixVisibility ( )
42{
44 {
45 return ESlateVisibility::Visible;
46 }
47 return ESlateVisibility::Collapsed;
48}
EChatSystemMessageType MessageType
Definition ChatTextWidget.h:34

◆ SetTypeColor()

void UChatTextWidget::SetTypeColor ( )
30{
36 {
38 }
39}
static FLinearColor GetMessageColor(EChatSystemMessageType MessageType)
Definition ChatBPLib.cpp:6
bool bPlayerOwnedChat
Definition ChatTextWidget.h:37

◆ StartTimeoutText()

void UChatTextWidget::StartTimeoutText ( const float Lifetime)
51{
52 GetWorld()->GetTimerManager().SetTimer(LifetimeTimerHandle, this, &UChatTextWidget::TimeoutText, Lifetime);
53}
FTimerHandle LifetimeTimerHandle
Definition ChatTextWidget.h:53
void TimeoutText()
Definition ChatTextWidget.cpp:55

◆ TimeoutText()

void UChatTextWidget::TimeoutText ( )
private
56{
57 RemoveFromParent();
58}

Member Data Documentation

◆ bPlayerOwnedChat

bool UChatTextWidget::bPlayerOwnedChat = false

◆ ChatCategory

EChatSystemCategory UChatTextWidget::ChatCategory

◆ ChatMessage

FString UChatTextWidget::ChatMessage

◆ ChatTextBlock

class UTextBlock* UChatTextWidget::ChatTextBlock
protected

◆ LifetimeTimerHandle

FTimerHandle UChatTextWidget::LifetimeTimerHandle
private

◆ MessageType

EChatSystemMessageType UChatTextWidget::MessageType

◆ PlayerName

FString UChatTextWidget::PlayerName

◆ PlayerNameTextBlock

class UTextBlock* UChatTextWidget::PlayerNameTextBlock
protected

◆ PrefixTextBlock

class UTextBlock* UChatTextWidget::PrefixTextBlock
protected

◆ TimeTextBlock

class UTextBlock* UChatTextWidget::TimeTextBlock
protected

The documentation for this class was generated from the following files: