Compare commits

...

5 Commits

6 changed files with 48 additions and 13 deletions

View File

@ -108,7 +108,7 @@ struct FHierarchicalTreeItem
Item->ContestId = InContestId; Item->ContestId = InContestId;
Item->SplitId = Split.SplitId; Item->SplitId = Split.SplitId;
Item->ID = FString::Printf(TEXT("%d"), Split.SplitId); Item->ID = FString::Printf(TEXT("%d"), Split.SplitId);
Item->Details = FString::Printf(TEXT("%d rankings"), Split.SplitRankings.Num()); Item->Details = FString::Printf(TEXT("rankings"));
Item->Status = TEXT("-"); Item->Status = TEXT("-");
Item->Extra = TEXT("-"); Item->Extra = TEXT("-");
return Item; return Item;

View File

@ -23,12 +23,7 @@ public:
int SplitId = -1; int SplitId = -1;
UPROPERTY(BlueprintReadWrite, Category="DTFlux|Model", EditAnywhere) UPROPERTY(BlueprintReadWrite, Category="DTFlux|Model", EditAnywhere)
FString Name; FString Name;
UPROPERTY(BlueprintReadWrite, Category="DTFlux|model", EditAnywhere)
TArray<FDTFluxStageRanking> SplitRankings;
// void Dump() const;
// // void InsertOrReplace(const FDTFluxStageRankingResponseItem& SplitRankingItemResp);
// void SortByRank();
// TArray<FDTFluxSplitRanking> GetSplitRanking(const int From = 0, const int DisplayNumber = 0);
}; };
/** /**

View File

@ -31,5 +31,5 @@ public:
UPROPERTY(BlueprintReadOnly, VisibleAnywhere) UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
FString Gap = "-"; FString Gap = "-";
UPROPERTY(BlueprintReadOnly, VisibleAnywhere) UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
int Rank; int Rank = -1;
}; };

View File

@ -152,9 +152,9 @@ public:
bool GetContests(TArray<FDTFluxContest>& OutContests); bool GetContests(TArray<FDTFluxContest>& OutContests);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
void GetContest(const int ContestId, FDTFluxContest& OutContest); void GetContest(const int ContestId, FDTFluxContest& OutContest);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") UFUNCTION()
bool GetStageDefinition(const FDTFluxStageKey StageKey, FDTFluxStage& OutStageDefinition); bool GetStageDefinition(const FDTFluxStageKey StageKey, FDTFluxStage& OutStageDefinition);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") UFUNCTION()
bool GetSplitDefinition(const FDTFluxSplitKey SplitKey, FDTFluxSplit& OutSplitDefinition); bool GetSplitDefinition(const FDTFluxSplitKey SplitKey, FDTFluxSplit& OutSplitDefinition);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem") UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
void GetStage(const int ContestId, const int StageId, FDTFluxStage& OutStageDefinition); void GetStage(const int ContestId, const int StageId, FDTFluxStage& OutStageDefinition);

View File

@ -4,14 +4,20 @@
#include "FTDFluxUtils.h" #include "FTDFluxUtils.h"
#include "DTFluxCoreSubsystem.h" #include "DTFluxCoreSubsystem.h"
#include "DTFluxUtilitiesModule.h"
FText UFTDFluxUtils::GetFormatedName(const int& Bib, const int MaxChar, const FString Separator, FText UFTDFluxUtils::GetFormatedName(const int& Bib, const int MaxChar, const FString Separator,
const FString OverFlowChar) const FString OverFlowChar)
{ {
UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>(); UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
if (CoreSubsystem == nullptr)
{
FDTFluxParticipant OutParticipant; FDTFluxParticipant OutParticipant;
CoreSubsystem->GetParticipant(Bib, OutParticipant); CoreSubsystem->GetParticipant(Bib, OutParticipant);
return OutParticipant.GetFormattedNameText(MaxChar, Separator, OverFlowChar); return OutParticipant.GetFormattedNameText(MaxChar, Separator, OverFlowChar);
}
UE_LOG(logDTFluxUtilities, Error, TEXT("DTFluxCoreSubsystem not available"));
return FText();
} }
FText UFTDFluxUtils::GetParticipantFormatedName(FDTFluxParticipant& Participant, const int MaxChar, FText UFTDFluxUtils::GetParticipantFormatedName(FDTFluxParticipant& Participant, const int MaxChar,
@ -20,3 +26,33 @@ FText UFTDFluxUtils::GetParticipantFormatedName(FDTFluxParticipant& Participant,
{ {
return Participant.GetFormattedNameText(MaxChar, Separator, OverFlowChar); return Participant.GetFormattedNameText(MaxChar, Separator, OverFlowChar);
} }
void UFTDFluxUtils::GetFullName(const int Bib, FText& OutFullName)
{
OutFullName = FText();
UDTFluxCoreSubsystem* CoreSubsystem = GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
FDTFluxParticipant Participant;
CoreSubsystem->GetParticipant(Bib, Participant);
{
FDTFluxParticipant OutParticipant;
if(CoreSubsystem->GetParticipant(Bib, OutParticipant))
{
FString FormattedName = "";
if (OutParticipant.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));
return;
}
UE_LOG(logDTFluxUtilities, Warning, TEXT("Participant not found with Bib %i"), Bib);
}
UE_LOG(logDTFluxUtilities, Error, TEXT("DTFluxCoreSubsystem not available"));
}

View File

@ -66,4 +66,8 @@ public:
OutRanking.Add(static_cast<T>(Item)); OutRanking.Add(static_cast<T>(Item));
} }
} }
UFUNCTION(BlueprintCallable, Category="DTFlux|Utils")
static void GetFullName(const int Bib, FText& OutFullName);
}; };