58 lines
2.0 KiB
C++
58 lines
2.0 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "FTDFluxUtils.h"
|
|
|
|
#include "DTFluxCoreSubsystem.h"
|
|
#include "DTFluxUtilitiesModule.h"
|
|
|
|
FText UFTDFluxUtils::GetFormatedName(const int& Bib, const int MaxChar, const FString Separator,
|
|
const FString OverFlowChar)
|
|
{
|
|
UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
|
|
if (CoreSubsystem != nullptr)
|
|
{
|
|
FDTFluxParticipant OutParticipant;
|
|
CoreSubsystem->GetParticipant(Bib, OutParticipant);
|
|
return OutParticipant.GetFormattedNameText(MaxChar, Separator, OverFlowChar);
|
|
}
|
|
UE_LOG(logDTFluxUtilities, Error, TEXT("DTFluxCoreSubsystem not available"));
|
|
return FText();
|
|
}
|
|
|
|
FText UFTDFluxUtils::GetParticipantFormatedName(FDTFluxParticipant& Participant, const int MaxChar,
|
|
const FString Separator,
|
|
const FString OverFlowChar)
|
|
{
|
|
return Participant.GetFormattedNameText(MaxChar, Separator, OverFlowChar);
|
|
}
|
|
|
|
void UFTDFluxUtils::GetFullName(const int Bib, FText& OutFullName)
|
|
{
|
|
OutFullName = FText();
|
|
UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
|
|
if(CoreSubsystem != nullptr)
|
|
{
|
|
FDTFluxParticipant Participant;
|
|
if(CoreSubsystem->GetParticipant(Bib, Participant))
|
|
{
|
|
FString FormattedName = "";
|
|
if (Participant.IsTeam())
|
|
{
|
|
OutFullName = FText::FromString(Participant.Team);
|
|
return;
|
|
}
|
|
if (Participant.GetTeammate().IsEmpty())
|
|
{
|
|
UE_LOG(logDTFluxUtilities, Warning, TEXT("Non teammate found with Bib %i"), Bib)
|
|
return;
|
|
}
|
|
OutFullName = FText::FromString(FString::Printf(TEXT("%s %s"), *Participant.GetTeammate()[0].FirstName,
|
|
*Participant.GetTeammate()[0].LastName));
|
|
return;
|
|
}
|
|
UE_LOG(logDTFluxUtilities, Warning, TEXT("Participant not found with Bib %i"), Bib);
|
|
}
|
|
UE_LOG(logDTFluxUtilities, Error, TEXT("DTFluxCoreSubsystem not available"));
|
|
}
|