2025-07-09 03:27:23 +02:00
|
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "DTFluxPursuitManager.h"
|
|
|
|
|
|
|
2025-07-11 13:09:18 +02:00
|
|
|
|
#include <ImportExport.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "DTFluxCoreSubsystem.h"
|
2025-07-09 03:27:23 +02:00
|
|
|
|
#include "DTFluxCoreSubsystemModule.h"
|
2025-07-13 02:38:05 +02:00
|
|
|
|
#include "Dataflow/DataflowContextCache.h"
|
2025-07-09 03:27:23 +02:00
|
|
|
|
|
|
|
|
|
|
UDTFluxPursuitManager::UDTFluxPursuitManager(const FObjectInitializer& ObjectInitializer):
|
|
|
|
|
|
Super(ObjectInitializer)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 13:09:18 +02:00
|
|
|
|
void UDTFluxPursuitManager::InitPursuit(const TArray<int> InContestIds, const int MaxSimultaneousPursuit)
|
|
|
|
|
|
{
|
|
|
|
|
|
CoreSubsystem = Cast<UDTFluxCoreSubsystem>(GetOuter());
|
|
|
|
|
|
if (!CoreSubsystem)
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("CoreSubsystem is not Available !!!"));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-07-11 19:04:37 +02:00
|
|
|
|
AllRankings.Reset();
|
2025-07-11 13:09:18 +02:00
|
|
|
|
for (const auto& ContestId : InContestIds)
|
|
|
|
|
|
{
|
|
|
|
|
|
FDTFluxContest Contest;
|
2025-07-11 19:04:37 +02:00
|
|
|
|
if (CoreSubsystem->GetContestForId(ContestId, Contest))
|
|
|
|
|
|
{
|
2025-07-18 23:20:34 +02:00
|
|
|
|
// BindRankings();
|
2025-07-11 19:04:37 +02:00
|
|
|
|
FDTFluxStageKey StageKey = FDTFluxStageKey(ContestId, Contest.GetLastStageId());
|
|
|
|
|
|
FDTFluxStageRankings TempStageRankings;
|
|
|
|
|
|
//Obtenir les ranking Frais.
|
2025-07-18 23:20:34 +02:00
|
|
|
|
CoreSubsystem->GetStageRankingsWithKey(StageKey, TempStageRankings, true);
|
|
|
|
|
|
AllRankings.Add(TempStageRankings);
|
|
|
|
|
|
LaunchPursuitSequence();
|
|
|
|
|
|
// CoreSubsystem->GetStageRankings()
|
2025-07-11 19:04:37 +02:00
|
|
|
|
}
|
2025-07-11 13:09:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-13 18:07:14 +02:00
|
|
|
|
void UDTFluxPursuitManager::SetPursuitInfoIsMassStart(FDTFluxPursuitGroup& NextFocusGroup)
|
2025-07-11 13:09:18 +02:00
|
|
|
|
{
|
|
|
|
|
|
for (auto& Pursuit : NextFocusGroup.PursuitGroup)
|
|
|
|
|
|
{
|
|
|
|
|
|
Pursuit.bIsMassStart = Pursuit.StartTime >= MassStartTime;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-12 16:07:37 +02:00
|
|
|
|
|
2025-07-11 13:09:18 +02:00
|
|
|
|
void UDTFluxPursuitManager::GetPursuit(TArray<FDTFluxPursuitInfo>& OutPursuitFocusNext,
|
|
|
|
|
|
TArray<FDTFluxPursuitInfo>& OutPursuitNext, bool& BIsFocusTruncate,
|
|
|
|
|
|
const int MaxSimultaneousPursuit)
|
|
|
|
|
|
{
|
2025-07-13 04:13:02 +02:00
|
|
|
|
FDateTime MetricsStartFunction = FDateTime::UtcNow();
|
|
|
|
|
|
FDateTime CurrentTime = FDateTime::Now();
|
2025-07-13 02:38:05 +02:00
|
|
|
|
|
2025-07-18 23:20:34 +02:00
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("=== GetPursuit CALLED ==="));
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("MaxSimultaneousPursuit: %d"), MaxSimultaneousPursuit);
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Available groups: %d"), GroupedPursuit.Num());
|
2025-07-12 16:07:37 +02:00
|
|
|
|
|
2025-07-13 04:13:02 +02:00
|
|
|
|
// BAd Parameter
|
2025-07-11 13:09:18 +02:00
|
|
|
|
if (MaxSimultaneousPursuit <= 0)
|
|
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("Invalid MaxSimultaneousPursuit: %d"), MaxSimultaneousPursuit);
|
|
|
|
|
|
OutPursuitFocusNext.Reset();
|
|
|
|
|
|
OutPursuitNext.Reset();
|
2025-07-11 13:09:18 +02:00
|
|
|
|
BIsFocusTruncate = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-07-12 16:07:37 +02:00
|
|
|
|
if (bIsSequenceDone || GroupedPursuit.IsEmpty())
|
2025-07-11 13:09:18 +02:00
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("No groups available or sequence completed"));
|
|
|
|
|
|
OutPursuitFocusNext.Reset();
|
|
|
|
|
|
OutPursuitNext.Reset();
|
2025-07-11 13:09:18 +02:00
|
|
|
|
BIsFocusTruncate = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-07-13 02:38:05 +02:00
|
|
|
|
for (int32 i = GroupedPursuit.Num() - 1; i >= 0; i--) // Parcours inverse pour éviter les problèmes d'index
|
|
|
|
|
|
{
|
|
|
|
|
|
const FDTFluxPursuitGroup& Group = GroupedPursuit[i];
|
2025-07-13 04:13:02 +02:00
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Log, TEXT("Group.StartTimeGlobal(%s) < CurrentTime(%s) "),
|
|
|
|
|
|
*Group.StartTimeGlobal.ToString(), *CurrentTime.ToString())
|
2025-07-13 02:38:05 +02:00
|
|
|
|
// Vérifier si le StartTime du groupe est déjà passé
|
|
|
|
|
|
if (Group.StartTimeGlobal < CurrentTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning,
|
|
|
|
|
|
TEXT("Removing expired group: StartTime=%s (Current=%s), Participants=%d"),
|
|
|
|
|
|
*Group.StartTimeGlobal.ToString(),
|
|
|
|
|
|
*CurrentTime.ToString(),
|
|
|
|
|
|
Group.PursuitGroup.Num());
|
|
|
|
|
|
|
|
|
|
|
|
GroupedPursuit.RemoveAt(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-11 13:09:18 +02:00
|
|
|
|
OutPursuitFocusNext.Reset();
|
|
|
|
|
|
OutPursuitNext.Reset();
|
2025-07-12 16:07:37 +02:00
|
|
|
|
|
2025-07-13 04:13:02 +02:00
|
|
|
|
if (GroupedPursuit.IsEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("All groups were expired and removed - no groups available"));
|
|
|
|
|
|
OutPursuitFocusNext.Reset();
|
|
|
|
|
|
OutPursuitNext.Reset();
|
|
|
|
|
|
BIsFocusTruncate = false;
|
2025-07-18 23:20:34 +02:00
|
|
|
|
bIsSequenceDone = true;
|
2025-07-13 04:13:02 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-13 02:38:05 +02:00
|
|
|
|
FDTFluxPursuitGroup FocusGroup = GroupedPursuit[0];
|
|
|
|
|
|
GroupedPursuit.RemoveAt(0);
|
2025-07-12 16:07:37 +02:00
|
|
|
|
|
|
|
|
|
|
SetPursuitInfoIsMassStart(FocusGroup);
|
|
|
|
|
|
OutPursuitFocusNext = FocusGroup.PursuitGroup;
|
|
|
|
|
|
BIsFocusTruncate = FocusGroup.PursuitGroup.Num() > 1;
|
|
|
|
|
|
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning,
|
|
|
|
|
|
TEXT("Focus Group: StartTime=%s, Participants=%d"),
|
|
|
|
|
|
*FocusGroup.StartTimeGlobal.ToString(),
|
|
|
|
|
|
FocusGroup.PursuitGroup.Num());
|
|
|
|
|
|
|
2025-07-13 18:07:14 +02:00
|
|
|
|
int32 TargetNextCount = MaxSimultaneousPursuit - 1;
|
2025-07-12 16:07:37 +02:00
|
|
|
|
int32 AddedNextCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Target Next Count: %d"), TargetNextCount);
|
|
|
|
|
|
|
|
|
|
|
|
for (int32 GroupIndex = 0;
|
|
|
|
|
|
GroupIndex < GroupedPursuit.Num() && AddedNextCount < TargetNextCount;
|
|
|
|
|
|
GroupIndex++)
|
|
|
|
|
|
{
|
2025-07-13 18:07:14 +02:00
|
|
|
|
FDTFluxPursuitGroup& NextGroup = GroupedPursuit[GroupIndex];
|
2025-07-12 16:07:37 +02:00
|
|
|
|
|
|
|
|
|
|
if (NextGroup.PursuitGroup.Num() == 0)
|
2025-07-11 13:09:18 +02:00
|
|
|
|
{
|
2025-07-13 18:07:14 +02:00
|
|
|
|
continue;
|
2025-07-12 16:07:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32 AvailableInGroup = NextGroup.PursuitGroup.Num();
|
|
|
|
|
|
int32 NeededFromGroup = FMath::Min(TargetNextCount - AddedNextCount, AvailableInGroup);
|
|
|
|
|
|
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning,
|
|
|
|
|
|
TEXT("Processing Next Group %d: StartTime=%s, Available=%d, Taking=%d"),
|
|
|
|
|
|
GroupIndex,
|
|
|
|
|
|
*NextGroup.StartTimeGlobal.ToString(),
|
|
|
|
|
|
AvailableInGroup,
|
|
|
|
|
|
NeededFromGroup);
|
|
|
|
|
|
|
|
|
|
|
|
for (int32 ParticipantIndex = 0; ParticipantIndex < NeededFromGroup; ParticipantIndex++)
|
|
|
|
|
|
{
|
|
|
|
|
|
FDTFluxPursuitInfo NextParticipant = NextGroup.PursuitGroup[ParticipantIndex]; // Copie
|
|
|
|
|
|
|
|
|
|
|
|
NextParticipant.bIsMassStart = NextParticipant.StartTime >= MassStartTime;
|
|
|
|
|
|
|
|
|
|
|
|
OutPursuitNext.Add(NextParticipant);
|
|
|
|
|
|
AddedNextCount++;
|
|
|
|
|
|
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, VeryVerbose,
|
|
|
|
|
|
TEXT("Added to Next: Bib %d from Group %d"),
|
|
|
|
|
|
NextParticipant.Bib, GroupIndex);
|
2025-07-11 13:09:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-12 16:07:37 +02:00
|
|
|
|
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("=== PURSUIT RESULTS ==="));
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Focus: %d participants"), OutPursuitFocusNext.Num());
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Next: %d participants"), OutPursuitNext.Num());
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Remaining groups for future: %d"), GroupedPursuit.Num());
|
|
|
|
|
|
|
|
|
|
|
|
if (OutPursuitFocusNext.Num() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugFocusNext(OutPursuitFocusNext);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Log détaillé des Next (limité pour éviter spam)
|
|
|
|
|
|
if (OutPursuitNext.Num() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugOutPoursuitNext(OutPursuitNext);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Vérifier si la séquence est terminée
|
|
|
|
|
|
if (GroupedPursuit.IsEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
bIsSequenceDone = true;
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Pursuit sequence will be completed after this round"));
|
|
|
|
|
|
}
|
2025-07-13 04:13:02 +02:00
|
|
|
|
FTimespan Duration = FDateTime::UtcNow() - MetricsStartFunction;
|
2025-07-13 02:38:05 +02:00
|
|
|
|
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Metrics Time Out: %d fraction seconds"),
|
|
|
|
|
|
Duration.GetDuration().GetFractionMicro());
|
2025-07-11 13:09:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 19:04:37 +02:00
|
|
|
|
bool UDTFluxPursuitManager::InitSubSystems()
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
if (NetworkSubsystem)
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
return true;
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
2025-07-11 19:04:37 +02:00
|
|
|
|
NetworkSubsystem = GEngine->GetEngineSubsystem<UDTFluxNetworkSubsystem>();
|
|
|
|
|
|
return NetworkSubsystem != nullptr;
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 19:04:37 +02:00
|
|
|
|
bool UDTFluxPursuitManager::BindRankings()
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
if (CoreSubsystem)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!bIsRankingBounded)
|
|
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
CoreSubsystem->OnStageRankings.AddDynamic(this, &UDTFluxPursuitManager::OnRankingsReceived);
|
2025-07-11 19:04:37 +02:00
|
|
|
|
bIsRankingBounded = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return bIsRankingBounded;
|
|
|
|
|
|
}
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("CoreSubsystem is not Available !!!"));
|
|
|
|
|
|
return bIsRankingBounded = false;
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 19:04:37 +02:00
|
|
|
|
void UDTFluxPursuitManager::UnbindRankings()
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
if (CoreSubsystem)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (bIsRankingBounded)
|
|
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
CoreSubsystem->OnStageRankings.RemoveDynamic(this, &UDTFluxPursuitManager::OnRankingsReceived);
|
2025-07-11 19:04:37 +02:00
|
|
|
|
bIsRankingBounded = false;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
bIsRankingBounded = false;
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("CoreSubsystem is not Available !!!"));
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 19:04:37 +02:00
|
|
|
|
void UDTFluxPursuitManager::OnRankingsReceived(const FDTFluxStageKey NewStageKey,
|
|
|
|
|
|
const FDTFluxStageRankings NewStageRankings)
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
if (PendingStageRanking.Contains(NewStageKey))
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
PendingStageRanking.Remove(NewStageKey);
|
|
|
|
|
|
AllRankings.Add(NewStageRankings);
|
|
|
|
|
|
if (PendingStageRanking.IsEmpty())
|
|
|
|
|
|
{
|
|
|
|
|
|
//everything is ready to go compute and start
|
|
|
|
|
|
UnbindRankings();
|
|
|
|
|
|
LaunchPursuitSequence();
|
|
|
|
|
|
}
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 19:04:37 +02:00
|
|
|
|
bool UDTFluxPursuitManager::LaunchPursuitSequence()
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 13:09:18 +02:00
|
|
|
|
GroupedPursuit.Empty();
|
2025-07-09 03:27:23 +02:00
|
|
|
|
TArray<FDTFluxPursuitInfo> AllPursuits;
|
|
|
|
|
|
TMap<FDateTime, FDTFluxPursuitGroup> TempGroups;
|
2025-07-11 19:04:37 +02:00
|
|
|
|
bIsSequenceDone = false;
|
2025-07-09 03:27:23 +02:00
|
|
|
|
// Full the Array Of Rankings
|
2025-07-11 19:04:37 +02:00
|
|
|
|
for (auto& Ranking : AllRankings)
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
for (auto StageRanking : Ranking.Rankings)
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
2025-07-11 19:04:37 +02:00
|
|
|
|
int ContestId = Ranking.ContestId;
|
2025-07-09 03:27:23 +02:00
|
|
|
|
FDTFluxPursuitInfo PursuitInfo;
|
|
|
|
|
|
PursuitInfo.StartTime = StageRanking.StartTime;
|
|
|
|
|
|
PursuitInfo.Bib = StageRanking.Bib;
|
|
|
|
|
|
PursuitInfo.ContestId = ContestId;
|
|
|
|
|
|
AllPursuits.Add(PursuitInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-12 16:07:37 +02:00
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("AllPursuits.Num() = %i"), AllPursuits.Num());
|
2025-07-09 03:27:23 +02:00
|
|
|
|
for (auto& Pursuit : AllPursuits)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (TempGroups.Contains(Pursuit.StartTime))
|
|
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
FDTFluxPursuitGroup& Group = TempGroups[Pursuit.StartTime];
|
|
|
|
|
|
Group.PursuitGroup.Add(Pursuit);
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning,
|
|
|
|
|
|
TEXT("Adding [%i] To PursuitGroup starting At %s, PursuitGroup.Num() %i"),
|
|
|
|
|
|
Pursuit.Bib, *Pursuit.StartTime.ToString(), Group.PursuitGroup.Num());
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
FDTFluxPursuitGroup NewGroup;
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("New Group starting At %s, Adding Bib [%i]"),
|
|
|
|
|
|
*Pursuit.StartTime.ToString(), Pursuit.Bib);
|
|
|
|
|
|
NewGroup.StartTimeGlobal = Pursuit.StartTime;
|
|
|
|
|
|
NewGroup.PursuitGroup.Add(Pursuit);
|
|
|
|
|
|
TempGroups.Add(Pursuit.StartTime, NewGroup);
|
|
|
|
|
|
for (const auto& Group : TempGroups)
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Group.StartTime = %s, Group.PursuitGroup.Num() = %i"),
|
|
|
|
|
|
*Group.Key.ToString(), Group.Value.PursuitGroup.Num());
|
|
|
|
|
|
}
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
TempGroups.KeySort([](const FDateTime& A, const FDateTime& B)
|
|
|
|
|
|
{
|
|
|
|
|
|
return A < B;
|
|
|
|
|
|
});
|
2025-07-11 13:09:18 +02:00
|
|
|
|
TMap<FDateTime, int> StartTimeFrequency;
|
|
|
|
|
|
int32 MaxFrequency = 0;
|
|
|
|
|
|
GroupedPursuit.Reserve(TempGroups.Num());
|
2025-07-12 16:07:37 +02:00
|
|
|
|
// parcours du TMap
|
2025-07-09 03:27:23 +02:00
|
|
|
|
for (const auto& Pair : TempGroups)
|
|
|
|
|
|
{
|
2025-07-11 13:09:18 +02:00
|
|
|
|
if (Pair.Value.StartTimeGlobal != FDateTime::MinValue() && Pair.Value.StartTimeGlobal != FDateTime::MaxValue())
|
|
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
int& CurrentFreq = StartTimeFrequency.FindOrAdd(Pair.Value.StartTimeGlobal, 0);
|
|
|
|
|
|
CurrentFreq = Pair.Value.PursuitGroup.Num();
|
|
|
|
|
|
if (CurrentFreq > MaxFrequency)
|
2025-07-11 13:09:18 +02:00
|
|
|
|
{
|
2025-07-12 16:07:37 +02:00
|
|
|
|
MaxFrequency = CurrentFreq;
|
|
|
|
|
|
MassStartTime = Pair.Value.StartTimeGlobal;
|
2025-07-11 13:09:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
GroupedPursuit.Add(Pair.Value);
|
2025-07-09 03:27:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-11 13:09:18 +02:00
|
|
|
|
GroupedPursuit.Sort([](const FDTFluxPursuitGroup& A, const FDTFluxPursuitGroup& B)
|
2025-07-09 03:27:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
return A.StartTimeGlobal < B.StartTimeGlobal;
|
|
|
|
|
|
});
|
2025-07-11 19:04:37 +02:00
|
|
|
|
|
|
|
|
|
|
TArray<FDTFluxPursuitInfo> FocusPursuits;
|
|
|
|
|
|
TArray<FDTFluxPursuitInfo> NextPursuits;
|
|
|
|
|
|
bool bIsFocusTruncate = false;
|
|
|
|
|
|
|
|
|
|
|
|
GetPursuit(FocusPursuits, NextPursuits, bIsFocusTruncate);
|
2025-07-12 09:41:15 +02:00
|
|
|
|
FPursuitStarterData PursuitData = FPursuitStarterData(FocusPursuits, NextPursuits, MassStartTime, bIsFocusTruncate);
|
|
|
|
|
|
OnPursuitSequenceReady.Broadcast(PursuitData);
|
2025-07-09 03:27:23 +02:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2025-07-18 23:20:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UDTFluxPursuitManager::DebugFocusNext(const TArray<FDTFluxPursuitInfo>& OutPursuitFocusNext)
|
|
|
|
|
|
{
|
|
|
|
|
|
FString FocusBibs;
|
|
|
|
|
|
for (const auto& Pursuit : OutPursuitFocusNext)
|
|
|
|
|
|
{
|
|
|
|
|
|
FocusBibs += FString::Printf(TEXT("%d "), Pursuit.Bib);
|
|
|
|
|
|
}
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Focus Bibs: %s"), *FocusBibs);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UDTFluxPursuitManager::DebugOutPoursuitNext(const TArray<FDTFluxPursuitInfo>& OutPursuitNext)
|
|
|
|
|
|
{
|
|
|
|
|
|
FString NextBibs;
|
|
|
|
|
|
for (int32 i = 0; i < OutPursuitNext.Num(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
NextBibs += FString::Printf(TEXT("%d "), OutPursuitNext[i].Bib);
|
|
|
|
|
|
}
|
|
|
|
|
|
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Next Bibs: %s"), *NextBibs);
|
|
|
|
|
|
}
|