Files
DTFluxAPI/Source/DTFluxUtilities/Public/FTDFluxUtils.h

70 lines
2.7 KiB
C
Raw Normal View History

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "DTFluxCore/Public/Types/Struct/DTFluxTeamListStruct.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Types/Struct/DTFluxRankingStructs.h"
#include "FTDFluxUtils.generated.h"
/**
*
*/
UCLASS()
class DTFLUXUTILITIES_API UFTDFluxUtils : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="name, concat, participant"))
2025-07-13 01:18:31 +02:00
static FText GetFormatedName(const int& Bib, const int MaxChar = 10, const FString Separator = ".",
const FString OverFlowChar = "...");
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="name, concat, participant"))
static FText GetParticipantFormatedName(FDTFluxParticipant& Participant, const int MaxChar = 10,
2025-07-13 01:18:31 +02:00
const FString Separator = ".",
const FString OverFlowChar = "...");
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="convert, StageRankings, DTFlux"))
static void CastToDTFluxStageRanking(const FDTFluxDetailedRankingItem& ItemRanking, FDTFluxStageRanking& OutRanking)
{
CastRankingItem<FDTFluxStageRanking>(ItemRanking, OutRanking);
}
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="convert, StageRankings, DTFlux"))
static void CastToDTFluxStageRankingArray(const TArray<FDTFluxDetailedRankingItem>& ItemRanking,
TArray<FDTFluxStageRanking>& OutRanking)
{
CastRankingArray<FDTFluxStageRanking>(ItemRanking, OutRanking);
}
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="convert, StageRankings, DTFlux"))
static void CastToDTFluxSplitRanking(const FDTFluxDetailedRankingItem& ItemRanking, FDTFluxSplitRanking& OutRanking)
{
CastRankingItem<FDTFluxSplitRanking>(ItemRanking, OutRanking);
}
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="convert, StageRankings, DTFlux"))
static void CastToDTFluxSplitRankingArray(const TArray<FDTFluxDetailedRankingItem>& ItemRanking,
TArray<FDTFluxSplitRanking>& OutRanking)
{
CastRankingArray<FDTFluxSplitRanking>(ItemRanking, OutRanking);
}
template <typename T>
static void CastRankingItem(const FDTFluxDetailedRankingItem& ItemRanking, T& OutRanking)
{
OutRanking = static_cast<T>(ItemRanking);
}
template <typename T>
static void CastRankingArray(const TArray<FDTFluxDetailedRankingItem>& ItemRanking, TArray<T>& OutRanking)
{
OutRanking.Empty();
for (auto& Item : ItemRanking)
{
OutRanking.Add(static_cast<T>(Item));
}
}
};