2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# pragma once
2014-11-12 04:58:53 -05:00
# include "Curves/CurveFloat.h"
2014-03-14 14:13:41 -04:00
2014-08-05 09:04:35 -04:00
/** Query delegate to see if we are in picking mode */
DECLARE_DELEGATE_RetVal_OneParam ( bool , FOnIsPicking , FName & /* OutWidgetNameToHighlight */ ) ;
2014-10-20 08:15:36 -04:00
/** Query delegate for name of any picked widget and check if it matches the 'pickable' name of the given widget */
DECLARE_DELEGATE_RetVal_ThreeParams ( bool , FOnValidatePickingCandidate , TSharedRef < SWidget > /*InWidget*/ , FName & /* OutWidgetNameToHighlight */ , bool & /*bOutShouldHighlight*/ ) ;
2014-08-05 09:04:35 -04:00
class UEditorTutorial ;
struct FTutorialContent ;
class STutorialRoot ;
2015-01-26 20:22:38 -05:00
class IClassTypeActions ;
2014-08-05 09:04:35 -04:00
2014-03-14 14:13:41 -04:00
class FIntroTutorials : public IIntroTutorials
{
public :
// ctor
FIntroTutorials ( ) ;
2014-08-05 09:04:35 -04:00
/** Get the delegate used to check for whether we are picking widgets */
FOnIsPicking & OnIsPicking ( ) ;
2014-10-20 08:15:36 -04:00
/** Get the delegate used to validate the given widget for pickings */
FOnValidatePickingCandidate & OnValidatePickingCandidate ( ) ;
2014-08-05 09:04:35 -04:00
2014-08-20 10:27:41 -04:00
void GoToPreviousStage ( ) ;
void GoToNextStage ( TWeakPtr < SWindow > InNavigationWindow ) ;
2014-09-09 12:19:28 -04:00
float GetIntroCurveValue ( float InTime ) ;
2014-10-13 06:46:06 -04:00
void SummonTutorialBrowser ( ) ;
2014-09-10 08:09:10 -04:00
2015-01-28 10:52:33 -05:00
void DismissTutorialBrowser ( ) ;
2015-01-27 14:54:15 -05:00
void AttachWidget ( TSharedPtr < SWidget > Widget ) ;
void DetachWidget ( ) ;
2014-12-05 05:33:09 -05:00
static FString AnalyticsEventNameFromTutorial ( UEditorTutorial * Tutorial ) ;
2014-09-18 08:10:29 -04:00
2014-03-14 14:13:41 -04:00
private :
2014-08-05 09:04:35 -04:00
2014-03-14 14:13:41 -04:00
/** IModuleInterface implementation */
2014-06-13 06:14:46 -04:00
virtual void StartupModule ( ) override ;
virtual void ShutdownModule ( ) override ;
2014-03-14 14:13:41 -04:00
/** Add the menu extension for summoning the tutorial */
void AddSummonTutorialsMenuExtension ( FMenuBuilder & MenuBuilder ) ;
/** Add a menu extender to summon context-sensitive Blueprints page */
TSharedRef < FExtender > AddSummonBlueprintTutorialsMenuExtender ( const TSharedRef < FUICommandList > CommandList , const TArray < UObject * > EditingObjects ) const ;
/** Add a menu entry to summon context-sensitive Blueprints page */
void AddSummonBlueprintTutorialsMenuExtension ( FMenuBuilder & MenuBuilder , UObject * PrimaryObject ) ;
/** Event to be called when the main frame is loaded */
void MainFrameLoad ( TSharedPtr < SWindow > InRootWindow , bool bIsNewProjectWindow ) ;
/** Summon tutorial home page to front */
void SummonTutorialHome ( ) ;
/** Summon blueprint tutorial home page to front */
void SummonBlueprintTutorialHome ( UObject * Asset , bool bForceWelcome ) ;
/** Event to be called when Tutorial window is closed. */
void OnTutorialWindowClosed ( const TSharedRef < SWindow > & Window ) ;
/** Called when tutorial is dismissed, either when finished or aborted. */
void OnTutorialDismissed ( ) const ;
/** Event to be called when any asset editor is opened */
void OnAssetEditorOpened ( UObject * Asset ) ;
/** Events to call when editor changes state in various ways */
void OnAddCodeToProjectDialogOpened ( ) ;
2014-07-24 03:53:33 -04:00
void OnNewProjectDialogOpened ( ) ;
2014-03-14 14:13:41 -04:00
/** Events to call when opening the compiler fails */
void HandleCompilerNotFound ( ) ;
/** Events to call when SDK isn't installed */
2014-09-18 08:10:29 -04:00
void HandleSDKNotInstalled ( const FString & PlatformName , const FString & InTutorialAsset ) ;
2014-03-14 14:13:41 -04:00
2014-09-18 08:10:29 -04:00
bool MaybeOpenWelcomeTutorial ( ) ;
2014-03-14 14:13:41 -04:00
void ResetWelcomeTutorials ( ) const ;
/** Delegate for home button visibility */
EVisibility GetHomeButtonVisibility ( ) const ;
2014-09-18 08:10:29 -04:00
/** Internal helper to launch a tutorial from a path */
2014-09-18 18:59:55 -04:00
void LaunchTutorialByName ( const FString & InAssetPath , bool bRestart = true , TWeakPtr < SWindow > InNavigationWindow = nullptr , FSimpleDelegate OnTutorialClosed = FSimpleDelegate ( ) , FSimpleDelegate OnTutorialExited = FSimpleDelegate ( ) ) ;
2014-03-14 14:13:41 -04:00
2014-10-13 06:46:06 -04:00
/** Spawn a tab for browsing tutorials */
TSharedRef < SDockTab > SpawnTutorialsBrowserTab ( const FSpawnTabArgs & SpawnTabArgs ) ;
2015-01-28 10:52:33 -05:00
/** When we create a tutorial browser tab, we only keep a weak pointer to it. This way, it can be closed/destroyed without our involvement, but we can also close/destroy it ourselves. */
TWeakPtr < SDockTab > TutorialBrowserDockTab ;
2014-06-24 21:29:38 -04:00
public :
// IIntroTutorials interface
2014-09-18 18:59:55 -04:00
virtual void LaunchTutorial ( const FString & TutorialAssetName ) override ;
2015-04-02 16:56:18 -04:00
virtual void LaunchTutorial ( UEditorTutorial * Tutorial , IIntroTutorials : : ETutorialStartType InStartType = IIntroTutorials : : ETutorialStartType : : TST_RESTART , TWeakPtr < SWindow > InNavigationWindow = nullptr , FSimpleDelegate OnTutorialClosed = FSimpleDelegate ( ) , FSimpleDelegate OnTutorialExited = FSimpleDelegate ( ) ) override ;
2014-08-28 06:22:40 -04:00
virtual void CloseAllTutorialContent ( ) override ;
2014-09-18 16:42:40 -04:00
virtual TSharedRef < SWidget > CreateTutorialsWidget ( FName InContext , TWeakPtr < SWindow > InContextWindow = nullptr ) const override ;
2015-01-27 14:54:15 -05:00
virtual TSharedPtr < SWidget > CreateTutorialsLoadingWidget ( TWeakPtr < SWindow > InContextWindow = nullptr ) const override ;
2014-06-24 21:29:38 -04:00
// End of IIntroTutorials interface
2014-03-14 14:13:41 -04:00
private :
/** The tab id of the tutorial tab */
static const FName IntroTutorialTabName ;
/** The extender to pass to the level editor to extend it's window menu */
TSharedPtr < FExtender > MainMenuExtender ;
/** The extender to pass to the blueprint editor to extend it's window menu */
TSharedPtr < FExtender > BlueprintEditorExtender ;
2014-08-22 01:17:00 -04:00
/** Whether tutorials are disabled altogether */
bool bDisableTutorials ;
2014-03-14 14:13:41 -04:00
/** The current object we are using as a basis for displaying a tutorial */
UClass * CurrentObjectClass ;
2014-06-24 21:29:38 -04:00
/** should we be clearing the 'have seen this tutorial' flag? (controlled by -tutorials on the command line) */
bool bDesireResettingTutorialSeenFlagOnLoad ;
2014-08-05 09:04:35 -04:00
/** Delegate used to determine whether we are in picking mode */
FOnIsPicking OnIsPickingDelegate ;
2014-10-20 08:15:36 -04:00
/** Delegate used to determine if we are in picking mode, get the name of any picked widget and check if it matches the 'pickable' name of the given widget */
FOnValidatePickingCandidate OnValidatePickingCandidateDelegate ;
2014-08-05 09:04:35 -04:00
/** Root widget for tutorial overlay system */
TSharedPtr < STutorialRoot > TutorialRoot ;
2014-09-09 12:19:28 -04:00
/** Curve asset for intros */
2014-09-18 13:31:03 -04:00
TWeakObjectPtr < UCurveFloat > ContentIntroCurve ;
2015-01-26 20:22:38 -05:00
/** The collection of registered class type actions. */
TArray < TSharedRef < IClassTypeActions > > RegisteredClassTypeActions ;
2014-03-14 14:13:41 -04:00
} ;