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

#include <PlayerCardWidget.h>

Inheritance diagram for UPlayerCardWidget:

Public Member Functions

void SetPlayerProfile (const FUserProfile &Player)
 
const FUserProfileGetPlayerProfile () const
 
bool GetIsLoading () const
 
bool GetIsReady () const
 
void SetIsReady (const bool bValue)
 

Protected Member Functions

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

Protected Attributes

FLinearColor ReadyColor = FLinearColor::Green
 
FLinearColor UnReadyColor = FLinearColor::Red
 
UTextBlock * PlayerNameTextBlock = nullptr
 
UTextBlock * XPTextBlock = nullptr
 
UProgressBar * XPProgressBar = nullptr
 
class UBorder * ReadyBorder = nullptr
 
UTextBlock * LevelTextBlock = nullptr
 
class UImage * ProfilePictureImage = nullptr
 
UTextBlock * AchievementsTextBlock = nullptr
 
UTextBlock * KillDeathTextBlock = nullptr
 

Private Member Functions

void SetValues ()
 

Private Attributes

FUserProfile PlayerProfile
 
bool bLoading = true
 
bool bReady = false
 

Member Function Documentation

◆ GetIsLoading()

bool UPlayerCardWidget::GetIsLoading ( ) const
inline
28{return bLoading;};
bool bLoading
Definition PlayerCardWidget.h:71

◆ GetIsReady()

bool UPlayerCardWidget::GetIsReady ( ) const
inline
30{return bReady;};
bool bReady
Definition PlayerCardWidget.h:72

◆ GetPlayerProfile()

const FUserProfile & UPlayerCardWidget::GetPlayerProfile ( ) const
inline
25{return PlayerProfile;};
FUserProfile PlayerProfile
Definition PlayerCardWidget.h:67

◆ Initialize()

bool UPlayerCardWidget::Initialize ( )
overrideprotectedvirtual
31{
32 const bool Success = Super::Initialize();
33 if(!Success) return false;
34 if (!ensure(PlayerNameTextBlock != nullptr)) return false;
35 if (!ensure(XPTextBlock != nullptr)) return false;
36 if (!ensure(LevelTextBlock != nullptr)) return false;
37 if (!ensure(XPProgressBar != nullptr)) return false;
38 if (!ensure(ProfilePictureImage != nullptr)) return false;
39 if (!ensure(AchievementsTextBlock != nullptr)) return false;
40 if (!ensure(KillDeathTextBlock != nullptr)) return false;
41 if (!ensure(ReadyBorder != nullptr)) return false;
42
43 return true;
44}
UProgressBar * XPProgressBar
Definition PlayerCardWidget.h:53
UTextBlock * XPTextBlock
Definition PlayerCardWidget.h:51
UTextBlock * LevelTextBlock
Definition PlayerCardWidget.h:57
UTextBlock * AchievementsTextBlock
Definition PlayerCardWidget.h:61
UTextBlock * PlayerNameTextBlock
Definition PlayerCardWidget.h:49
class UBorder * ReadyBorder
Definition PlayerCardWidget.h:55
class UImage * ProfilePictureImage
Definition PlayerCardWidget.h:59
UTextBlock * KillDeathTextBlock
Definition PlayerCardWidget.h:63

◆ NativeConstruct()

void UPlayerCardWidget::NativeConstruct ( )
overrideprotectedvirtual
19{
20 Super::NativeConstruct();
21 SetValues();
22}
void SetValues()
Definition PlayerCardWidget.cpp:46

◆ NativePreConstruct()

void UPlayerCardWidget::NativePreConstruct ( )
overrideprotectedvirtual
13{
14 Super::NativePreConstruct();
15 SetValues();
16}

◆ SetIsReady()

void UPlayerCardWidget::SetIsReady ( const bool bValue)
inline
32{bReady = bValue;};

◆ SetPlayerProfile()

