Added Tracking Mechanism for Participant
This commit is contained in:
@ -224,13 +224,34 @@ bool UDTFluxCoreSubsystem::IsContestRankingSealed(int ContestId)
|
||||
return false;
|
||||
}
|
||||
|
||||
EDTFluxFinisherType UDTFluxCoreSubsystem::GetSplitSensorType(const FDTFluxSplitSensorInfo& SplitSensorInfo)
|
||||
{
|
||||
if (DataStorage != nullptr)
|
||||
{
|
||||
if (DataStorage->LastSplitIdCache.Contains(SplitSensorInfo.ContestId))
|
||||
{
|
||||
int LastSplitIdForContest = DataStorage->LastSplitIdCache[SplitSensorInfo.ContestId];
|
||||
if (LastSplitIdForContest == SplitSensorInfo.SplitId)
|
||||
{
|
||||
if (SplitSensorInfo.Rank == 1 )
|
||||
{
|
||||
return EDTFluxFinisherType::Winner;
|
||||
}
|
||||
return EDTFluxFinisherType::Finish;
|
||||
}
|
||||
}
|
||||
}
|
||||
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage not available"));
|
||||
return EDTFluxFinisherType::None;
|
||||
}
|
||||
|
||||
|
||||
void UDTFluxCoreSubsystem::ProcessRaceData(const FDTFluxRaceData& RaceDataDefinition)
|
||||
{
|
||||
if (RaceDataDefinition.Datas.Num() > 0)
|
||||
{
|
||||
UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Receiving RaceDataDefinition [%s]"),
|
||||
*RaceDataDefinition.Datas[0].Name);
|
||||
// UE_LOG(logDTFluxCoreSubsystem, Warning, TEXT("Receiving RaceDataDefinition [%s]"),
|
||||
// *RaceDataDefinition.Datas[0].Name);
|
||||
if (DataStorage != nullptr)
|
||||
{
|
||||
UE_LOG(logDTFluxCoreSubsystem, Error, TEXT("DataStorage Name %s"), *DataStorage->EventName);
|
||||
@ -307,17 +328,41 @@ void UDTFluxCoreSubsystem::ProcessTeamUpdate(const FDTFluxTeamListDefinition& Te
|
||||
|
||||
void UDTFluxCoreSubsystem::ProcessSplitSensor(const FDTFluxSplitSensorInfo& SplitSensorInfo)
|
||||
{
|
||||
FDTFluxContest Contest;
|
||||
FDTFluxStageKey StageKey(SplitSensorInfo.ContestId, SplitSensorInfo.StageId);
|
||||
FDTFluxStage Stage;
|
||||
DataStorage->GetStage(StageKey, Stage);
|
||||
FDTFluxParticipant Participant;
|
||||
DataStorage->GetParticipantByBib(SplitSensorInfo.Bib, Participant);
|
||||
|
||||
DataStorage->GetContestById(SplitSensorInfo.ContestId, Contest);
|
||||
UE_LOG(logDTFluxCoreSubsystem, Log, TEXT("%s|%s Split %i Sensor for Participant [Bib] %i [FullName] %s"),
|
||||
*Contest.Name, *Stage.Name,
|
||||
SplitSensorInfo.SplitId, SplitSensorInfo.Bib, *Participant.GetFormattedName());
|
||||
if (DataStorage != nullptr)
|
||||
{
|
||||
// Gestion Cache Split Sensor
|
||||
FDTFluxSplitSensorKey SplitSensorKey(SplitSensorInfo.ContestId, SplitSensorInfo.StageId, SplitSensorInfo.SplitId, -1);
|
||||
FDTFluxSplitSensorInfo NewSplitSensorInfo = SplitSensorInfo;
|
||||
NewSplitSensorInfo.SplitName = DataStorage->SplitSensorInfoCache[SplitSensorKey].SplitName;
|
||||
SplitSensorKey.Bib = SplitSensorInfo.Bib;
|
||||
DataStorage->SplitSensorInfoCache.Add(SplitSensorKey, NewSplitSensorInfo);
|
||||
// Update Current currentSplit
|
||||
FDTFluxParticipant Participant;
|
||||
if (DataStorage->Participants.Contains(SplitSensorInfo.Bib))
|
||||
{
|
||||
DataStorage->Participants[SplitSensorInfo.Bib].CurrentSplit = SplitSensorInfo.SplitId;
|
||||
}
|
||||
// Gestion Finnish Status
|
||||
switch (GetSplitSensorType(SplitSensorInfo))
|
||||
{
|
||||
case EDTFluxFinisherType::Winner:
|
||||
{
|
||||
OnWinner.Broadcast(SplitSensorInfo);
|
||||
break;
|
||||
}
|
||||
case EDTFluxFinisherType::Finish :
|
||||
{
|
||||
OnFinisher.Broadcast(SplitSensorInfo);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
OnSplitSensor.Broadcast(SplitSensorInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UDTFluxCoreSubsystem::SendRequest(const FString& Message)
|
||||
@ -328,6 +373,44 @@ void UDTFluxCoreSubsystem::SendRequest(const FString& Message)
|
||||
}
|
||||
}
|
||||
|
||||
void UDTFluxCoreSubsystem::InitParticipantTracking(const int Bib, const int ContestId, const int StageId)
|
||||
{
|
||||
FDTFluxContest Contest;
|
||||
if (GetContestForId(ContestId, Contest))
|
||||
{
|
||||
// get all splits
|
||||
TArray<FDTFluxSplitSensorInfo> SplitSensorInfos;
|
||||
FDTFluxSplitSensorKey SplitSensorKey;
|
||||
SplitSensorKey.ContestId = ContestId;
|
||||
SplitSensorKey.StageId = StageId;
|
||||
SplitSensorKey.Bib = Bib;
|
||||
for (auto Split : Contest.Splits)
|
||||
{
|
||||
SplitSensorKey.SplitId = Split.SplitId;
|
||||
if (DataStorage->SplitSensorInfoCache.Contains(SplitSensorKey))
|
||||
{
|
||||
SplitSensorInfos.Add(DataStorage->SplitSensorInfoCache[SplitSensorKey]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitSensorInfos.Add(FDTFluxSplitSensorInfo(Split.Name));
|
||||
}
|
||||
}
|
||||
FDTFluxSplitHistory History;
|
||||
History.SplitSensors = SplitSensorInfos;
|
||||
OnParticipantTrackingReady.Broadcast(History);
|
||||
|
||||
|
||||
}
|
||||
FDTFluxSplitHistory SplitHistory;
|
||||
if (GetParticipant(Bib, SplitHistory.Participant))
|
||||
{
|
||||
|
||||
}
|
||||
FString Text = "sqfhds";
|
||||
FName Key = FName(Text);
|
||||
}
|
||||
|
||||
FGuid UDTFluxCoreSubsystem::InitContestRankingsDisplay(const int ContestId)
|
||||
{
|
||||
if (NetworkSubsystem)
|
||||
|
||||
@ -87,17 +87,30 @@ public:
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
|
||||
FOnFinisher OnFinisher;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPreFinish, FDTFluxSplitSensorInfo, SplitSensorInfo);
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
|
||||
FOnPreFinish OnPreFinish;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnWinner, FDTFluxSplitSensorInfo, SplitSensorInfo);
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
|
||||
FOnWinner OnWinner;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnParticipantTrackingReady, FDTFluxSplitHistory, SplitHistory);
|
||||
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
||||
FOnParticipantTrackingReady OnParticipantTrackingReady;
|
||||
|
||||
//TODO : this must be a ProjectSetting
|
||||
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
|
||||
bool bShouldKeepRankings = true;
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||
void InitParticipantTracking(const int Bib, const int ContestId, const int StageId);
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||
FGuid InitContestRankingsDisplay(const int ContestIds);
|
||||
|
||||
@ -108,6 +121,7 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||
FGuid InitSplitRankingsDisplay(const int ContestId, const int StageId, const int SplitId);
|
||||
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
||||
bool GetStageRankingForBib(const int ContestId, const int StageId, const int Bib,
|
||||
@ -196,9 +210,11 @@ private:
|
||||
void SendRequest(const FString& Message);
|
||||
UFUNCTION()
|
||||
void RegisterDelegates();
|
||||
|
||||
UFUNCTION()
|
||||
bool IsStageRankingSealed(FDTFluxStageKey StageKey);
|
||||
UFUNCTION()
|
||||
bool IsContestRankingSealed(int ContestId);
|
||||
|
||||
EDTFluxFinisherType GetSplitSensorType(const FDTFluxSplitSensorInfo& SplitSensorInfo);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user