Ranking reforge. SplitRanking is not implemented yet !!!

This commit is contained in:
2025-06-30 19:02:19 +02:00
parent 81bf37639b
commit 11e695f379
13 changed files with 218 additions and 104 deletions

View File

@ -46,10 +46,11 @@ void UDTFluxCoreSubsystem::RegisterDelegates()
{
NetworkSubsystem->OnReceivedRaceData().AddDynamic(this, &UDTFluxCoreSubsystem::ParseRaceData);
NetworkSubsystem->OnReceivedTeamList().AddDynamic(this, &UDTFluxCoreSubsystem::ParseTeamList);
NetworkSubsystem->OnReceivedContestRanking().AddDynamic(this, &UDTFluxCoreSubsystem::ParseContestRanking);
NetworkSubsystem->OnReceivedStageRanking().BindUFunction(this, "ParseStageOrSplitRanking");
}
}
void UDTFluxCoreSubsystem::ParseRaceData(const FDTFluxRaceData& RaceDataDefinition)
{
@ -99,6 +100,31 @@ void UDTFluxCoreSubsystem::ParseTeamList(const FDTFluxTeamListDefinition& TeamLi
}
}
void UDTFluxCoreSubsystem::ParseContestRanking(const FDTFluxContestRankings& ContestRankings)
{
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Received ContestRankings with %i Items"), ContestRankings.Rankings.Num());
FDTFluxContestRankings NewContestRankings = ContestRankings;
NewContestRankings.SetName( DataStorage->GetContestNameForId(ContestRankings.ContestId));
DataStorage->AddContestRanking(NewContestRankings);
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("ContestRankings added for Contest %s"), *NewContestRankings.ContestName);
}
void UDTFluxCoreSubsystem::ParseStageOrSplitRanking(const FDTFluxStageRankings& StageOrSplitRankings)
{
if(StageOrSplitRankings.SplitId == -1)
{
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Received StageRankings with %i Items"), StageOrSplitRankings.Rankings.Num());
if(!DataStorage->UpdateStageRanking(StageOrSplitRankings))
{
DataStorage->StageRankings.Add(StageOrSplitRankings);
}
}
else
{
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Received SplitRankings with %i Items"), StageOrSplitRankings.Rankings.Num());
}
}
void UDTFluxCoreSubsystem::OnDataReceived()
{
}
@ -111,7 +137,6 @@ void UDTFluxCoreSubsystem::SendRequest(const FString& Message)
}
}
void UDTFluxCoreSubsystem::SendTeamListRequest()
{
if (NetworkSubsystem)
@ -166,3 +191,5 @@ void UDTFluxCoreSubsystem::RefreshStorage()
{
// TODO Implement this
}