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

#include <CommonWidgetBase.h>

Inheritance diagram for UCommonWidgetBase:
UCommonCheckbox UCommonSlider USelectionButtonMenuSystem

Public Member Functions

void PlaySlateSound (const FSlateSound &SlateSound) const
 

Protected Member Functions

virtual void NativePreConstruct () override
 
virtual void NativeConstruct () override
 
virtual void Setup ()
 
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Protected Attributes

bool bDebuggingMode = false
 

Private Attributes

FLogCategoryName CategoryName = LogCommonBaseWidget.GetCategoryName()
 

Member Function Documentation

◆ LogDebugError() [1/3]

void UCommonWidgetBase::LogDebugError ( const FString & Message) const
protected
38{
39 LogDebugMessage(Message, true, true);
40}
void LogDebugMessage(const FString &Message, const bool bWarning=false, const bool bError=false) const
Definition CommonWidgetBase.cpp:67

◆ LogDebugError() [2/3]

void UCommonWidgetBase::LogDebugError ( const FString & Message,
const float Value ) const
protected
48{
49 LogDebugMessage(Message, Value, true, true);
50}

◆ LogDebugError() [3/3]

void UCommonWidgetBase::LogDebugError ( const FString & Message,
const int32 Value ) const
protected
43{
44 LogDebugMessage(Message, Value, true, true);
45}

◆ LogDebugMessage() [1/4]

void UCommonWidgetBase::LogDebugMessage ( const FString & Message,
const bool bValue,
const bool bWarning,
const bool bError ) const
protected
120{
121 LogDebugMessage(FString::Printf(TEXT("%s: %s"), *Message, bValue ? *FString("true") : *FString("false")), bWarning, bError);
122}

◆ LogDebugMessage() [2/4]

void UCommonWidgetBase::LogDebugMessage ( const FString & Message,
const bool bWarning = false,
const bool bError = false ) const
protected
68{
69 if(bDebuggingMode == false && bError == false){return;}
70 FOutputDevice* OutputDevice = GWarn;
71 if(OutputDevice == nullptr){return;}
72 FString NetModeString;
73 switch(GetWorld()->GetNetMode())
74 {
75 case NM_Standalone:
76 NetModeString = FString("SDL");
77 break;
78 case NM_DedicatedServer:
79 NetModeString = FString("DServer");
80 break;
81 case NM_ListenServer:
82 NetModeString = FString("LServer");
83 break;
84 case NM_Client:
85 NetModeString = FString("Client");
86 break;
87 default:
88 NetModeString = FString("Unknown");
89 break;
90 }
91 const FString FullMessage = FString::Printf(TEXT("%s: %s::%s"), *NetModeString, *GetName(), *Message);
92 if(bError)
93 {
94 OutputDevice->Log(CategoryName, ELogVerbosity::Error, FullMessage);
95 }
96 else if(bWarning)
97 {
98 OutputDevice->Log(CategoryName, ELogVerbosity::Warning, FullMessage);
99 }
100 else
101 {
102 OutputDevice->Log(CategoryName, ELogVerbosity::Log, FullMessage);
103 }
104}
bool bDebuggingMode
Definition CommonWidgetBase.h:52
FLogCategoryName CategoryName
Definition CommonWidgetBase.h:55

◆ LogDebugMessage() [3/4]

void UCommonWidgetBase::LogDebugMessage ( const FString & Message,
const float Value,
const bool bWarning = false,
const bool bError = false ) const
protected
114{
115 LogDebugMessage(FString::Printf(TEXT("%s: %f"), *Message, Value), bWarning, bError);
116}

◆ LogDebugMessage() [4/4]

void UCommonWidgetBase::LogDebugMessage ( const FString & Message,
const int32 Value,
const bool bWarning = false,
const bool bError = false ) const
protected
108{
109 LogDebugMessage(FString::Printf(TEXT("%s: %i"), *Message, Value), bWarning, bError);
110}

◆ LogDebugWarning() [1/3]

void UCommonWidgetBase::LogDebugWarning ( const FString & Message) const
protected
53{
54 LogDebugMessage(Message, true);
55}

◆ LogDebugWarning() [2/3]

void UCommonWidgetBase::LogDebugWarning ( const FString & Message,
const float Value ) const
protected
63{
64 LogDebugMessage(Message, Value, true);
65}

◆ LogDebugWarning() [3/3]

void UCommonWidgetBase::LogDebugWarning ( const FString & Message,
const int32 Value ) const
protected
58{
59 LogDebugMessage(Message, Value, true);
60}

◆ LogOnScreenMessage()

void UCommonWidgetBase::LogOnScreenMessage ( const int32 Key,
const FString & Message,
FColor Color = FColor::Green ) const
protected
125{
126 if(GetOwningPlayer() == nullptr){return;}
128 {
129 GEngine->AddOnScreenDebugMessage(Key, 2.0f, Color,
130 FString::Printf(TEXT(" %s - in %s of %s"), ToCStr(Message), ToCStr(GetName()), ToCStr(GetOwningPlayer()->GetName())));
131 }
132}

◆ NativeConstruct()

void UCommonWidgetBase::NativeConstruct ( )
overrideprotectedvirtual

Reimplemented in UCommonCheckbox, UCommonSlider, and USelectionButtonMenuSystem.

27{
28 Super::NativeConstruct();
29 Setup();
30}
virtual void Setup()
Definition CommonWidgetBase.cpp:32

◆ NativePreConstruct()

void UCommonWidgetBase::NativePreConstruct ( )
overrideprotectedvirtual

Reimplemented in UCommonCheckbox, UCommonSlider, and USelectionButtonMenuSystem.

21{
22 Super::NativePreConstruct();
23 Setup();
24}

◆ PlaySlateSound()

void UCommonWidgetBase::PlaySlateSound ( const FSlateSound & SlateSound) const
9{
10 if(SlateSound.GetResourceObject() != nullptr && GetOwningPlayer() != nullptr)
11 {
12 USoundBase* Sound = Cast<USoundBase>(SlateSound.GetResourceObject());
13 if(Sound != nullptr)
14 {
15 UGameplayStatics::PlaySound2D(GetOwningPlayer(), Sound);
16 }
17 }
18}

◆ SetCategoryName()

void UCommonWidgetBase::SetCategoryName ( const FLogCategoryBase & Category)
inlineprotected
48{CategoryName = Category.GetCategoryName();};

◆ Setup()

void UCommonWidgetBase::Setup ( )
protectedvirtual

Reimplemented in UCommonCheckbox, and UCommonSlider.

33{
34
35}

Member Data Documentation

◆ bDebuggingMode

bool UCommonWidgetBase::bDebuggingMode = false
protected

◆ CategoryName

FLogCategoryName UCommonWidgetBase::CategoryName = LogCommonBaseWidget.GetCategoryName()
private

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