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

#include <AttributeBar.h>

Inheritance diagram for UAttributeBar:

Public Member Functions

 UAttributeBar (const FObjectInitializer &ObjectInitializer)
 
void UpdateAttribute (const float CurrentLevel, const float MaxLevel)
 
void OnUpdateAttribute (const float CurrentLevel, const float MaxLevel)
 

Protected Member Functions

virtual bool Initialize () override
 
virtual void NativePreConstruct () override
 
virtual void NativeConstruct () override
 

Protected Attributes

class UProgressBar * ProgressBar = nullptr
 
class UTextBlock * CurrentValueText = nullptr
 
class UTextBlock * MaxValueText = nullptr
 

Constructor & Destructor Documentation

◆ UAttributeBar()

UAttributeBar::UAttributeBar ( const FObjectInitializer & ObjectInitializer)
explicit
10 :Super(ObjectInitializer)
11{
12
13}

Member Function Documentation

◆ Initialize()

bool UAttributeBar::Initialize ( )
overrideprotectedvirtual
33{
34 const bool Success = Super::Initialize();
35 if(!Success) return false;
36 if (!ensure(ProgressBar != nullptr)) return false;
37 if (!ensure(CurrentValueText != nullptr)) return false;
38 if (!ensure(MaxValueText != nullptr)) return false;
39 return true;
40}
class UTextBlock * CurrentValueText
Definition AttributeBar.h:33
class UTextBlock * MaxValueText
Definition AttributeBar.h:35
class UProgressBar * ProgressBar
Definition AttributeBar.h:31

◆ NativeConstruct()

void UAttributeBar::NativeConstruct ( )
overrideprotectedvirtual
48{
49 Super::NativeConstruct();
50}

◆ NativePreConstruct()

void UAttributeBar::NativePreConstruct ( )
overrideprotectedvirtual
43{
44 Super::NativePreConstruct();
45}

◆ OnUpdateAttribute()

void UAttributeBar::OnUpdateAttribute ( const float CurrentLevel,
const float MaxLevel )

◆ UpdateAttribute()

void UAttributeBar::UpdateAttribute ( const float CurrentLevel,
const float MaxLevel )
16{
17 OnUpdateAttribute(CurrentLevel, MaxLevel);
18 if(CurrentValueText != nullptr)
19 {
20 CurrentValueText->SetText(FText::FromString(FString::FromInt(CurrentLevel)));
21 }
22 if(MaxValueText != nullptr)
23 {
24 MaxValueText->SetText(FText::FromString(FString::FromInt(MaxLevel)));
25 }
26 if(ProgressBar != nullptr)
27 {
28 ProgressBar->SetPercent(CurrentLevel/MaxLevel);
29 }
30}
void OnUpdateAttribute(const float CurrentLevel, const float MaxLevel)

Member Data Documentation

◆ CurrentValueText

class UTextBlock* UAttributeBar::CurrentValueText = nullptr
protected

◆ MaxValueText

class UTextBlock* UAttributeBar::MaxValueText = nullptr
protected

◆ ProgressBar

class UProgressBar* UAttributeBar::ProgressBar = nullptr
protected

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