Added Sort Ranking

This commit is contained in:
2025-07-17 19:21:32 +02:00
parent 9b85bfc94a
commit e02ed8538f
2 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,77 @@
// 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 "DTFluxUtils.generated.h"
/**
*
*/
UCLASS()
class DTFLUXUTILITIES_API UFTDFluxUtils : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils", Meta=(Keywords="name, concat, participant"))
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,
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));
}
}
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils")
static void GetFullName(const int Bib, FText& OutFullName);
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils")
static void SortSplitRankingsByRank(TArray<FDTFluxSplitRanking>& Rankings);
};