2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2018-09-25 10:11:35 -04:00
# pragma once
# include "PreLoadScreen.h"
// Base implementation of the IPreLoadScreen that handles all the logic for controlling / updating the UI for PreLoadScreens.
// Designed to be overriden by a game specific Plugin that calls FPreloadScreenManager::RegisterPreLoadScreen so that functions are called by the PreLoadScreenManager correctly.
2021-04-08 14:32:07 -04:00
class PRELOADSCREEN_API FPreLoadScreenBase : public IPreLoadScreen
2018-09-25 10:11:35 -04:00
{
/**** IPreLoadScreen implementation ****/
public :
//We don't use these in the FPreLoadScreenBase, but they are useful for game-specific implementations
2019-07-22 11:49:15 -04:00
virtual void Tick ( float DeltaTime ) override { }
virtual bool ShouldRender ( ) const override { return true ; }
virtual void RenderTick ( float DeltaTime ) override { } ;
virtual void OnStop ( ) override { }
2018-09-25 10:11:35 -04:00
//Store off TargetWindow
2019-07-22 11:49:15 -04:00
virtual void OnPlay ( TWeakPtr < SWindow > TargetWindow ) override { OwningWindow = TargetWindow ; }
2018-09-25 10:11:35 -04:00
//By default have a small added tick delay so we don't super spin out while waiting on other threads to load data / etc.
2021-01-21 16:22:06 -04:00
virtual float GetAddedTickDelay ( ) override { return 0.00f ; }
2018-09-25 10:11:35 -04:00
2019-10-09 13:46:27 -04:00
virtual void Init ( ) override { }
2018-09-25 10:11:35 -04:00
virtual TSharedPtr < SWidget > GetWidget ( ) override { return nullptr ; }
virtual const TSharedPtr < const SWidget > GetWidget ( ) const override { return nullptr ; }
//IMPORTANT: This changes a LOT of functionality and implementation details. EarlyStartupScreens happen before the engine is fully initialized and block engine initialization before they finish.
// this means they have to forgo even the most basic of engine features like UObject support, as they are displayed before those systems are initialized.
2019-07-22 11:49:15 -04:00
virtual EPreLoadScreenTypes GetPreLoadScreenType ( ) const override { return EPreLoadScreenTypes : : EngineLoadingScreen ; }
2018-09-25 10:11:35 -04:00
virtual void SetEngineLoadingFinished ( bool IsEngineLoadingFinished ) override { bIsEngineLoadingFinished = IsEngineLoadingFinished ; }
// PreLoadScreens not using this functionality should return NAME_None
virtual FName GetPreLoadScreenTag ( ) const override { return NAME_None ; }
2019-07-22 11:49:15 -04:00
virtual void CleanUp ( ) override ;
2018-09-25 10:11:35 -04:00
//Default behavior is just to see if we have an active widget. Should really overload with our own behavior to see if we are done displaying
2019-07-22 11:49:15 -04:00
virtual bool IsDone ( ) const override ;
2018-09-25 10:11:35 -04:00
public :
FPreLoadScreenBase ( )
: bIsEngineLoadingFinished ( false )
{ }
2019-07-22 11:49:15 -04:00
virtual ~ FPreLoadScreenBase ( ) override { } ;
2018-09-25 10:11:35 -04:00
//Handles constructing a FPreLoadSettingsContainerBase with the
virtual void InitSettingsFromConfig ( const FString & ConfigFileName ) ;
//Set what plugin is creating this PreLoadScreenBase. Used to make file paths relative to that plugin as well as
//determining . Used for converting locations for content to be relative to the plugin calling us
virtual void SetPluginName ( const FString & PluginNameIn ) { PluginName = PluginNameIn ; }
protected :
TWeakPtr < SWindow > OwningWindow ;
2020-06-23 18:40:00 -04:00
TAtomic < bool > bIsEngineLoadingFinished ;
2018-09-25 10:11:35 -04:00
private :
//The name of the Plugin creating this FPreLoadScreenBase.
//Important: Should be set before Initting settings from Config!
FString PluginName ;
} ;