Cosmetic CoreSubsystem cleaning + Added DTFluxDetailedRanking Casting functions
This commit is contained in:
@ -9,7 +9,7 @@ public class DTFluxUtilities : ModuleRules
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core",
|
||||
"Core"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "DTFluxCore/Public/Types/Struct/DTFluxTeamListStruct.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "Types/Struct/DTFluxRankingStructs.h"
|
||||
#include "FTDFluxUtils.generated.h"
|
||||
|
||||
/**
|
||||
@ -23,4 +24,46 @@ public:
|
||||
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));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user