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

#include <ScoreboardRowWidget.h>

Inheritance diagram for UScoreboardRowWidget:

Public Member Functions

virtual bool Initialize () override
 
virtual void NativeConstruct () override
 
void SetPlayerState (class APlayerState *PlayerState)
 
void UpdatePlayerStats ()
 
void SetRowIndex (int32 Index)
 

Protected Attributes

class AMenuSystemPlayerStateAssociatedPlayerState
 
int32 TeamID = 0
 
int32 PlayerID = 0
 
int32 ScoreboardID = 0
 
bool bIsLocalPlayer = false
 
float StatWidth = 128.0f
 
FLinearColor PlayerColor = FLinearColor::Blue
 
FLinearColor OddColor = FLinearColor::Black
 
FLinearColor EvenColor = FLinearColor::White
 
class UTextBlock * PlayerNameTextBlock
 
class UTextBlock * XPTextBlock
 
class UImage * PlayerIconImage
 
class UImage * BackgroundImage
 
class UTextBlock * KillsTextBlock
 
class UTextBlock * AssistsTextBlock
 
class UTextBlock * DeathsTextBlock
 
class UTextBlock * KDRatioTextBlock
 
class UPingWidgetPingWidget
 

Member Function Documentation

◆ Initialize()

bool UScoreboardRowWidget::Initialize ( )
overridevirtual
16{
17 const bool Success = Super::Initialize();
18 if(!Success) return false;
19 if (!ensure(PingWidget != nullptr)) return false;
20 if (!ensure(PlayerNameTextBlock != nullptr)) return false;
21 if (!ensure(PlayerIconImage != nullptr)) return false;
22 if (!ensure(KillsTextBlock != nullptr)) return false;
23 if (!ensure(AssistsTextBlock != nullptr)) return false;
24 if (!ensure(DeathsTextBlock != nullptr)) return false;
25 if (!ensure(KDRatioTextBlock != nullptr)) return false;
26 if (!ensure(BackgroundImage != nullptr)) return false;
27 if (!ensure(XPTextBlock != nullptr)) return false;
28 return true;
29}
class UImage * PlayerIconImage
Definition ScoreboardRowWidget.h:56
class UTextBlock * KillsTextBlock
Definition ScoreboardRowWidget.h:60
class UTextBlock * AssistsTextBlock
Definition ScoreboardRowWidget.h:62
class UTextBlock * PlayerNameTextBlock
Definition ScoreboardRowWidget.h:52
class UPingWidget * PingWidget
Definition ScoreboardRowWidget.h:69
class UTextBlock * KDRatioTextBlock
Definition ScoreboardRowWidget.h:66
class UImage * BackgroundImage
Definition ScoreboardRowWidget.h:58
class UTextBlock * XPTextBlock
Definition ScoreboardRowWidget.h:54
class UTextBlock * DeathsTextBlock
Definition ScoreboardRowWidget.h:64

◆ NativeConstruct()

void UScoreboardRowWidget::NativeConstruct ( )
overridevirtual
32{
33 Super::NativeConstruct();
34 BackgroundImage->SetRenderOpacity(0.2);
35
36}

◆ SetPlayerState()

void UScoreboardRowWidget::SetPlayerState ( class APlayerState * PlayerState)
39{
40 if(PlayerState == nullptr){UE_LOG(LogMenuSystem, Warning, TEXT("Player State Null in Scoreboard Row Widget"));return;}
41 AMenuSystemPlayerState* MenuSystemPlayerState = Cast<AMenuSystemPlayerState>(PlayerState);
42 AssociatedPlayerState = MenuSystemPlayerState;
44 // if(ScoreboardID % 2 == 1) //- Is an even number //
45 // {
46 // BackgroundImage->SetColorAndOpacity(OddColor);
47 // }
48 if(GetOwningPlayer()->PlayerState == AssociatedPlayerState)
49 {
50 bIsLocalPlayer = true;
51 // BackgroundImage->SetColorAndOpacity(PlayerColor);
52 }
53 PlayerNameTextBlock->SetText(FText::FromString(PlayerState->GetPlayerName()));
54 PingWidget->UpdatePing(AssociatedPlayerState->GetPingInMilliseconds());
56 if(ProfilePicture != nullptr)
57 {
58 PlayerIconImage->SetBrushFromTexture(ProfilePicture);
59 }
60 else
61 {
62 UE_LOG(LogMenuSystem, Warning,TEXT("Profile Picture Failed - Scoreboard row widget"));
63 }
64}
Definition MenuSystemPlayerState.h:19
int32 GetTeamID() const
Definition MenuSystemPlayerState.h:45
virtual FUserProfile GetUserProfile() const override
Definition MenuSystemPlayerState.h:49
static UTexture2D * GetProfilePictureImage(const UObject *WorldContextObject, const int32 PictureID)
Definition EpicOnlineBPLib.cpp:52
void UpdatePing(float Ping)
Definition PingWidget.cpp:18
class AMenuSystemPlayerState * AssociatedPlayerState
Definition ScoreboardRowWidget.h:29
int32 TeamID
Definition ScoreboardRowWidget.h:32
bool bIsLocalPlayer
Definition ScoreboardRowWidget.h:39
int32 ProfilePictureID
Definition BaseData.h:1249

