Added Blank Delegate for split Sensors + Added Getters for Contest/Stage/Split rankings for 1 participant + Global Cleaning

This commit is contained in:
2025-07-14 02:40:03 +02:00
parent e6d878aeef
commit 1c04ae6bd7
9 changed files with 185 additions and 100 deletions

View File

@ -288,6 +288,76 @@ void UDTFluxCoreSubsystem::SendRequest(const FString& Message)
}
}
bool UDTFluxCoreSubsystem::GetStageRankingForBib(const int ContestId, const int StageId, const int Bib,
FDTFluxStageRanking& OutStageRanking)
{
if (DataStorage)
{
FDTFluxStageKey StageKey(ContestId, StageId);
if (DataStorage->StageRankings.Contains(StageKey))
{
FDTFluxStageRankings StageRankings = DataStorage->StageRankings[StageKey];
for (auto& Ranking : StageRankings.Rankings)
{
if (Ranking.Bib == Bib)
{
OutStageRanking = static_cast<FDTFluxStageRanking>(Ranking);
return true;
}
}
}
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Unable to find StageRanking for Bib %i"), Bib);
return false;
}
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
return false;
}
bool UDTFluxCoreSubsystem::GetSplitRankingForBib(const int ContestId, const int StageId, const int SplitId,
const int Bib, FDTFluxSplitRanking& OutSplitRankings)
{
if (DataStorage)
{
FDTFluxSplitKey SplitKey(ContestId, StageId, SplitId);
if (DataStorage->SplitRankings.Contains(SplitKey))
{
FDTFluxSplitRankings SplitRankings = DataStorage->SplitRankings[SplitKey];
for (auto& Ranking : SplitRankings.Rankings)
{
if (Ranking.Bib == Bib)
{
OutSplitRankings = static_cast<FDTFluxSplitRanking>(Ranking);
return true;
}
}
}
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Unable to find SplitRanking for Bib %i"), Bib);
return false;
}
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
return false;
}
bool UDTFluxCoreSubsystem::GetContestRanking(const int ContestId, FDTFluxContestRanking& OutContestRanking)
{
if (DataStorage)
{
FDTFluxContest Contest;
if (GetContestForId(ContestId, Contest))
{
for (auto& Ranking : DataStorage->ContestRankings[ContestId].Rankings)
{
OutContestRanking = Ranking;
return true;
}
}
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Unable to find ContestRanking for ContestId %i"), ContestId);
return false;
}
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
return false;
}
bool UDTFluxCoreSubsystem::GetContestRankings(const int ContestId,
FDTFluxContestRankings& OutContestRankings)
{
@ -468,13 +538,15 @@ TArray<FGuid> UDTFluxCoreSubsystem::TrackedRequestSplitRankings(const TArray<FDT
return TArray<FGuid>();
}
const FDTFluxParticipant UDTFluxCoreSubsystem::GetParticipant(int InBib)
bool UDTFluxCoreSubsystem::GetParticipant(int InBib, FDTFluxParticipant& OutParticipant)
{
if (DataStorage->Participants.Contains(InBib))
{
return DataStorage->Participants[InBib];
OutParticipant = DataStorage->Participants[InBib];
return true;
}
return FDTFluxParticipant();
return false;
}
TArray<int> UDTFluxCoreSubsystem::GetCurrentContestsId()

View File

@ -59,6 +59,33 @@ public:
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
UDTFluxPursuitManager* PursuitManager = nullptr;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSplitSensor, FDTFluxSplitSensorInfo, SplitSensorInfo);
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
FOnSplitSensor OnSplitSensor;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFinisher, FDTFluxSplitSensorInfo, SplitSensorInfo);
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
FOnFinisher OnFinisher;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnWinner, FDTFluxSplitSensorInfo, SplitSensorInfo);
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
FOnWinner OnWinner;
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
bool GetStageRankingForBib(const int ContestId, const int StageId, const int Bib,
FDTFluxStageRanking& OutStageRankings);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
bool GetSplitRankingForBib(const int ContestId, const int StageId, const int SplitId, const int Bib,
FDTFluxSplitRanking& OutSplitRankings);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
bool GetContestRanking(const int ContestId, FDTFluxContestRanking& OutContestRanking);
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
bool GetContestRankings(const int ContestId, FDTFluxContestRankings& OutContestRankings);
@ -88,7 +115,7 @@ public:
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
const FDTFluxParticipant GetParticipant(int InBib);
bool GetParticipant(int InBib, FDTFluxParticipant& OutParticipant);
//TODO : this must be a ProjectSetting
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")