Apparently this code just never got pushed to the repository whenever I wrote it, and I don't really remember what it's supposed to do differently from before.

This commit is contained in:
Jamie Greunbaum 2023-04-21 00:55:28 -04:00
parent f63f25c51c
commit 75ae7a10d6
2 changed files with 23 additions and 1 deletions

View File

@ -146,7 +146,7 @@ bool ULoadingScreenManager::ShouldCreateSubsystem(UObject *Outer) const
return !bIsServerWorld; return !bIsServerWorld;
} }
class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen() ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
{ {
if (this->bCurrentlyShowingLoadingScreen) if (this->bCurrentlyShowingLoadingScreen)
{ {
@ -202,6 +202,22 @@ class ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
} }
void ULoadingScreenManager::HideLoadingScreen() void ULoadingScreenManager::HideLoadingScreen()
{
const float HoldTime = GetDefault<UCommonLoadingScreenSettings>()->HoldLoadingScreenAdditionalSecs;
if (FMath::IsNearlyZero(HoldTime))
{
this->HideLoadingScreen_Private();
}
else
{
this->GetWorld()->GetTimerManager().SetTimer(
this->HideLoadingScreenTimerHandle,
this, &ULoadingScreenManager::HideLoadingScreen_Private,
HoldTime
);
}
}
void ULoadingScreenManager::HideLoadingScreen_Private()
{ {
if (this->bCurrentlyShowingLoadingScreen) if (this->bCurrentlyShowingLoadingScreen)
{ {

View File

@ -46,6 +46,9 @@ public:
FORCEINLINE FOnLoadingScreenVisibilityChangedDelegate &OnLoadingScreenVisibilityChangedDelegate() { return LoadingScreenVisibilityChanged; } FORCEINLINE FOnLoadingScreenVisibilityChangedDelegate &OnLoadingScreenVisibilityChangedDelegate() { return LoadingScreenVisibilityChanged; }
private: private:
/** Actually hides the loading screen, either immediately or after a delay if necessary. */
void HideLoadingScreen_Private();
/** Removes the loading screen. The loading screen widget will be destroyed. */ /** Removes the loading screen. The loading screen widget will be destroyed. */
void RemoveLoadingScreen(); void RemoveLoadingScreen();
@ -90,4 +93,7 @@ private:
/** True when the loading screen is currently being shown */ /** True when the loading screen is currently being shown */
bool bCurrentlyShowingLoadingScreen = false; bool bCurrentlyShowingLoadingScreen = false;
/** Handle for the timer that controls how much extra time to wait before fading the loading screen away */
FTimerHandle HideLoadingScreenTimerHandle;
}; };