2025-07-08 16:50:31 +02:00
|
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-17 19:21:32 +02:00
|
|
|
|
#include "DTFluxUtils.h"
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-07-08 18:24:26 +02:00
|
|
|
|
#include "DTFluxCoreSubsystem.h"
|
2025-07-15 01:11:18 +02:00
|
|
|
|
#include "DTFluxUtilitiesModule.h"
|
2025-07-08 18:24:26 +02:00
|
|
|
|
|
2025-07-13 01:18:31 +02:00
|
|
|
|
FText UFTDFluxUtils::GetFormatedName(const int& Bib, const int MaxChar, const FString Separator,
|
|
|
|
|
|
const FString OverFlowChar)
|
2025-07-08 18:24:26 +02:00
|
|
|
|
{
|
|
|
|
|
|
UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
|
2025-07-15 05:17:30 +02:00
|
|
|
|
if (CoreSubsystem != nullptr)
|
2025-07-15 01:11:18 +02:00
|
|
|
|
{
|
|
|
|
|
|
FDTFluxParticipant OutParticipant;
|
|
|
|
|
|
CoreSubsystem->GetParticipant(Bib, OutParticipant);
|
|
|
|
|
|
return OutParticipant.GetFormattedNameText(MaxChar, Separator, OverFlowChar);
|
|
|
|
|
|
}
|
|
|
|
|
|
UE_LOG(logDTFluxUtilities, Error, TEXT("DTFluxCoreSubsystem not available"));
|
|
|
|
|
|
return FText();
|
2025-07-08 18:24:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FText UFTDFluxUtils::GetParticipantFormatedName(FDTFluxParticipant& Participant, const int MaxChar,
|
2025-07-13 01:18:31 +02:00
|
|
|
|
const FString Separator,
|
2025-07-08 18:24:26 +02:00
|
|
|
|
const FString OverFlowChar)
|
2025-07-08 16:50:31 +02:00
|
|
|
|
{
|
2025-07-13 01:18:31 +02:00
|
|
|
|
return Participant.GetFormattedNameText(MaxChar, Separator, OverFlowChar);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
}
|
2025-07-15 01:11:18 +02:00
|
|
|
|
|
|
|
|
|
|
void UFTDFluxUtils::GetFullName(const int Bib, FText& OutFullName)
|
|
|
|
|
|
{
|
|
|
|
|
|
OutFullName = FText();
|
|
|
|
|
|
UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
|
2025-07-15 05:13:31 +02:00
|
|
|
|
if(CoreSubsystem != nullptr)
|
2025-07-15 01:11:18 +02:00
|
|
|
|
{
|
2025-07-15 05:13:31 +02:00
|
|
|
|
FDTFluxParticipant Participant;
|
|
|
|
|
|
if(CoreSubsystem->GetParticipant(Bib, Participant))
|
2025-07-15 01:11:18 +02:00
|
|
|
|
{
|
2025-07-15 05:13:31 +02:00
|
|
|
|
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));
|
2025-07-15 01:11:18 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-07-15 05:13:31 +02:00
|
|
|
|
UE_LOG(logDTFluxUtilities, Warning, TEXT("Participant not found with Bib %i"), Bib);
|
2025-07-15 01:11:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
UE_LOG(logDTFluxUtilities, Error, TEXT("DTFluxCoreSubsystem not available"));
|
|
|
|
|
|
}
|
2025-07-17 19:21:32 +02:00
|
|
|
|
|
2025-07-18 02:22:40 +02:00
|
|
|
|
TArray<FDTFluxSplitSensorInfo> UFTDFluxUtils::SortSplitRankingsByRank(const TArray<FDTFluxSplitSensorInfo>& Rankings)
|
2025-07-17 19:21:32 +02:00
|
|
|
|
{
|
2025-07-18 02:22:40 +02:00
|
|
|
|
TArray<FDTFluxSplitSensorInfo> CopyRankings = Rankings;
|
|
|
|
|
|
CopyRankings.Sort([](const FDTFluxSplitSensorInfo& A, const FDTFluxSplitSensorInfo& B)
|
2025-07-17 19:21:32 +02:00
|
|
|
|
{
|
|
|
|
|
|
return A.Rank < B.Rank;
|
|
|
|
|
|
});
|
2025-07-18 02:22:40 +02:00
|
|
|
|
return CopyRankings;
|
2025-07-17 19:21:32 +02:00
|
|
|
|
}
|