2025-07-09 03:27:23 +02:00
|
|
|
|
#pragma once
|
2025-06-29 19:04:36 +02:00
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
2025-07-13 04:13:02 +02:00
|
|
|
|
#include "DTFluxCoreSubsystemModule.h"
|
|
|
|
|
|
#include "Assets/DTFluxModelAsset.h"
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#include "Containers/Deque.h"
|
2025-07-11 19:04:37 +02:00
|
|
|
|
#include "Types/Struct/FDTFluxPursuitInfo.h"
|
2025-06-29 19:04:36 +02:00
|
|
|
|
#include "Subsystems/EngineSubsystem.h"
|
|
|
|
|
|
#include "Types/Struct/DTFluxRaceDataStructs.h"
|
|
|
|
|
|
#include "Types/Struct/DTFluxTeamListStruct.h"
|
|
|
|
|
|
#include "Types/Struct/DTFluxRankingStructs.h"
|
2025-07-04 01:13:07 +02:00
|
|
|
|
#include "Types/Struct/DTFluxSplitSensor.h"
|
2025-06-29 19:04:36 +02:00
|
|
|
|
#include "DTFluxCoreSubsystem.generated.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-03 17:28:51 +02:00
|
|
|
|
class UDTFluxNetworkSubsystem;
|
2025-06-29 19:04:36 +02:00
|
|
|
|
/** Forward Decl */
|
|
|
|
|
|
class UDTFluxModelAsset;
|
2025-07-09 03:27:23 +02:00
|
|
|
|
class UDTFluxPursuitManager;
|
2025-07-11 23:45:23 +02:00
|
|
|
|
struct FDTFluxServerResponse;
|
2025-06-29 19:04:36 +02:00
|
|
|
|
|
2025-07-11 19:04:37 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
/**
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
2025-07-11 13:09:18 +02:00
|
|
|
|
UCLASS(BlueprintType, meta=(DisplayName="DTFlux Core Subsystem"))
|
2025-06-29 19:04:36 +02:00
|
|
|
|
class DTFLUXCORESUBSYSTEM_API UDTFluxCoreSubsystem : public UEngineSubsystem
|
|
|
|
|
|
{
|
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2025-07-12 09:41:15 +02:00
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSplitRankings, FDTFluxSplitKey, SplitKey, FDTFluxSplitRankings,
|
|
|
|
|
|
SplitRankings);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnSplitRankings OnSplitRankings;
|
2025-07-12 09:41:15 +02:00
|
|
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnStageRankings, FDTFluxStageKey, StageKey, FDTFluxStageRankings,
|
|
|
|
|
|
StageRankings);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnStageRankings OnStageRankings;
|
2025-07-12 09:41:15 +02:00
|
|
|
|
|
2025-07-14 15:40:03 +02:00
|
|
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnContestRankingDisplayReady, const FGuid, RequestId, const bool,
|
|
|
|
|
|
bSuccesRequest);
|
|
|
|
|
|
|
|
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnContestRankingDisplayReady OnContestRankingDisplayReady;
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnStageRankingDisplayReady, const FGuid, RequestId, const bool,
|
|
|
|
|
|
bSuccesRequest);
|
|
|
|
|
|
|
|
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnStageRankingDisplayReady OnStageRankingDisplayReady;
|
|
|
|
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnSplitRankingDisplayReady, const FGuid, RequestId, const bool,
|
|
|
|
|
|
bSuccesRequest);
|
|
|
|
|
|
|
|
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnSplitRankingDisplayReady OnSplitRankingDisplayReady;
|
|
|
|
|
|
|
2025-07-12 09:41:15 +02:00
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnContestRankings, const int, ContestId, FDTFluxContestRankings,
|
|
|
|
|
|
ContestRankings);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnContestRankings OnContestRankings;
|
2025-07-12 09:41:15 +02:00
|
|
|
|
|
2025-07-04 15:17:22 +02:00
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnTeamList);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnTeamList OnTeamList;
|
2025-07-04 15:17:22 +02:00
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTeamStatusUpdate, FDTFluxParticipant, TeamUpdated);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FOnTeamStatusUpdate OnTeamStatusUpdate;
|
2025-07-11 19:04:37 +02:00
|
|
|
|
|
2025-07-12 16:07:37 +02:00
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
UDTFluxPursuitManager* PursuitManager = nullptr;
|
2025-07-11 19:04:37 +02:00
|
|
|
|
|
2025-07-14 02:40:03 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
2025-07-14 09:33:25 +02:00
|
|
|
|
//TODO : this must be a ProjectSetting
|
|
|
|
|
|
UPROPERTY(BlueprintReadOnly, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool bShouldKeepRankings = true;
|
2025-07-14 02:40:03 +02:00
|
|
|
|
|
2025-07-14 15:40:03 +02:00
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FGuid InitContestRankingsDisplay(const int ContestIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FGuid InitStageRankingsDisplay(const int ContestId, const int StageId);
|
|
|
|
|
|
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
FGuid InitSplitRankingsDisplay(const int ContestId, const int StageId, const int SplitId);
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-14 02:40:03 +02:00
|
|
|
|
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);
|
2025-07-11 19:04:37 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetContestRankings(const int ContestId, FDTFluxContestRankings& OutContestRankings);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetStageRankings(const int ContestId, const int StageId, FDTFluxStageRankings& OutStageRankings);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetSplitRankings(const int ContestId, const int StageId, const int SplitId,
|
|
|
|
|
|
FDTFluxSplitRankings& OutSplitRankings);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetStageRankingsWithKey(const FDTFluxStageKey StageKey, FDTFluxStageRankings& OutStageRankings,
|
|
|
|
|
|
const bool bShouldUseCached = true);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetSplitRankingsWithKey(const FDTFluxSplitKey SplitKey, FDTFluxSplitRankings& OutSplitRankings,
|
|
|
|
|
|
const bool bShouldUseCached = true);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-12 16:07:37 +02:00
|
|
|
|
TArray<FGuid> TrackedRequestContestRankings(const TArray<int> ForContests, bool bEnableCache = true);
|
2025-07-11 19:04:37 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-12 16:07:37 +02:00
|
|
|
|
TArray<FGuid> TrackedRequestStageRankings(const TArray<FDTFluxStageKey> ForStages, bool bEnableCache = true);
|
2025-07-11 19:04:37 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-12 16:07:37 +02:00
|
|
|
|
TArray<FGuid> TrackedRequestSplitRankings(const TArray<FDTFluxSplitKey> ForSplits, bool bEnableCache = true);
|
2025-07-08 20:16:36 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-14 02:40:03 +02:00
|
|
|
|
bool GetParticipant(int InBib, FDTFluxParticipant& OutParticipant);
|
2025-07-14 09:58:10 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-04 15:17:22 +02:00
|
|
|
|
TArray<int> GetCurrentContestsId();
|
2025-07-14 09:58:10 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetCurrentContests(TArray<FDTFluxContest>& OutContests);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
TArray<int> GetContestsIdForTime(const FDateTime Time);
|
2025-07-13 04:13:02 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-08 20:16:36 +02:00
|
|
|
|
bool GetContestForId(const int Id, FDTFluxContest& OutContest);
|
2025-07-13 04:13:02 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-14 09:58:10 +02:00
|
|
|
|
bool GetContestsForTime(const FDateTime Time, TArray<FDTFluxContest>& OutContests);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetContests(TArray<FDTFluxContest>& OutContests);
|
2025-07-13 04:13:02 +02:00
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
2025-07-14 09:33:25 +02:00
|
|
|
|
void GetContest(const int ContestId, FDTFluxContest& OutContest);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetStageDefinition(const FDTFluxStageKey StageKey, FDTFluxStage& OutStageDefinition);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
bool GetSplitDefinition(const FDTFluxSplitKey SplitKey, FDTFluxSplit& OutSplitDefinition);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
void GetStage(const int ContestId, const int StageId, FDTFluxStage& OutStageDefinition);
|
|
|
|
|
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Core Subsystem")
|
|
|
|
|
|
void GetSplit(const int ContestId, const int StageId, const int SplitId, FDTFluxSplit& OutSplitDefinition);
|
2025-07-13 04:13:02 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
protected:
|
|
|
|
|
|
// ~Subsystem Interface
|
|
|
|
|
|
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
|
|
|
|
|
virtual void Deinitialize() override;
|
|
|
|
|
|
// ~Subsystem Interface
|
2025-07-04 01:13:07 +02:00
|
|
|
|
UFUNCTION()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
void SaveDataStorage();
|
2025-07-11 23:45:23 +02:00
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
void ProcessTrackedResponse(FDTFluxServerResponse& InResponse);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-06-29 19:04:36 +02:00
|
|
|
|
private:
|
2025-07-03 17:28:51 +02:00
|
|
|
|
UDTFluxNetworkSubsystem* NetworkSubsystem = nullptr;
|
2025-07-11 13:09:18 +02:00
|
|
|
|
UPROPERTY()
|
|
|
|
|
|
UDTFluxModelAsset* DataStorage = nullptr;
|
2025-06-29 19:04:36 +02:00
|
|
|
|
|
|
|
|
|
|
UFUNCTION()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
void ProcessRaceData(const FDTFluxRaceData& RaceDataDefinition);
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
void ProcessTeamList(const FDTFluxTeamListDefinition& TeamListDefinition);
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
void ProcessContestRanking(const FDTFluxContestRankings& ContestRankings);
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UFUNCTION()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
void ProcessStageRanking(const FDTFluxStageRankings& StageRankings);
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UFUNCTION()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
void ProcessSplitRanking(const FDTFluxSplitRankings& SplitRankings);
|
2025-06-30 19:02:19 +02:00
|
|
|
|
UFUNCTION()
|
2025-07-08 16:50:31 +02:00
|
|
|
|
void ProcessTeamStatusUpdate(const FDTFluxTeamStatusUpdate& NewParticipantStatus);
|
2025-07-04 01:13:07 +02:00
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
void ProcessSplitSensor(const FDTFluxSplitSensorInfo& SplitSensorInfo);
|
2025-06-30 19:02:19 +02:00
|
|
|
|
UFUNCTION()
|
2025-07-08 16:50:31 +02:00
|
|
|
|
void ProcessTeamUpdate(const FDTFluxTeamListDefinition& TeamListDefinition);
|
2025-06-29 19:04:36 +02:00
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
void SendRequest(const FString& Message);
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
void RegisterDelegates();
|
2025-07-14 15:40:03 +02:00
|
|
|
|
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
bool IsStageRankingSealed(FDTFluxStageKey StageKey);
|
|
|
|
|
|
UFUNCTION()
|
|
|
|
|
|
bool IsContestRankingSealed(int ContestId);
|
2025-06-29 19:04:36 +02:00
|
|
|
|
};
|