void UPlayerCardWidget::SetPlayerProfile ( const FUserProfile & Player)
25{
26 PlayerProfile = Player;
27 SetValues();
28}

◆ SetValues()

void UPlayerCardWidget::SetValues ( )
private
47{
49 {
50 PlayerNameTextBlock->SetText(FText::FromString(PlayerProfile.DisplayName));
51 LevelTextBlock->SetText(FText::AsNumber(PlayerProfile.GetPlayerLevel()));
52 AchievementsTextBlock->SetText(FText::AsNumber(PlayerProfile.Achievements.Num()));
53
54 XPTextBlock->SetText(FText::AsNumber(PlayerProfile.XP));
55 XPProgressBar->SetPercent((PlayerProfile.XPProgress()));
56
58 KillDeathTextBlock->SetText(FText::AsNumber(KillDeathRatio));
59
60 if(GetOwningPlayer() != nullptr)
61 {
62 UTexture2D* ProfilePicture = UEpicOnlineBPLib::GetProfilePictureImage(GetOwningPlayer(), PlayerProfile.ProfilePictureID);
63 if(ProfilePicture != nullptr)
64 {
65 ProfilePictureImage->SetBrushFromTexture(ProfilePicture);
66 }
67 }
69 {
70 ReadyBorder->SetBrushColor(ReadyColor);
71 }else
72 {
73 ReadyBorder->SetBrushColor(UnReadyColor);
74 }
75 bLoading = false;
76 }
77}
static float CalculateRatio(const int32 Kills, const int32 Deaths)
Definition BaseHelpersBPLib.cpp:681
static UTexture2D * GetProfilePictureImage(const UObject *WorldContextObject, const int32 PictureID)
Definition EpicOnlineBPLib.cpp:52
FLinearColor UnReadyColor
Definition PlayerCardWidget.h:44
FLinearColor ReadyColor
Definition PlayerCardWidget.h:42
int32 Kills
Definition BaseData.h:1263
int32 XP
Definition BaseData.h:1253
bool IsValid() const
Definition BaseData.h:1288
FString DisplayName
Definition BaseData.h:1243
int32 Deaths
Definition BaseData.h:1265
TArray< int32 > Achievements
Definition BaseData.h:1251
bool bReady
Definition BaseData.h:1282
int32 ProfilePictureID
Definition BaseData.h:1249
int32 GetPlayerLevel() const
Definition BaseData.h:1313
float XPProgress() const
Definition BaseData.h:1303

Member Data Documentation

◆ AchievementsTextBlock

UTextBlock* UPlayerCardWidget::AchievementsTextBlock = nullptr
protected

◆ bLoading

bool UPlayerCardWidget::bLoading = true
private

◆ bReady

bool UPlayerCardWidget::bReady = false
private

◆ KillDeathTextBlock

UTextBlock* UPlayerCardWidget::KillDeathTextBlock = nullptr
protected

◆ LevelTextBlock

UTextBlock* UPlayerCardWidget::LevelTextBlock = nullptr
protected

◆ PlayerNameTextBlock

UTextBlock* UPlayerCardWidget::PlayerNameTextBlock = nullptr
protected

◆ PlayerProfile

FUserProfile UPlayerCardWidget::PlayerProfile
private

◆ ProfilePictureImage

class UImage* UPlayerCardWidget::ProfilePictureImage = nullptr
protected

◆ ReadyBorder

class UBorder* UPlayerCardWidget::ReadyBorder = nullptr
protected

◆ ReadyColor

FLinearColor UPlayerCardWidget::ReadyColor = FLinearColor::Green
protected

◆ UnReadyColor

FLinearColor UPlayerCardWidget::UnReadyColor = FLinearColor::Red
protected

◆ XPProgressBar

UProgressBar* UPlayerCardWidget::XPProgressBar = nullptr
protected

◆ XPTextBlock

UTextBlock* UPlayerCardWidget::XPTextBlock = nullptr
protected

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