Added Sort Ranking
This commit is contained in:
77
Source/DTFluxUtilities/Public/DTFluxUtils.h
Normal file
77
Source/DTFluxUtilities/Public/DTFluxUtils.h
Normal 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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user