Adding Subsystem Timer TRigerring Functions to trigger Delegates When needed
This commit is contained in:
@ -9,9 +9,9 @@
|
|||||||
void UDTFluxSubsystemTimer::Initialize(FSubsystemCollectionBase& Collection)
|
void UDTFluxSubsystemTimer::Initialize(FSubsystemCollectionBase& Collection)
|
||||||
{
|
{
|
||||||
Super::Initialize(Collection);
|
Super::Initialize(Collection);
|
||||||
|
// Not Necessary Anymore
|
||||||
UDTFluxSubsystem* Subsystem = GetDTFluxSubSystem();
|
// UDTFluxSubsystem* Subsystem = GetDTFluxSubSystem();
|
||||||
Subsystem->OnRaceDataReceived.AddDynamic(this, &UDTFluxSubsystemTimer::OnDataStorageInit);
|
// Subsystem->OnRaceDataReceived.AddDynamic(this, &UDTFluxSubsystemTimer::OnDataStorageInit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,6 @@ void UDTFluxSubsystemTimer::OnDataStorageInit()
|
|||||||
{
|
{
|
||||||
UE_LOG(LogDTFluxAPI, Log, TEXT("DataStorage Has been Set Or Updated"));
|
UE_LOG(LogDTFluxAPI, Log, TEXT("DataStorage Has been Set Or Updated"));
|
||||||
UDTFluxDataStorage* DataStorage = GetDTFluxDataStorage();
|
UDTFluxDataStorage* DataStorage = GetDTFluxDataStorage();
|
||||||
|
|
||||||
for(const auto&Contest : DataStorage->Contests)
|
for(const auto&Contest : DataStorage->Contests)
|
||||||
{
|
{
|
||||||
for (const auto& Stage: Contest.Stages)
|
for (const auto& Stage: Contest.Stages)
|
||||||
@ -40,7 +39,6 @@ void UDTFluxSubsystemTimer::OnDataStorageInit()
|
|||||||
UWorld* World = GetWorld();
|
UWorld* World = GetWorld();
|
||||||
if(World)
|
if(World)
|
||||||
{
|
{
|
||||||
|
|
||||||
FDTFluxContestTimerHandle StartContestTimerHandle;
|
FDTFluxContestTimerHandle StartContestTimerHandle;
|
||||||
StartContestTimerHandle.Type = EDTFluxTimerEventType::StageStart;
|
StartContestTimerHandle.Type = EDTFluxTimerEventType::StageStart;
|
||||||
StartContestTimerHandle.ContestId = Contest.Id;
|
StartContestTimerHandle.ContestId = Contest.Id;
|
||||||
@ -69,10 +67,7 @@ void UDTFluxSubsystemTimer::OnDataStorageInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDTFluxSubsystemTimer::AddCutoffTimer(const int ContestID, const int StageID)
|
void UDTFluxSubsystemTimer::AddCutoffTimer(const int ContestID, const int StageID)
|
||||||
@ -105,7 +100,6 @@ void UDTFluxSubsystemTimer::AddStageStartedTimer(const int ContestID, const int
|
|||||||
|
|
||||||
void UDTFluxSubsystemTimer::OnStartTimer()
|
void UDTFluxSubsystemTimer::OnStartTimer()
|
||||||
{
|
{
|
||||||
|
|
||||||
UWorld* World = GetWorld();
|
UWorld* World = GetWorld();
|
||||||
if(World)
|
if(World)
|
||||||
{
|
{
|
||||||
@ -127,7 +121,6 @@ void UDTFluxSubsystemTimer::OnStartTimer()
|
|||||||
Timers.RemoveAt(Idx);
|
Timers.RemoveAt(Idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void UDTFluxSubsystemTimer::OnCutOffTimer()
|
void UDTFluxSubsystemTimer::OnCutOffTimer()
|
||||||
{
|
{
|
||||||
@ -171,6 +164,21 @@ void UDTFluxSubsystemTimer::ClearTimer(const int HandleIndex)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDTFluxSubsystemTimer::TriggerOnCutOff(const int ContestId, const int StageId)
|
||||||
|
{
|
||||||
|
OnCutoff.Broadcast(ContestId, StageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDTFluxSubsystemTimer::TriggerStartTime(const int ContestId, const int StageId)
|
||||||
|
{
|
||||||
|
OnStageStarted.Broadcast(ContestId, StageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDTFluxSubsystemTimer::TriggerStageLoading(const int ContestId, const int StageId, int DelayBeforeStageStart)
|
||||||
|
{
|
||||||
|
OnStageLoading.Broadcast(ContestId, StageId, DelayBeforeStageStart);
|
||||||
|
}
|
||||||
|
|
||||||
UDTFluxSubsystem* UDTFluxSubsystemTimer::GetDTFluxSubSystem()
|
UDTFluxSubsystem* UDTFluxSubsystemTimer::GetDTFluxSubSystem()
|
||||||
{
|
{
|
||||||
return GEngine->GetEngineSubsystem<UDTFluxSubsystem>();
|
return GEngine->GetEngineSubsystem<UDTFluxSubsystem>();
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public:
|
|||||||
|
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnCutoff, int, ContestId, int, StageId);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnCutoff, int, ContestId, int, StageId);
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnStageStarted, int, ContestId, int, StageId);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnStageStarted, int, ContestId, int, StageId);
|
||||||
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnStageLoading, int, ContestId, int, StageId, int, DelayBeforeStageStart);
|
||||||
|
|
||||||
|
|
||||||
UCLASS(BlueprintType, Category="DTFlux|Timer")
|
UCLASS(BlueprintType, Category="DTFlux|Timer")
|
||||||
@ -63,18 +64,28 @@ public:
|
|||||||
UPROPERTY(BlueprintAssignable, Category="DTFlux|Timer")
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Timer")
|
||||||
FOnStageStarted OnStageStarted;
|
FOnStageStarted OnStageStarted;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintAssignable, Category="DTFlux|Timer")
|
||||||
|
FOnStageLoading OnStageLoading;
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void OnDataStorageInit();
|
void OnDataStorageInit();
|
||||||
|
|
||||||
void AddCutoffTimer(const int ContestID, const int StageID);
|
void AddCutoffTimer(const int ContestID, const int StageID);
|
||||||
void AddStageStartedTimer(const int ContestID, const int StageID);
|
void AddStageStartedTimer(const int ContestID, const int StageID);
|
||||||
|
|
||||||
void OnStartTimer();
|
void OnStartTimer();
|
||||||
void OnCutOffTimer();
|
void OnCutOffTimer();
|
||||||
|
|
||||||
void ClearTimer(FDTFluxContestTimerHandle TimerHandle);
|
void ClearTimer(FDTFluxContestTimerHandle TimerHandle);
|
||||||
void ClearTimer(const int HandleIndex);
|
void ClearTimer(const int HandleIndex);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Timer")
|
||||||
|
void TriggerOnCutOff(const int ContestId, const int StageId);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Timer")
|
||||||
|
void TriggerStartTime(const int ContestId, const int StageId);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="DTFlux|Timer")
|
||||||
|
void TriggerStageLoading(const int ContestId, const int StageId, int DelayBeforeStageStart);
|
||||||
static UDTFluxSubsystem* GetDTFluxSubSystem();
|
static UDTFluxSubsystem* GetDTFluxSubSystem();
|
||||||
static UDTFluxDataStorage* GetDTFluxDataStorage();
|
static UDTFluxDataStorage* GetDTFluxDataStorage();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user