◆ SetRowIndex()

void UScoreboardRowWidget::SetRowIndex ( int32 Index)
78{
79 ScoreboardID = Index;
80 if(ScoreboardID % 2 == 1) //- Is an even number //
81 {
82 BackgroundImage->SetColorAndOpacity(OddColor);
83 }
84 else
85 {
86 BackgroundImage->SetColorAndOpacity(EvenColor);
87 }
89 {
90 BackgroundImage->SetColorAndOpacity(PlayerColor);
91 }
92}
FLinearColor OddColor
Definition ScoreboardRowWidget.h:47
int32 ScoreboardID
Definition ScoreboardRowWidget.h:36
FLinearColor EvenColor
Definition ScoreboardRowWidget.h:49
FLinearColor PlayerColor
Definition ScoreboardRowWidget.h:44

◆ UpdatePlayerStats()

void UScoreboardRowWidget::UpdatePlayerStats ( )
67{
68 if(AssociatedPlayerState == nullptr){UE_LOG(LogMenuSystem, Warning, TEXT("AssociatedPlayerState Null in Scoreboard Row Widget"));return;}
70 XPTextBlock->SetText(FText::AsNumber(AssociatedPlayerState->GetMultiplayerStats().XP));
71 KillsTextBlock->SetText(UKismetTextLibrary::Conv_IntToText(AssociatedPlayerState->GetMultiplayerStats().Kills));
72 AssistsTextBlock->SetText(UKismetTextLibrary::Conv_IntToText(AssociatedPlayerState->GetMultiplayerStats().Assists));
73 DeathsTextBlock->SetText(UKismetTextLibrary::Conv_IntToText(AssociatedPlayerState->GetMultiplayerStats().Deaths));
74 KDRatioTextBlock->SetText(FText::AsNumber(KDRatio));
75}
FMultiplayerPlayerStats GetMultiplayerStats() const
Definition MenuSystemPlayerState.h:59
static float CalculateRatio(const int32 Kills, const int32 Deaths)
Definition BaseHelpersBPLib.cpp:681
int32 Deaths
Definition BaseData.h:1193
float XP
Definition BaseData.h:1199
int32 Assists
Definition BaseData.h:1195
int32 Kills
Definition BaseData.h:1187

Member Data Documentation

◆ AssistsTextBlock

class UTextBlock* UScoreboardRowWidget::AssistsTextBlock
protected

◆ AssociatedPlayerState

class AMenuSystemPlayerState* UScoreboardRowWidget::AssociatedPlayerState
protected

◆ BackgroundImage

class UImage* UScoreboardRowWidget::BackgroundImage
protected

◆ bIsLocalPlayer

bool UScoreboardRowWidget::bIsLocalPlayer = false
protected

◆ DeathsTextBlock

class UTextBlock* UScoreboardRowWidget::DeathsTextBlock
protected

◆ EvenColor

FLinearColor UScoreboardRowWidget::EvenColor = FLinearColor::White
protected

◆ KDRatioTextBlock

class UTextBlock* UScoreboardRowWidget::KDRatioTextBlock
protected

◆ KillsTextBlock

class UTextBlock* UScoreboardRowWidget::KillsTextBlock
protected

◆ OddColor

FLinearColor UScoreboardRowWidget::OddColor = FLinearColor::Black
protected

◆ PingWidget

class UPingWidget* UScoreboardRowWidget::PingWidget
protected

◆ PlayerColor

FLinearColor UScoreboardRowWidget::PlayerColor = FLinearColor::Blue
protected

◆ PlayerIconImage

class UImage* UScoreboardRowWidget::PlayerIconImage
protected

◆ PlayerID

int32 UScoreboardRowWidget::PlayerID = 0
protected

◆ PlayerNameTextBlock

class UTextBlock* UScoreboardRowWidget::PlayerNameTextBlock
protected

◆ ScoreboardID

int32 UScoreboardRowWidget::ScoreboardID = 0
protected

◆ StatWidth

float UScoreboardRowWidget::StatWidth = 128.0f
protected

◆ TeamID

int32 UScoreboardRowWidget::TeamID = 0
protected

◆ XPTextBlock

class UTextBlock* UScoreboardRowWidget::XPTextBlock
protected

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