|
|
|
|
| #pragma once
|
|
|
| #include "Components/GameStateComponent.h"
|
| #include "LoadingProcessInterface.h"
|
|
|
| #include "LyraExperienceManagerComponent.generated.h"
|
|
|
| #define UE_API LYRAGAME_API
|
|
|
| namespace UE::GameFeatures { struct FResult; }
|
|
|
| class ULyraExperienceDefinition;
|
|
|
| DECLARE_MULTICAST_DELEGATE_OneParam(FOnLyraExperienceLoaded, const ULyraExperienceDefinition* );
|
|
|
| enum class ELyraExperienceLoadState
|
| {
|
| Unloaded,
|
| Loading,
|
| LoadingGameFeatures,
|
| LoadingChaosTestingDelay,
|
| ExecutingActions,
|
| Loaded,
|
| Deactivating
|
| };
|
|
|
| UCLASS(MinimalAPI)
|
| class ULyraExperienceManagerComponent final : public UGameStateComponent, public ILoadingProcessInterface
|
| {
|
| GENERATED_BODY()
|
|
|
| public:
|
|
|
| UE_API ULyraExperienceManagerComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
|
|
|
|
| UE_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
|
|
|
|
|
|
| UE_API virtual bool ShouldShowLoadingScreen(FString& OutReason) const override;
|
|
|
|
|
|
|
| UE_API void SetCurrentExperience(FPrimaryAssetId ExperienceId);
|
|
|
|
|
|
|
|
|
| UE_API void CallOrRegister_OnExperienceLoaded_HighPriority(FOnLyraExperienceLoaded::FDelegate&& Delegate);
|
|
|
|
|
|
|
| UE_API void CallOrRegister_OnExperienceLoaded(FOnLyraExperienceLoaded::FDelegate&& Delegate);
|
|
|
|
|
|
|
| UE_API void CallOrRegister_OnExperienceLoaded_LowPriority(FOnLyraExperienceLoaded::FDelegate&& Delegate);
|
|
|
|
|
|
|
| UE_API const ULyraExperienceDefinition* GetCurrentExperienceChecked() const;
|
|
|
|
|
| UE_API bool IsExperienceLoaded() const;
|
|
|
| private:
|
| UFUNCTION()
|
| void OnRep_CurrentExperience();
|
|
|
| void StartExperienceLoad();
|
| void OnExperienceLoadComplete();
|
| void OnGameFeaturePluginLoadComplete(const UE::GameFeatures::FResult& Result);
|
| void OnExperienceFullLoadCompleted();
|
|
|
| void OnActionDeactivationCompleted();
|
| void OnAllActionsDeactivated();
|
|
|
| private:
|
| UPROPERTY(ReplicatedUsing=OnRep_CurrentExperience)
|
| TObjectPtr<const ULyraExperienceDefinition> CurrentExperience;
|
|
|
| ELyraExperienceLoadState LoadState = ELyraExperienceLoadState::Unloaded;
|
|
|
| int32 NumGameFeaturePluginsLoading = 0;
|
| TArray<FString> GameFeaturePluginURLs;
|
|
|
| int32 NumObservedPausers = 0;
|
| int32 NumExpectedPausers = 0;
|
|
|
| |
| |
| |
|
|
| FOnLyraExperienceLoaded OnExperienceLoaded_HighPriority;
|
|
|
|
|
| FOnLyraExperienceLoaded OnExperienceLoaded;
|
|
|
|
|
| FOnLyraExperienceLoaded OnExperienceLoaded_LowPriority;
|
| };
|
|
|
| #undef UE_API
|
|
|