2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2014-08-05 09:04:35 -04:00
|
|
|
|
|
|
|
|
#include "STutorialContent.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Rendering/DrawElements.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
|
#include "Widgets/SBoxPanel.h"
|
|
|
|
|
#include "Widgets/SOverlay.h"
|
|
|
|
|
#include "Styling/SlateTypes.h"
|
|
|
|
|
#include "Styling/CoreStyle.h"
|
|
|
|
|
#include "Layout/WidgetPath.h"
|
|
|
|
|
#include "Framework/Application/MenuStack.h"
|
|
|
|
|
#include "Framework/Application/SlateApplication.h"
|
|
|
|
|
#include "Textures/SlateIcon.h"
|
|
|
|
|
#include "Framework/Commands/UIAction.h"
|
|
|
|
|
#include "Framework/Commands/UICommandList.h"
|
|
|
|
|
#include "Widgets/Layout/SFxWidget.h"
|
|
|
|
|
#include "Widgets/Layout/SBorder.h"
|
|
|
|
|
#include "Widgets/Images/SImage.h"
|
|
|
|
|
#include "Widgets/Text/STextBlock.h"
|
|
|
|
|
#include "Widgets/Text/SRichTextBlock.h"
|
|
|
|
|
#include "Widgets/Layout/SBox.h"
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
|
|
|
|
#include "Widgets/Input/SButton.h"
|
|
|
|
|
#include "Widgets/Input/SComboButton.h"
|
|
|
|
|
#include "EditorStyleSet.h"
|
|
|
|
|
#include "IIntroTutorials.h"
|
2014-09-09 12:19:28 -04:00
|
|
|
#include "IntroTutorials.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "IDocumentationPage.h"
|
|
|
|
|
#include "IDocumentation.h"
|
2014-09-12 05:28:34 -04:00
|
|
|
#include "TutorialText.h"
|
2014-09-18 08:10:29 -04:00
|
|
|
#include "EngineAnalytics.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "AnalyticsEventAttribute.h"
|
|
|
|
|
#include "Interfaces/IAnalyticsProvider.h"
|
2014-08-14 07:02:50 -04:00
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "STutorialContent"
|
2014-08-05 09:04:35 -04:00
|
|
|
|
|
|
|
|
namespace TutorialConstants
|
|
|
|
|
{
|
2015-01-26 17:51:59 -05:00
|
|
|
const float BorderPulseAnimationLength = 0.75f;
|
|
|
|
|
const float BorderIntroAnimationLength = 0.4f;
|
|
|
|
|
const float ContentIntroAnimationLength = 0.25f;
|
2014-08-05 09:04:35 -04:00
|
|
|
const float MinBorderOpacity = 0.1f;
|
|
|
|
|
const float ShadowScale = 8.0f;
|
|
|
|
|
const float MaxBorderOffset = 8.0f;
|
2014-09-16 10:26:36 -04:00
|
|
|
const FMargin BorderSizeStandalone(24.0f, 24.0f);
|
2015-01-26 17:51:59 -05:00
|
|
|
const FMargin BorderSize(24.0f, 24.0f, 24.0f, 62.0f);
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const float ContentOffset = 10.0f;
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
void STutorialContent::Construct(const FArguments& InArgs, UEditorTutorial* InTutorial, const FTutorialContent& InContent)
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
|
|
|
|
bIsVisible = Anchor.Type == ETutorialAnchorIdentifier::None;
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
Tutorial = InTutorial;
|
2014-09-30 11:37:26 -04:00
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
VerticalAlignment = InArgs._VAlign;
|
|
|
|
|
HorizontalAlignment = InArgs._HAlign;
|
|
|
|
|
WidgetOffset = InArgs._Offset;
|
|
|
|
|
bIsStandalone = InArgs._IsStandalone;
|
|
|
|
|
OnClosed = InArgs._OnClosed;
|
2014-09-16 10:26:36 -04:00
|
|
|
OnNextClicked = InArgs._OnNextClicked;
|
|
|
|
|
OnHomeClicked = InArgs._OnHomeClicked;
|
|
|
|
|
OnBackClicked = InArgs._OnBackClicked;
|
|
|
|
|
IsBackEnabled = InArgs._IsBackEnabled;
|
|
|
|
|
IsHomeEnabled = InArgs._IsHomeEnabled;
|
|
|
|
|
IsNextEnabled = InArgs._IsNextEnabled;
|
2014-08-05 09:04:35 -04:00
|
|
|
Anchor = InArgs._Anchor;
|
2014-09-18 13:30:40 -04:00
|
|
|
bAllowNonWidgetContent = InArgs._AllowNonWidgetContent;
|
2014-09-22 09:42:52 -04:00
|
|
|
OnWasWidgetDrawn = InArgs._OnWasWidgetDrawn;
|
2014-09-30 11:37:26 -04:00
|
|
|
NextButtonText = InArgs._NextButtonText;
|
2015-02-17 09:56:06 -05:00
|
|
|
BackButtonText = InArgs._BackButtonText;
|
2014-08-05 09:04:35 -04:00
|
|
|
|
|
|
|
|
BorderIntroAnimation.AddCurve(0.0f, TutorialConstants::BorderIntroAnimationLength, ECurveEaseFunction::CubicOut);
|
|
|
|
|
BorderPulseAnimation.AddCurve(0.0f, TutorialConstants::BorderPulseAnimationLength, ECurveEaseFunction::Linear);
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
BorderIntroAnimation.Play(this->AsShared());
|
|
|
|
|
|
|
|
|
|
// Set the border pulse to play on a loop and immediately pause it - will be resumed when needed
|
|
|
|
|
BorderPulseAnimation.Play(this->AsShared(), true);
|
|
|
|
|
BorderPulseAnimation.Pause();
|
2014-08-05 09:04:35 -04:00
|
|
|
|
2014-09-09 12:19:28 -04:00
|
|
|
ContentIntroAnimation.AddCurve(0.0f, TutorialConstants::ContentIntroAnimationLength, ECurveEaseFunction::Linear);
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
ContentIntroAnimation.Play(this->AsShared());
|
2014-09-09 12:19:28 -04:00
|
|
|
|
2014-08-14 06:02:24 -04:00
|
|
|
if (InContent.Text.IsEmpty() == true)
|
|
|
|
|
{
|
|
|
|
|
ChildSlot
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(ContentWidget, SBorder)
|
|
|
|
|
.Visibility(EVisibility::SelfHitTestInvisible)
|
|
|
|
|
];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
ChildSlot
|
|
|
|
|
[
|
2014-09-09 12:19:28 -04:00
|
|
|
SNew(SFxWidget)
|
2014-09-12 06:18:47 -04:00
|
|
|
.Visibility(EVisibility::SelfHitTestInvisible)
|
2014-09-09 12:19:28 -04:00
|
|
|
.RenderScale(this, &STutorialContent::GetAnimatedZoom)
|
|
|
|
|
.RenderScaleOrigin(FVector2D(0.5f, 0.5f))
|
2014-08-05 09:04:35 -04:00
|
|
|
[
|
2014-09-16 10:26:36 -04:00
|
|
|
SNew(SOverlay)
|
2014-09-17 04:54:45 -04:00
|
|
|
.Visibility(this, &STutorialContent::GetVisibility)
|
2014-09-16 10:26:36 -04:00
|
|
|
+SOverlay::Slot()
|
2014-08-05 09:04:35 -04:00
|
|
|
[
|
2014-09-16 10:26:36 -04:00
|
|
|
SAssignNew(ContentWidget, SBorder)
|
|
|
|
|
|
|
|
|
|
// Add more padding if the content is to be displayed centrally (i.e. not on a widget)
|
|
|
|
|
.Padding(bIsStandalone ? TutorialConstants::BorderSizeStandalone : TutorialConstants::BorderSize)
|
2014-09-18 10:43:35 -04:00
|
|
|
.Visibility(EVisibility::SelfHitTestInvisible)
|
2014-09-16 10:26:36 -04:00
|
|
|
.BorderImage(FEditorStyle::GetBrush("Tutorials.Border"))
|
|
|
|
|
.BorderBackgroundColor(this, &STutorialContent::GetBackgroundColor)
|
|
|
|
|
.ForegroundColor(FCoreStyle::Get().GetSlateColor("InvertedForeground"))
|
2014-08-05 09:04:35 -04:00
|
|
|
[
|
2014-09-16 10:26:36 -04:00
|
|
|
SNew(SFxWidget)
|
|
|
|
|
.RenderScale(this, &STutorialContent::GetInverseAnimatedZoom)
|
|
|
|
|
.RenderScaleOrigin(FVector2D(0.5f, 0.5f))
|
2014-09-09 12:19:28 -04:00
|
|
|
[
|
2014-09-16 10:26:36 -04:00
|
|
|
SNew(SVerticalBox)
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.AutoHeight()
|
2014-09-09 12:19:28 -04:00
|
|
|
[
|
2014-09-16 10:26:36 -04:00
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.MaxWidth(600.0f)
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
[
|
2014-10-13 06:46:06 -04:00
|
|
|
GenerateContentWidget(InContent, DocumentationPage, TAttribute<FText>(), false, InArgs._WrapTextAt)
|
2014-09-16 10:26:36 -04:00
|
|
|
]
|
2014-09-09 12:19:28 -04:00
|
|
|
]
|
|
|
|
|
]
|
2014-08-05 09:04:35 -04:00
|
|
|
]
|
|
|
|
|
]
|
2014-09-16 10:26:36 -04:00
|
|
|
+SOverlay::Slot()
|
|
|
|
|
.VAlign(VAlign_Top)
|
|
|
|
|
.HAlign(HAlign_Right)
|
|
|
|
|
.Padding(16.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.VAlign(VAlign_Top)
|
|
|
|
|
.Padding(2.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SComboButton)
|
|
|
|
|
.ToolTipText(LOCTEXT("MoreOptionsTooltip", "More Options"))
|
|
|
|
|
.Visibility(this, &STutorialContent::GetMenuButtonVisibility)
|
|
|
|
|
.ButtonStyle(&FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.Button"))
|
|
|
|
|
.ContentPadding(0.0f)
|
|
|
|
|
.OnGetMenuContent(FOnGetContent::CreateSP(this, &STutorialContent::HandleGetMenuContent))
|
|
|
|
|
]
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.VAlign(VAlign_Top)
|
|
|
|
|
.Padding(0.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SButton)
|
|
|
|
|
.ToolTipText(LOCTEXT("QuitStandaloneTooltip", "Close this Message"))
|
|
|
|
|
.OnClicked(this, &STutorialContent::OnCloseButtonClicked)
|
|
|
|
|
.Visibility(this, &STutorialContent::GetCloseButtonVisibility)
|
|
|
|
|
.ButtonStyle(&FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.Button"))
|
|
|
|
|
.ContentPadding(0.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SImage)
|
|
|
|
|
.Image(FEditorStyle::GetBrush("Symbols.X"))
|
|
|
|
|
.ColorAndOpacity(FLinearColor(0.0f, 0.0f, 0.0f, 1.0f))
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
2015-02-17 09:56:06 -05:00
|
|
|
+ SOverlay::Slot()
|
|
|
|
|
.VAlign(VAlign_Bottom)
|
|
|
|
|
.HAlign(HAlign_Left)
|
|
|
|
|
.Padding(12.0f)
|
|
|
|
|
[
|
|
|
|
|
SAssignNew(BackButton, SButton)
|
|
|
|
|
.ToolTipText(this, &STutorialContent::GetBackButtonTooltip)
|
|
|
|
|
.OnClicked(this, &STutorialContent::HandleBackButtonClicked)
|
|
|
|
|
.Visibility(this, &STutorialContent::GetBackButtonVisibility)
|
|
|
|
|
.ButtonStyle(&FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.NavigationButtonWrapper"))
|
|
|
|
|
.ContentPadding(0.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SBox)
|
|
|
|
|
.Padding(8.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
.BorderImage(this, &STutorialContent::GetBackButtonBorder)
|
|
|
|
|
[
|
2015-02-17 10:17:20 -05:00
|
|
|
SNew(SHorizontalBox)
|
2015-02-17 09:56:06 -05:00
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SNew(SImage)
|
|
|
|
|
.Image(this, &STutorialContent::GetBackButtonBrush)
|
|
|
|
|
.ColorAndOpacity(FLinearColor::White)
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
+ SOverlay::Slot()
|
2014-09-16 10:26:36 -04:00
|
|
|
.VAlign(VAlign_Bottom)
|
|
|
|
|
.HAlign(HAlign_Right)
|
2014-09-30 11:37:26 -04:00
|
|
|
.Padding(12.0f)
|
2014-09-16 10:26:36 -04:00
|
|
|
[
|
|
|
|
|
SAssignNew(NextButton, SButton)
|
|
|
|
|
.ToolTipText(this, &STutorialContent::GetNextButtonTooltip)
|
|
|
|
|
.OnClicked(this, &STutorialContent::HandleNextClicked)
|
|
|
|
|
.Visibility(this, &STutorialContent::GetMenuButtonVisibility)
|
2014-09-30 11:37:26 -04:00
|
|
|
.ButtonStyle(&FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.NavigationButtonWrapper"))
|
2014-09-16 10:26:36 -04:00
|
|
|
.ContentPadding(0.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(SBox)
|
|
|
|
|
.Padding(8.0f)
|
|
|
|
|
[
|
2014-09-30 11:37:26 -04:00
|
|
|
SNew(SBorder)
|
|
|
|
|
.BorderImage(this, &STutorialContent::GetNextButtonBorder)
|
|
|
|
|
[
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
.Padding(4.0f, 0.0f, 0.0f, 0.0f)
|
|
|
|
|
[
|
|
|
|
|
SNew(STextBlock)
|
|
|
|
|
.Text(this, &STutorialContent::GetNextButtonLabel)
|
|
|
|
|
.TextStyle(FEditorStyle::Get(), "Tutorials.Content.NavigationText")
|
|
|
|
|
.ColorAndOpacity(FLinearColor::White)
|
|
|
|
|
]
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SNew(SImage)
|
|
|
|
|
.Image(this, &STutorialContent::GetNextButtonBrush)
|
|
|
|
|
.ColorAndOpacity(FLinearColor::White)
|
|
|
|
|
]
|
|
|
|
|
]
|
2014-09-16 10:26:36 -04:00
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
]
|
2014-08-05 09:04:35 -04:00
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
//static void GetAnimationValues(bool bIsIntro, float InAnimationProgress, float& OutAlphaFactor, float& OutPulseFactor, FLinearColor& OutShadowTint, FLinearColor& OutBorderTint)
|
|
|
|
|
//{
|
|
|
|
|
// if ( bIsIntro )
|
|
|
|
|
// {
|
|
|
|
|
// OutAlphaFactor = InAnimationProgress;
|
|
|
|
|
// OutPulseFactor = ( 1.0f - OutAlphaFactor ) * 50.0f;
|
|
|
|
|
// OutShadowTint = FLinearColor(1.0f, 1.0f, 0.0f, OutAlphaFactor);
|
|
|
|
|
// OutBorderTint = FLinearColor(1.0f, 1.0f, 0.0f, OutAlphaFactor * OutAlphaFactor);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// OutAlphaFactor = 1.0f - ( 0.5f + ( FMath::Cos(2.0f * PI * InAnimationProgress) * 0.5f ) );
|
|
|
|
|
// OutPulseFactor = 0.5f + ( FMath::Cos(2.0f * PI * InAnimationProgress) * 0.5f );
|
|
|
|
|
// OutShadowTint = FLinearColor(1.0f, 1.0f, 0.0f, 1.0f);
|
|
|
|
|
// OutBorderTint = FLinearColor(1.0f, 1.0f, 0.0f, TutorialConstants::MinBorderOpacity + ( ( 1.0f - TutorialConstants::MinBorderOpacity ) * OutAlphaFactor ));
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
void STutorialContent::GetAnimationValues(float& OutAlphaFactor, float& OutPulseFactor, FLinearColor& OutShadowTint, FLinearColor& OutBorderTint) const
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
if (BorderIntroAnimation.IsPlaying())
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
OutAlphaFactor = BorderIntroAnimation.GetLerp();
|
|
|
|
|
OutPulseFactor = ( 1.0f - OutAlphaFactor ) * 50.0f;
|
2014-08-05 09:04:35 -04:00
|
|
|
OutShadowTint = FLinearColor(1.0f, 1.0f, 0.0f, OutAlphaFactor);
|
|
|
|
|
OutBorderTint = FLinearColor(1.0f, 1.0f, 0.0f, OutAlphaFactor * OutAlphaFactor);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
float PulseAnimationProgress = BorderPulseAnimation.GetLerp();
|
|
|
|
|
OutAlphaFactor = 1.0f - ( 0.5f + ( FMath::Cos(2.0f * PI * PulseAnimationProgress) * 0.5f ) );
|
|
|
|
|
OutPulseFactor = 0.5f + ( FMath::Cos(2.0f * PI * PulseAnimationProgress) * 0.5f );
|
2014-08-05 09:04:35 -04:00
|
|
|
OutShadowTint = FLinearColor(1.0f, 1.0f, 0.0f, 1.0f);
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
OutBorderTint = FLinearColor(1.0f, 1.0f, 0.0f, TutorialConstants::MinBorderOpacity + ( ( 1.0f - TutorialConstants::MinBorderOpacity ) * OutAlphaFactor ));
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
int32 STutorialContent::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
2014-08-28 06:22:40 -04:00
|
|
|
CachedContentGeometry = AllottedGeometry;
|
2014-08-29 08:59:41 -04:00
|
|
|
CachedContentGeometry.AppendTransform(FSlateLayoutTransform(OutDrawElements.GetWindow()->GetPositionInScreen()));
|
2014-08-28 06:22:40 -04:00
|
|
|
|
2014-08-14 07:02:50 -04:00
|
|
|
if(bIsVisible && Anchor.Type != ETutorialAnchorIdentifier::None && Anchor.bDrawHighlight)
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
|
|
|
|
float AlphaFactor;
|
|
|
|
|
float PulseFactor;
|
|
|
|
|
FLinearColor ShadowTint;
|
|
|
|
|
FLinearColor BorderTint;
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
GetAnimationValues(AlphaFactor, PulseFactor, ShadowTint, BorderTint);
|
2014-08-05 09:04:35 -04:00
|
|
|
|
|
|
|
|
const FSlateBrush* ShadowBrush = FCoreStyle::Get().GetBrush(TEXT("Tutorials.Shadow"));
|
|
|
|
|
const FSlateBrush* BorderBrush = FCoreStyle::Get().GetBrush(TEXT("Tutorials.Border"));
|
|
|
|
|
|
|
|
|
|
const FGeometry& WidgetGeometry = CachedGeometry;
|
|
|
|
|
const FVector2D WindowSize = OutDrawElements.GetWindow()->GetSizeInScreen();
|
|
|
|
|
|
|
|
|
|
// We should be clipped by the window size, not our containing widget, as we want to draw outside the widget
|
|
|
|
|
FSlateRect WindowClippingRect(0.0f, 0.0f, WindowSize.X, WindowSize.Y);
|
|
|
|
|
|
|
|
|
|
FPaintGeometry ShadowGeometry((WidgetGeometry.AbsolutePosition - FVector2D(ShadowBrush->Margin.Left, ShadowBrush->Margin.Top) * ShadowBrush->ImageSize * WidgetGeometry.Scale * TutorialConstants::ShadowScale),
|
|
|
|
|
((WidgetGeometry.Size * WidgetGeometry.Scale) + (FVector2D(ShadowBrush->Margin.Right * 2.0f, ShadowBrush->Margin.Bottom * 2.0f) * ShadowBrush->ImageSize * WidgetGeometry.Scale * TutorialConstants::ShadowScale)),
|
|
|
|
|
WidgetGeometry.Scale * TutorialConstants::ShadowScale);
|
|
|
|
|
// draw highlight shadow
|
|
|
|
|
FSlateDrawElement::MakeBox(OutDrawElements, LayerId++, ShadowGeometry, ShadowBrush, WindowClippingRect, ESlateDrawEffect::None, ShadowTint);
|
|
|
|
|
|
|
|
|
|
FVector2D PulseOffset = FVector2D(PulseFactor * TutorialConstants::MaxBorderOffset, PulseFactor * TutorialConstants::MaxBorderOffset);
|
|
|
|
|
|
|
|
|
|
FVector2D BorderPosition = (WidgetGeometry.AbsolutePosition - ((FVector2D(BorderBrush->Margin.Left, BorderBrush->Margin.Top) * BorderBrush->ImageSize * WidgetGeometry.Scale) + PulseOffset));
|
|
|
|
|
FVector2D BorderSize = ((WidgetGeometry.Size * WidgetGeometry.Scale) + (PulseOffset * 2.0f) + (FVector2D(BorderBrush->Margin.Right * 2.0f, BorderBrush->Margin.Bottom * 2.0f) * BorderBrush->ImageSize * WidgetGeometry.Scale));
|
|
|
|
|
|
|
|
|
|
FPaintGeometry BorderGeometry(BorderPosition, BorderSize, WidgetGeometry.Scale);
|
|
|
|
|
|
|
|
|
|
// draw highlight border
|
|
|
|
|
FSlateDrawElement::MakeBox(OutDrawElements, LayerId++, BorderGeometry, BorderBrush, WindowClippingRect, ESlateDrawEffect::None, BorderTint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-18 08:10:29 -04:00
|
|
|
FReply STutorialContent::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
|
|
|
{
|
|
|
|
|
if (!bIsStandalone && MouseEvent.GetEffectingButton() == EKeys::RightMouseButton)
|
|
|
|
|
{
|
2015-06-05 20:19:33 -04:00
|
|
|
FWidgetPath WidgetPath = MouseEvent.GetEventPath() != nullptr ? *MouseEvent.GetEventPath() : FWidgetPath();
|
|
|
|
|
|
|
|
|
|
FSlateApplication::Get().PushMenu(AsShared(), WidgetPath, HandleGetMenuContent(), MouseEvent.GetScreenSpacePosition(), FPopupTransitionEffect(FPopupTransitionEffect::ContextMenu));
|
2014-09-18 08:10:29 -04:00
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
/** Helper function to generate title widget, if any */
|
|
|
|
|
static TSharedRef<SWidget> GetStageTitle(const FExcerpt& InExcerpt, int32 InCurrentExcerptIndex)
|
|
|
|
|
{
|
|
|
|
|
// First try for unadorned 'StageTitle'
|
|
|
|
|
FString VariableName(TEXT("StageTitle"));
|
|
|
|
|
const FString* VariableValue = InExcerpt.Variables.Find(VariableName);
|
|
|
|
|
if(VariableValue != NULL)
|
|
|
|
|
{
|
|
|
|
|
return SNew(STextBlock)
|
|
|
|
|
.Text(FText::FromString(*VariableValue))
|
|
|
|
|
.TextStyle(FEditorStyle::Get(), "Tutorials.CurrentExcerpt");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Then try 'StageTitle<StageNum>'
|
|
|
|
|
VariableName = FString::Printf(TEXT("StageTitle%d"), InCurrentExcerptIndex + 1);
|
|
|
|
|
VariableValue = InExcerpt.Variables.Find(VariableName);
|
|
|
|
|
if(VariableValue != NULL)
|
|
|
|
|
{
|
|
|
|
|
return SNew(STextBlock)
|
|
|
|
|
.Text(FText::FromString(*VariableValue))
|
|
|
|
|
.TextStyle(FEditorStyle::Get(), "Tutorials.CurrentExcerpt");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SNullWidget::NullWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-13 06:46:06 -04:00
|
|
|
TSharedRef<SWidget> STutorialContent::GenerateContentWidget(const FTutorialContent& InContent, TSharedPtr<IDocumentationPage>& OutDocumentationPage, const TAttribute<FText>& InHighlightText, bool bAutoWrapText, float WrapTextAt)
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
|
|
|
|
// Style for the documentation
|
|
|
|
|
static FDocumentationStyle DocumentationStyle;
|
|
|
|
|
DocumentationStyle
|
2014-09-03 06:25:58 -04:00
|
|
|
.ContentStyle(TEXT("Tutorials.Content.Text"))
|
|
|
|
|
.BoldContentStyle(TEXT("Tutorials.Content.TextBold"))
|
|
|
|
|
.NumberedContentStyle(TEXT("Tutorials.Content.Text"))
|
2014-09-04 09:59:45 -04:00
|
|
|
.Header1Style(TEXT("Tutorials.Content.HeaderText1"))
|
|
|
|
|
.Header2Style(TEXT("Tutorials.Content.HeaderText2"))
|
|
|
|
|
.HyperlinkStyle(TEXT("Tutorials.Content.Hyperlink"))
|
2014-09-03 06:25:58 -04:00
|
|
|
.HyperlinkTextStyle(TEXT("Tutorials.Content.HyperlinkText"))
|
2014-08-05 09:04:35 -04:00
|
|
|
.SeparatorStyle(TEXT("Tutorials.Separator"));
|
|
|
|
|
|
2014-08-14 07:02:50 -04:00
|
|
|
OutDocumentationPage = nullptr;
|
|
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
switch(InContent.Type)
|
|
|
|
|
{
|
|
|
|
|
case ETutorialContent::Text:
|
|
|
|
|
{
|
2014-10-13 06:46:06 -04:00
|
|
|
TSharedRef<STextBlock> TextBlock = SNew(STextBlock)
|
2014-08-05 09:04:35 -04:00
|
|
|
.Visibility(EVisibility::SelfHitTestInvisible)
|
2014-10-13 06:46:06 -04:00
|
|
|
.AutoWrapText(bAutoWrapText)
|
2014-08-05 09:04:35 -04:00
|
|
|
.Text(InContent.Text)
|
2014-09-29 06:54:17 -04:00
|
|
|
.TextStyle(FEditorStyle::Get(), "Tutorials.Content")
|
|
|
|
|
.HighlightText(InHighlightText)
|
|
|
|
|
.HighlightColor(FEditorStyle::Get().GetColor("Tutorials.Browser.HighlightTextColor"));
|
2014-10-13 06:46:06 -04:00
|
|
|
|
|
|
|
|
if(!bAutoWrapText)
|
|
|
|
|
{
|
|
|
|
|
TextBlock->SetWrapTextAt(WrapTextAt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TextBlock;
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ETutorialContent::UDNExcerpt:
|
|
|
|
|
if (IDocumentation::Get()->PageExists(InContent.Content))
|
|
|
|
|
{
|
|
|
|
|
OutDocumentationPage = IDocumentation::Get()->GetPage(InContent.Content, TSharedPtr<FParserConfiguration>(), DocumentationStyle);
|
|
|
|
|
FExcerpt Excerpt;
|
|
|
|
|
if(OutDocumentationPage->GetExcerpt(InContent.ExcerptName, Excerpt) && OutDocumentationPage->GetExcerptContent(Excerpt))
|
|
|
|
|
{
|
|
|
|
|
return SNew(SVerticalBox)
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.HAlign(HAlign_Left)
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
.Padding(0.0f, 0.0f, 0.0f, 5.0f)
|
|
|
|
|
[
|
|
|
|
|
GetStageTitle(Excerpt, 0)
|
|
|
|
|
]
|
|
|
|
|
+SVerticalBox::Slot()
|
|
|
|
|
.HAlign(HAlign_Fill)
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
[
|
|
|
|
|
Excerpt.Content.ToSharedRef()
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2014-08-14 07:02:50 -04:00
|
|
|
|
|
|
|
|
case ETutorialContent::RichText:
|
|
|
|
|
{
|
|
|
|
|
TArray< TSharedRef< class ITextDecorator > > Decorators;
|
2014-10-08 06:07:52 -04:00
|
|
|
const bool bForEditing = false;
|
|
|
|
|
FTutorialText::GetRichTextDecorators(bForEditing, Decorators);
|
2014-08-14 07:02:50 -04:00
|
|
|
|
2014-10-13 06:46:06 -04:00
|
|
|
TSharedRef<SRichTextBlock> TextBlock = SNew(SRichTextBlock)
|
2014-08-20 10:27:41 -04:00
|
|
|
.Visibility(EVisibility::SelfHitTestInvisible)
|
2014-09-03 06:25:58 -04:00
|
|
|
.TextStyle(FEditorStyle::Get(), "Tutorials.Content.Text")
|
2014-08-14 07:02:50 -04:00
|
|
|
.DecoratorStyleSet(&FEditorStyle::Get())
|
|
|
|
|
.Decorators(Decorators)
|
|
|
|
|
.Text(InContent.Text)
|
2014-10-13 06:46:06 -04:00
|
|
|
.AutoWrapText(bAutoWrapText)
|
2014-08-14 07:02:50 -04:00
|
|
|
.WrapTextAt(WrapTextAt)
|
|
|
|
|
.Margin(4)
|
2014-09-29 06:54:17 -04:00
|
|
|
.LineHeightPercentage(1.1f)
|
|
|
|
|
.HighlightText(InHighlightText);
|
2014-10-13 06:46:06 -04:00
|
|
|
|
|
|
|
|
return TextBlock;
|
2014-08-14 07:02:50 -04:00
|
|
|
}
|
|
|
|
|
break;
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SNullWidget::NullWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FVector2D STutorialContent::GetPosition() const
|
|
|
|
|
{
|
2014-09-22 09:42:52 -04:00
|
|
|
bool bNonVisibleWidgetBound = bAllowNonWidgetContent && !bIsVisible && Anchor.Type == ETutorialAnchorIdentifier::NamedWidget;
|
|
|
|
|
if(bNonVisibleWidgetBound)
|
|
|
|
|
{
|
|
|
|
|
if(OnWasWidgetDrawn.IsBound())
|
|
|
|
|
{
|
|
|
|
|
bNonVisibleWidgetBound &= !OnWasWidgetDrawn.Execute(Anchor.WrapperIdentifier);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-18 08:11:35 -04:00
|
|
|
if(bNonVisibleWidgetBound)
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
2014-09-18 08:11:35 -04:00
|
|
|
// fallback: center on cached window
|
|
|
|
|
return FVector2D((CachedWindowSize.X * 0.5f) - (ContentWidget->GetDesiredSize().X * 0.5f),
|
|
|
|
|
(CachedWindowSize.Y * 0.5f) - (ContentWidget->GetDesiredSize().Y * 0.5f));
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
2014-09-18 08:11:35 -04:00
|
|
|
else
|
2014-08-05 09:04:35 -04:00
|
|
|
{
|
2014-09-18 08:11:35 -04:00
|
|
|
float XOffset = 0.0f;
|
|
|
|
|
switch(HorizontalAlignment.Get())
|
|
|
|
|
{
|
|
|
|
|
case HAlign_Left:
|
|
|
|
|
XOffset = -(ContentWidget->GetDesiredSize().X - ContentOffset);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
case HAlign_Fill:
|
|
|
|
|
case HAlign_Center:
|
|
|
|
|
XOffset = (CachedGeometry.Size.X * 0.5f) - (ContentWidget->GetDesiredSize().X * 0.5f);
|
|
|
|
|
break;
|
|
|
|
|
case HAlign_Right:
|
|
|
|
|
XOffset = CachedGeometry.Size.X - ContentOffset;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XOffset += WidgetOffset.Get().X;
|
|
|
|
|
|
|
|
|
|
float YOffset = 0.0f;
|
|
|
|
|
switch(VerticalAlignment.Get())
|
|
|
|
|
{
|
|
|
|
|
case VAlign_Top:
|
|
|
|
|
YOffset = -(ContentWidget->GetDesiredSize().Y - ContentOffset);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
case VAlign_Fill:
|
|
|
|
|
case VAlign_Center:
|
|
|
|
|
YOffset = (CachedGeometry.Size.Y * 0.5f) - (ContentWidget->GetDesiredSize().Y * 0.5f);
|
|
|
|
|
break;
|
|
|
|
|
case VAlign_Bottom:
|
|
|
|
|
YOffset = (CachedGeometry.Size.Y - ContentOffset);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
YOffset += WidgetOffset.Get().Y;
|
|
|
|
|
|
|
|
|
|
// now build & clamp to area
|
|
|
|
|
FVector2D BaseOffset = FVector2D(CachedGeometry.AbsolutePosition.X + XOffset, CachedGeometry.AbsolutePosition.Y + YOffset);
|
|
|
|
|
BaseOffset.X = FMath::Clamp(BaseOffset.X, 0.0f, CachedWindowSize.X - ContentWidget->GetDesiredSize().X);
|
|
|
|
|
BaseOffset.Y = FMath::Clamp(BaseOffset.Y, 0.0f, CachedWindowSize.Y - ContentWidget->GetDesiredSize().Y);
|
|
|
|
|
return BaseOffset;
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FVector2D STutorialContent::GetSize() const
|
|
|
|
|
{
|
|
|
|
|
return ContentWidget->GetDesiredSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply STutorialContent::OnCloseButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
OnClosed.ExecuteIfBound();
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EVisibility STutorialContent::GetCloseButtonVisibility() const
|
|
|
|
|
{
|
|
|
|
|
return bIsStandalone ? EVisibility::Visible : EVisibility::Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
EVisibility STutorialContent::GetMenuButtonVisibility() const
|
|
|
|
|
{
|
|
|
|
|
return !bIsStandalone ? EVisibility::Visible : EVisibility::Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-05 09:04:35 -04:00
|
|
|
void STutorialContent::HandlePaintNamedWidget(TSharedRef<SWidget> InWidget, const FGeometry& InGeometry)
|
|
|
|
|
{
|
|
|
|
|
switch(Anchor.Type)
|
|
|
|
|
{
|
|
|
|
|
case ETutorialAnchorIdentifier::NamedWidget:
|
|
|
|
|
{
|
2016-05-10 16:00:39 -04:00
|
|
|
TSharedPtr<FTagMetaData> WidgetMetaData = InWidget->GetMetaData<FTagMetaData>();
|
2014-08-28 06:22:40 -04:00
|
|
|
if( Anchor.WrapperIdentifier == InWidget->GetTag() ||
|
2016-05-10 16:00:39 -04:00
|
|
|
(WidgetMetaData.IsValid() && WidgetMetaData->Tag == Anchor.WrapperIdentifier))
|
2014-08-28 06:22:40 -04:00
|
|
|
{
|
|
|
|
|
bIsVisible = true;
|
|
|
|
|
CachedGeometry = InGeometry;
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
|
|
|
|
|
if (!BorderPulseAnimation.IsPlaying() && Anchor.bDrawHighlight)
|
|
|
|
|
{
|
|
|
|
|
BorderPulseAnimation.Resume();
|
|
|
|
|
}
|
2014-08-28 06:22:40 -04:00
|
|
|
}
|
2014-08-05 09:04:35 -04:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void STutorialContent::HandleResetNamedWidget()
|
|
|
|
|
{
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
BorderPulseAnimation.Pause();
|
2014-08-05 09:04:35 -04:00
|
|
|
bIsVisible = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void STutorialContent::HandleCacheWindowSize(const FVector2D& InWindowSize)
|
|
|
|
|
{
|
|
|
|
|
CachedWindowSize = InWindowSize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EVisibility STutorialContent::GetVisibility() const
|
|
|
|
|
{
|
2014-09-18 08:11:35 -04:00
|
|
|
const bool bVisibleWidgetBound = bIsVisible && Anchor.Type == ETutorialAnchorIdentifier::NamedWidget;
|
|
|
|
|
const bool bNonWidgetBound = Anchor.Type == ETutorialAnchorIdentifier::None;
|
|
|
|
|
|
|
|
|
|
// fallback if widget is not drawn - we should display this content anyway
|
2014-09-22 09:42:52 -04:00
|
|
|
bool bNonVisibleWidgetBound = bAllowNonWidgetContent && !bIsVisible && Anchor.Type == ETutorialAnchorIdentifier::NamedWidget;
|
|
|
|
|
if(bNonVisibleWidgetBound)
|
|
|
|
|
{
|
|
|
|
|
if(OnWasWidgetDrawn.IsBound())
|
|
|
|
|
{
|
|
|
|
|
bNonVisibleWidgetBound &= !OnWasWidgetDrawn.Execute(Anchor.WrapperIdentifier);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-18 08:11:35 -04:00
|
|
|
|
|
|
|
|
return (bVisibleWidgetBound || bNonWidgetBound || bNonVisibleWidgetBound) ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed;
|
2014-08-14 07:02:50 -04:00
|
|
|
}
|
|
|
|
|
|
2014-08-28 06:22:40 -04:00
|
|
|
FSlateColor STutorialContent::GetBackgroundColor() const
|
|
|
|
|
{
|
|
|
|
|
// note cant use IsHovered() here because our widget is SelfHitTestInvisible
|
|
|
|
|
const FVector2D CursorPos = FSlateApplication::Get().GetCursorPos();
|
2014-09-16 10:26:36 -04:00
|
|
|
return CachedContentGeometry.IsUnderLocation(CursorPos) ? FEditorStyle::Get().GetColor("Tutorials.Content.Color.Hovered") : FEditorStyle::Get().GetColor("Tutorials.Content.Color");
|
2014-08-28 06:22:40 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-09 12:19:28 -04:00
|
|
|
float STutorialContent::GetAnimatedZoom() const
|
|
|
|
|
{
|
2014-09-16 10:26:36 -04:00
|
|
|
if(ContentIntroAnimation.IsPlaying() && FSlateApplication::Get().IsRunningAtTargetFrameRate())
|
2014-09-09 12:19:28 -04:00
|
|
|
{
|
|
|
|
|
FIntroTutorials& IntroTutorials = FModuleManager::GetModuleChecked<FIntroTutorials>(TEXT("IntroTutorials"));
|
|
|
|
|
return 0.75f + (0.25f * IntroTutorials.GetIntroCurveValue(ContentIntroAnimation.GetLerp()));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 1.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float STutorialContent::GetInverseAnimatedZoom() const
|
|
|
|
|
{
|
|
|
|
|
return 1.0f / GetAnimatedZoom();
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
TSharedRef<SWidget> STutorialContent::HandleGetMenuContent()
|
|
|
|
|
{
|
|
|
|
|
const bool bInShouldCloseWindowAfterMenuSelection = true;
|
|
|
|
|
FMenuBuilder MenuBuilder(bInShouldCloseWindowAfterMenuSelection, TSharedPtr<const FUICommandList>());
|
|
|
|
|
|
|
|
|
|
MenuBuilder.BeginSection(TEXT("Tutorial Options"));
|
|
|
|
|
{
|
|
|
|
|
MenuBuilder.AddMenuEntry(
|
|
|
|
|
LOCTEXT("ExitLabel", "Exit"),
|
|
|
|
|
LOCTEXT("ExitTooltip", "Quit this tutorial. You can find it again in the tutorials browser, reached from the Help menu."),
|
|
|
|
|
FSlateIcon(),
|
|
|
|
|
FUIAction(
|
|
|
|
|
FExecuteAction::CreateSP(this, &STutorialContent::HandleExitSelected),
|
|
|
|
|
FCanExecuteAction()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
2014-09-18 08:10:29 -04:00
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
MenuBuilder.AddMenuEntry(
|
|
|
|
|
LOCTEXT("NextLabel", "Next"),
|
|
|
|
|
GetNextButtonTooltip(),
|
|
|
|
|
FSlateIcon(),
|
|
|
|
|
FUIAction(
|
|
|
|
|
FExecuteAction::CreateSP(this, &STutorialContent::HandleNextSelected),
|
|
|
|
|
FCanExecuteAction()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
if(IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
MenuBuilder.AddMenuEntry(
|
|
|
|
|
LOCTEXT("BackLabel", "Back"),
|
|
|
|
|
LOCTEXT("BackTooltip", "Go back to the previous stage of this tutorial."),
|
|
|
|
|
FSlateIcon(),
|
|
|
|
|
FUIAction(
|
|
|
|
|
FExecuteAction::CreateSP(this, &STutorialContent::HandleBackSelected),
|
|
|
|
|
FCanExecuteAction()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
MenuBuilder.AddMenuEntry(
|
|
|
|
|
LOCTEXT("RestartLabel", "Restart"),
|
|
|
|
|
LOCTEXT("RestartTooltip", "Start this tutorial again from the beginning."),
|
|
|
|
|
FSlateIcon(),
|
|
|
|
|
FUIAction(
|
|
|
|
|
FExecuteAction::CreateSP(this, &STutorialContent::HandleRestartSelected),
|
|
|
|
|
FCanExecuteAction()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(IsHomeEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
MenuBuilder.AddMenuEntry(
|
|
|
|
|
LOCTEXT("OpenBrowserLabel", "More Tutorials..."),
|
|
|
|
|
LOCTEXT("OpenBrowserTooltip", "Open the tutorial browser to find more tutorials."),
|
|
|
|
|
FSlateIcon(),
|
|
|
|
|
FUIAction(
|
|
|
|
|
FExecuteAction::CreateSP(this, &STutorialContent::HandleBrowseSelected),
|
|
|
|
|
FCanExecuteAction()
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
MenuBuilder.EndSection();
|
|
|
|
|
|
|
|
|
|
return MenuBuilder.MakeWidget();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void STutorialContent::HandleExitSelected()
|
|
|
|
|
{
|
|
|
|
|
OnClosed.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-18 08:10:29 -04:00
|
|
|
void STutorialContent::HandleNextSelected()
|
|
|
|
|
{
|
|
|
|
|
OnNextClicked.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
void STutorialContent::HandleBackSelected()
|
|
|
|
|
{
|
|
|
|
|
OnBackClicked.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void STutorialContent::HandleRestartSelected()
|
|
|
|
|
{
|
|
|
|
|
if(Tutorial.IsValid())
|
|
|
|
|
{
|
|
|
|
|
FIntroTutorials& IntroTutorials = FModuleManager::GetModuleChecked<FIntroTutorials>(TEXT("IntroTutorials"));
|
2015-04-02 16:56:18 -04:00
|
|
|
IntroTutorials.LaunchTutorial(Tutorial.Get(), IIntroTutorials::ETutorialStartType::TST_RESTART, FSlateApplication::Get().FindWidgetWindow(AsShared()));
|
2014-09-18 08:10:29 -04:00
|
|
|
|
2014-12-05 05:33:09 -05:00
|
|
|
if( FEngineAnalytics::IsAvailable() && Tutorial.IsValid() )
|
2014-09-18 08:10:29 -04:00
|
|
|
{
|
2014-12-05 05:33:09 -05:00
|
|
|
TArray<FAnalyticsEventAttribute> EventAttributes;
|
|
|
|
|
EventAttributes.Add(FAnalyticsEventAttribute(TEXT("TutorialAsset"), FIntroTutorials::AnalyticsEventNameFromTutorial(Tutorial.Get())));
|
|
|
|
|
|
|
|
|
|
FEngineAnalytics::GetProvider().RecordEvent( TEXT("Rocket.Tutorials.Restarted"), EventAttributes );
|
2014-09-18 08:10:29 -04:00
|
|
|
}
|
2014-09-16 10:26:36 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void STutorialContent::HandleBrowseSelected()
|
|
|
|
|
{
|
2014-09-18 08:10:29 -04:00
|
|
|
if( FEngineAnalytics::IsAvailable() && Tutorial.IsValid())
|
|
|
|
|
{
|
|
|
|
|
TArray<FAnalyticsEventAttribute> EventAttributes;
|
2014-12-05 05:33:09 -05:00
|
|
|
EventAttributes.Add(FAnalyticsEventAttribute(TEXT("FromTutorial"), FIntroTutorials::AnalyticsEventNameFromTutorial(Tutorial.Get())));
|
2014-09-18 08:10:29 -04:00
|
|
|
|
|
|
|
|
FEngineAnalytics::GetProvider().RecordEvent( TEXT("Rocket.Tutorials.OpenedBrowser"), EventAttributes );
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
OnHomeClicked.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply STutorialContent::HandleNextClicked()
|
|
|
|
|
{
|
|
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
OnNextClicked.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OnHomeClicked.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-17 09:56:06 -05:00
|
|
|
FReply STutorialContent::HandleBackButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
if (IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
OnBackClicked.ExecuteIfBound();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 10:26:36 -04:00
|
|
|
const FSlateBrush* STutorialContent::GetNextButtonBrush() const
|
|
|
|
|
{
|
|
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
return FEditorStyle::GetBrush("Tutorials.Navigation.NextButton");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return FEditorStyle::GetBrush("Tutorials.Navigation.HomeButton");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FText STutorialContent::GetNextButtonTooltip() const
|
|
|
|
|
{
|
|
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("NextButtonTooltip", "Go to the next stage of this tutorial.");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("HomeButtonTooltip", "This tutorial is complete. Open the tutorial browser to find more tutorials.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-30 11:37:26 -04:00
|
|
|
FText STutorialContent::GetNextButtonLabel() const
|
2014-09-16 10:26:36 -04:00
|
|
|
{
|
2014-09-30 11:37:26 -04:00
|
|
|
if(!NextButtonText.Get().IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
return NextButtonText.Get();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("DefaultNextButtonLabel", "Next");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("DefaultHomeButtonLabel", "Home");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* STutorialContent::GetNextButtonBorder() const
|
|
|
|
|
{
|
|
|
|
|
return NextButton->IsHovered() ? &FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.NavigationButton").Hovered : &FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.NavigationButton").Normal;
|
2014-09-16 10:26:36 -04:00
|
|
|
}
|
|
|
|
|
|
2015-02-17 09:56:06 -05:00
|
|
|
const FSlateBrush* STutorialContent::GetBackButtonBrush() const
|
|
|
|
|
{
|
|
|
|
|
if (IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
return FEditorStyle::GetBrush("Tutorials.Navigation.BackButton");
|
|
|
|
|
}
|
|
|
|
|
return FEditorStyle::GetDefaultBrush();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EVisibility STutorialContent::GetBackButtonVisibility() const
|
|
|
|
|
{
|
|
|
|
|
return IsBackEnabled.Get() == true ? EVisibility::Visible : EVisibility::Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FText STutorialContent::GetBackButtonTooltip() const
|
|
|
|
|
{
|
|
|
|
|
if (IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("BackButtonTooltip", "Go to the previous stage of this tutorial.");
|
|
|
|
|
}
|
|
|
|
|
return FText::GetEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FText STutorialContent::GetBackButtonLabel() const
|
|
|
|
|
{
|
|
|
|
|
if (!BackButtonText.Get().IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
return BackButtonText.Get();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("DefaultBackButtonLabel", "Back");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return FText::GetEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FSlateBrush* STutorialContent::GetBackButtonBorder() const
|
|
|
|
|
{
|
2015-02-17 10:17:20 -05:00
|
|
|
return BackButton->IsHovered() ? &FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.NavigationBackButton").Hovered : &FEditorStyle::Get().GetWidgetStyle<FButtonStyle>("Tutorials.Content.NavigationBackButton").Normal;
|
2015-02-17 09:56:06 -05:00
|
|
|
}
|
|
|
|
|
|
2014-09-29 10:05:13 -04:00
|
|
|
FReply STutorialContent::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
|
|
|
|
|
{
|
|
|
|
|
// Mouse back and forward buttons traverse history
|
|
|
|
|
if ( MouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton)
|
|
|
|
|
{
|
|
|
|
|
if(IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
OnBackClicked.ExecuteIfBound();
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( MouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton2)
|
|
|
|
|
{
|
|
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
OnNextClicked.ExecuteIfBound();
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FReply STutorialContent::OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent )
|
|
|
|
|
{
|
|
|
|
|
// Mouse back and forward buttons traverse history
|
|
|
|
|
if ( InMouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton)
|
|
|
|
|
{
|
|
|
|
|
if(IsBackEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
OnBackClicked.ExecuteIfBound();
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( InMouseEvent.GetEffectingButton() == EKeys::ThumbMouseButton2)
|
|
|
|
|
{
|
|
|
|
|
if(IsNextEnabled.Get())
|
|
|
|
|
{
|
|
|
|
|
OnNextClicked.ExecuteIfBound();
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FReply::Unhandled();
|
|
|
|
|
}
|
|
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#undef LOCTEXT_NAMESPACE
|