Files
DTFluxAPI/Source/DTFluxCore/Public/Assets/DTFluxModelAsset.h

102 lines
3.4 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "Dom/JsonObject.h"
#include "Types/Struct/DTFluxCompositeKey.h"
#include "Types/Struct/DTFluxRaceDataStructs.h"
#include "Types/Struct/DTFluxSplitSensor.h"
#include "DTFluxModelAsset.generated.h"
class UDTFluxContestStorage;
/**
* Class representing Data Storage
*/
UCLASS(BlueprintType)
class DTFLUXCORE_API UDTFluxModelAsset : public UObject
{
GENERATED_BODY()
UDTFluxModelAsset(const FObjectInitializer& ObjectInitializer);
public:
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FString EventName = "MyEvent";
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TArray<FDTFluxPerson> Persons;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TMap<int /* Bib */, FDTFluxParticipant> Participants;
UPROPERTY(BlueprintReadOnly, EditAnywhere)
TMap<FString /* ContestName */, FDTFluxContest> Contests;
UPROPERTY(BlueprintReadOnly, EditAnywhere)
TMap<int /*ContestId*/, FDTFluxContestRankings> ContestRankings;
UPROPERTY(BlueprintReadOnly, EditAnywhere)
TMap<FDTFluxStageKey, FDTFluxStageRankings> StageRankings;
UPROPERTY(BlueprintReadOnly, EditAnywhere)
TMap<FDTFluxSplitKey, FDTFluxSplitRankings> SplitRankings;
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|ModelAsset")
void AddContest(const FDTFluxContest& Contest);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Contest")
bool GetContestById(const int InContestId, FDTFluxContest& OutContest);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Contest")
bool GetStage(FDTFluxStageKey StageKey, FDTFluxStage& OutStage);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Person")
void AddPerson(const FDTFluxPerson& InPerson);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Participant")
void AddParticipant(const FDTFluxParticipant& InParticipant, const int ContestId);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Person|Utils")
bool PersonExists(const FDTFluxPerson& InPerson) const;
UFUNCTION(BlueprintCallable, Category="DTFlux|Contest|Utils")
FString GetContestNameForId(const int InContestID);
UFUNCTION(BlueprintCallable, Category="DTFlux|Stage")
void UpdateOrCreateStageRanking(const FDTFluxStageRankings& InStageRankings);
UFUNCTION(BlueprintCallable, Category="DTFlux|Stage")
void AddStageRanking(const FDTFluxStageRankings& InStageRankings);
UFUNCTION(BlueprintCallable, Category="DTFlux|Split")
void UpdateOrCreateSplitRanking(const FDTFluxSplitRankings& InSplitRankings);
UFUNCTION(BlueprintCallable, Category="DTFlux|Split")
void AddSplitRanking(const FDTFluxSplitRankings& InSplitRanking);
UFUNCTION()
void AddContestRanking(const FDTFluxContestRankings& NewContestRankings);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Participant")
void UpdateParticipant(const FDTFluxParticipant& Participant);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Participant")
void UpdateParticipantStatus(const FDTFluxTeamStatusUpdate& NewParticipantStatus);
UFUNCTION(BlueprintCallable, CallInEditor, Category="DTFlux|Participant")
bool GetParticipantByBib(int Bib, FDTFluxParticipant& OutParticipant);
UFUNCTION()
bool IsStageFinished(FDTFluxStageKey StageKey);
private:
UPROPERTY()
TMap<FDTFluxStageKey, bool /*bIsFinished*/> FinishedStagesCache;
UFUNCTION()
bool CheckStageIsFinished(FDTFluxStageKey StageKey);
};