From 5526401331ce2629a670dddaecd6a134aa7009a0 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Thu, 23 May 2019 21:04:47 -0500 Subject: [PATCH 01/14] Updated Updated --- .../Private/LoadingScreenModule.cpp | 64 +++- .../Private/LoadingScreenSettings.cpp | 71 +++- .../Private/LoadingScreenSettings.h | 285 ++++++++++++--- .../Private/SSimpleLoadingScreen.cpp | 326 +++++++++++++----- .../Private/SSimpleLoadingScreen.h | 38 +- 5 files changed, 614 insertions(+), 170 deletions(-) diff --git a/Source/LoadingScreen/Private/LoadingScreenModule.cpp b/Source/LoadingScreen/Private/LoadingScreenModule.cpp index fa72a55..c960095 100644 --- a/Source/LoadingScreen/Private/LoadingScreenModule.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenModule.cpp @@ -23,7 +23,11 @@ class FLoadingScreenModule : public ILoadingScreenModule private: void HandlePrepareLoadingScreen(); - void BeginLoadingScreen(const FLoadingScreenDescription& ScreenDescription); + void HandleMovieClipFinished(const FString& FinishedClip); + + void BeginLoadingScreen(const FLoadingScreenDescription& ScreenDescription); + + TSharedPtr WidgetLoadingScreen; }; IMPLEMENT_MODULE(FLoadingScreenModule, LoadingScreen) @@ -43,15 +47,15 @@ void FLoadingScreenModule::StartupModule() { Ref.TryLoad(); } - for ( const FStringAssetReference& Ref : Settings->DefaultScreen.Images ) { Ref.TryLoad(); } if ( IsMoviePlayerEnabled() ) - { - GetMoviePlayer()->OnPrepareLoadingScreen().AddRaw(this, &FLoadingScreenModule::HandlePrepareLoadingScreen); + { + // Binds the delegate to auto fire the loading screen code when a level changes and when a movie finishes + GetMoviePlayer()->OnPrepareLoadingScreen().AddRaw(this, &FLoadingScreenModule::HandlePrepareLoadingScreen); } // Prepare the startup screen, the PrepareLoadingScreen callback won't be called @@ -64,6 +68,10 @@ void FLoadingScreenModule::ShutdownModule() { if ( !IsRunningDedicatedServer() ) { + if (WidgetLoadingScreen.IsValid()) + { + WidgetLoadingScreen.Reset(); + } GetMoviePlayer()->OnPrepareLoadingScreen().RemoveAll(this); } } @@ -74,8 +82,31 @@ void FLoadingScreenModule::HandlePrepareLoadingScreen() BeginLoadingScreen(Settings->DefaultScreen); } +void FLoadingScreenModule::HandleMovieClipFinished(const FString & FinishedClip) +{ + // If its not the last movie then try keep waiting + if (!GetMoviePlayer()->IsLastMovieInPlaylist()) + { + return; + } + + // Unbind the delegate so we're not firing this multiple times + GetMoviePlayer()->OnMovieClipFinished().RemoveAll(this); + + // Show the loading screen widget + if (WidgetLoadingScreen.IsValid()) + { + WidgetLoadingScreen->HandleMoviesFinishedPlaying(); + } +} + void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& ScreenDescription) { + if (WidgetLoadingScreen.IsValid()) + { + WidgetLoadingScreen.Reset(); + } + FLoadingScreenAttributes LoadingScreen; LoadingScreen.MinimumLoadingScreenDisplayTime = ScreenDescription.MinimumLoadingScreenDisplayTime; LoadingScreen.bAutoCompleteWhenLoadingCompletes = ScreenDescription.bAutoCompleteWhenLoadingCompletes; @@ -83,12 +114,31 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S LoadingScreen.bWaitForManualStop = ScreenDescription.bWaitForManualStop; LoadingScreen.MoviePaths = ScreenDescription.MoviePaths; LoadingScreen.PlaybackType = ScreenDescription.PlaybackType; - - if ( ScreenDescription.bShowUIOverlay ) + + + // Create and store widget + WidgetLoadingScreen = SNew(SSimpleLoadingScreen, ScreenDescription) + .bShowThrobber(ScreenDescription.Throbber.bShowThrobber) + .ThrobberType(ScreenDescription.Throbber.ThrobberType) + ; + LoadingScreen.WidgetLoadingScreen = WidgetLoadingScreen; + + // Incase we have no movie paths, this will force it to show the loading screen anyway + if (LoadingScreen.MoviePaths.Num() == 0) { - LoadingScreen.WidgetLoadingScreen = SNew(SSimpleLoadingScreen, ScreenDescription); + // Forces the movie player to create a movie streamer to actually show the widget and such + LoadingScreen.MoviePaths.Add(""); } + // If we have movies to show, then setup what happens if we're supposed to show ui otherwise skip this + else + { + // Edgecase + GetMoviePlayer()->OnMovieClipFinished().RemoveAll(this); + + GetMoviePlayer()->OnMovieClipFinished().AddRaw(this, &FLoadingScreenModule::HandleMovieClipFinished); + } + // This happens last after everything has been prepared ahead of time GetMoviePlayer()->SetupLoadingScreen(LoadingScreen); } diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp index 6cabe7f..2ca1c35 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp @@ -1,27 +1,76 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "LoadingScreenSettings.h" -#include "UObject/ConstructorHelpers.h" +#include "CoreStyle.h" #include "Engine/Font.h" +#include "UObject/ConstructorHelpers.h" #define LOCTEXT_NAMESPACE "LoadingScreen" -FLoadingScreenDescription::FLoadingScreenDescription() - : LoadingText(LOCTEXT("Loading", "LOADING")) +FLoadingScreenSlotPosition::FLoadingScreenSlotPosition() + : Anchors(0.5f) + , Offset(NoInit) + , Alignment(NoInit) +{ } + +FLoadingScreenSlotText::FLoadingScreenSlotText() + : bShouldShowText(true) + , TextJustification(ETextJustify::Center) + , WrapAt(1000.0f) + , TextColor(FSlateColor(FLinearColor::White)) { + if (!IsRunningDedicatedServer()) + { + static ConstructorHelpers::FObjectFinder RobotoFontObj(TEXT("/Engine/EngineFonts/Roboto")); + Font = FSlateFontInfo(RobotoFontObj.Object, 20, FName("Normal"));; + } +} + +FLoadingScreenText::FLoadingScreenText() + : SlotText(FLoadingScreenSlotText()) + , SlotPosition(FLoadingScreenSlotPosition()) +{ } + +FLoadingScreenThrobber::FLoadingScreenThrobber() + : bShowThrobber(true) + , ThrobberType(EThrobberLoadingType::TLT_Regular) + , bFlipThrobberAnimation(false) + , NumPiecesThrobber(6) + , ThrobberImage(*FCoreStyle::Get().GetBrush("Throbber.Chunk")) + , ThrobberSlotPosition(FLoadingScreenSlotPosition()) + , AnimateHorizontally(true) + , AnimateVertically(true) + , AnimateOpacity(true) + , ThrobberPeriod(0.75f) + , ThrobberRadius(16.0f) +{ } + +FLoadingScreenTips::FLoadingScreenTips() + : SlotText(FLoadingScreenSlotText()) + , SlotPosition(FLoadingScreenSlotPosition()) +{ } + +FLoadingScreenDescription::FLoadingScreenDescription() + : MinimumLoadingScreenDisplayTime(-1.0f) + , bAutoCompleteWhenLoadingCompletes(true) + , bMoviesAreSkippable(true) + , bWaitForManualStop(false) + , bShowUIOverlay(true) + , bShowUiAfterMovies(true) + , Throbber(FLoadingScreenThrobber()) + , LoadingScreenText(FLoadingScreenText()) + , LoadingScreenDescription(FLoadingScreenText()) + , LoadingScreenTips(FLoadingScreenTips()) + , bShowImagesAfterMovies(true) + , ImageStretch(EStretch::ScaleToFit) +{ + LoadingScreenText.Text = LOCTEXT("Loading", "LOADING"); } ULoadingScreenSettings::ULoadingScreenSettings(const FObjectInitializer& Initializer) : Super(Initializer) -{ - TipWrapAt = 1000.0f; +{ - if ( !IsRunningDedicatedServer() ) - { - static ConstructorHelpers::FObjectFinder RobotoFontObj(TEXT("/Engine/EngineFonts/Roboto")); - TipFont = FSlateFontInfo(RobotoFontObj.Object, 20, FName("Normal")); - LoadingFont = FSlateFontInfo(RobotoFontObj.Object, 32, FName("Bold")); - } } #undef LOCTEXT_NAMESPACE diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.h b/Source/LoadingScreen/Private/LoadingScreenSettings.h index ceb6936..fa2a73c 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.h +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.h @@ -3,67 +3,259 @@ #pragma once #include "CoreMinimal.h" +#include "Anchors.h" #include "Fonts/SlateFontInfo.h" -#include "SScaleBox.h" #include "MoviePlayer.h" +#include "SScaleBox.h" +#include "TextLayout.h" #include "Engine/DeveloperSettings.h" #include "LoadingScreenSettings.generated.h" +UENUM(BlueprintType) +enum class EThrobberLoadingType : uint8 +{ + TLT_Regular UMETA(DisplayName = "Regular"), + TLT_Circular UMETA(DisplayName = "Circular") +}; + +USTRUCT(BlueprintType) +struct LOADINGSCREEN_API FLoadingScreenSlotPosition +{ + GENERATED_BODY() + +public: + + FLoadingScreenSlotPosition(); + + /** The anchor for the Widget + * 0-X = Left Side + * 1-X = Right Side + * 0-Y = Top Side + * 1-Y = Bottom Side + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Slot Position") + FAnchors Anchors; + + /** The offset for the Widget + * -X = Left + * +X = Right + * -Y = Up + * +Y = Down + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Slot Position") + FVector2D Offset; + + /** Alignment pivot point of the Widget with 0.5 being center of either axis + * 0-X = Left Side + * 1-X = Right Side + * 0-Y = Top Side + * 1-Y = Bottom Side + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Slot Position") + FVector2D Alignment; + +}; + +USTRUCT(BlueprintType) +struct LOADINGSCREEN_API FLoadingScreenSlotText +{ + GENERATED_BODY() + +public: + + FLoadingScreenSlotText(); + + /** Flag for showing the widget. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + bool bShouldShowText; + + /** The justification of the text. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + TEnumAsByte TextJustification; + + /** The size of the text before it's wrapped to the next line. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + float WrapAt; + + /** The color to use for the text */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Screen Text") + FSlateColor TextColor; + + /** The font to display for text. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + FSlateFontInfo Font; +}; + +USTRUCT(BlueprintType) +struct LOADINGSCREEN_API FLoadingScreenText +{ + GENERATED_BODY() + +public: + + FLoadingScreenText(); + + /** Text Information related to the text */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Screen Text") + FLoadingScreenSlotText SlotText; + + /** The slot position of the text */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Screen Text") + FLoadingScreenSlotPosition SlotPosition; + + /** The text to display on the loading screen. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Screen Text", meta = (MultiLine = "true")) + FText Text; + +}; + +USTRUCT(BlueprintType) +struct LOADINGSCREEN_API FLoadingScreenThrobber +{ + GENERATED_BODY() + +public: + + FLoadingScreenThrobber(); + + /** Flag for showing the loading throbber if true, false will not show any throbber. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (InlineEditConditionToggle)) + bool bShowThrobber; + + /** Decides which throbber type to show if true, false will not show any throbber. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (EditCondition = "bShowThrobber")) + EThrobberLoadingType ThrobberType; + + /** Should throbber animate in opposite direction? Works for both regular and circular throbber */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") + bool bFlipThrobberAnimation; + + /** The numbers of pieces in the throbber when it is shown */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (ClampMin = "1", ClampMax = "25")) + int NumPiecesThrobber; + + /** The image for each throbber piece */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") + FSlateBrush ThrobberImage; + + /** The slot position of the throbber */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") + FLoadingScreenSlotPosition ThrobberSlotPosition; + + /** Should the pieces animate horizontally? */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular") + bool AnimateHorizontally; + + /** Should the pieces animate vertically? */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular") + bool AnimateVertically; + + /** Should the pieces animate their opacity? */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular") + bool AnimateOpacity; + + /** The amount of time for a full circle(in seconds) */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular") + float ThrobberPeriod; + + /** The radius of the circle */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular") + float ThrobberRadius; + +}; + +USTRUCT(BlueprintType) +struct LOADINGSCREEN_API FLoadingScreenTips +{ + GENERATED_BODY() + +public: + + FLoadingScreenTips(); + + /** Text Information related to the tips text */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + FLoadingScreenSlotText SlotText; + + /** The slot position of the tips */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + FLoadingScreenSlotPosition SlotPosition; + + /** The tips to display on the load screen. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips", meta =(MultiLine = "true")) + TArray Tips; + +}; + USTRUCT(BlueprintType) struct LOADINGSCREEN_API FLoadingScreenDescription { - GENERATED_USTRUCT_BODY() + GENERATED_BODY() + +public: FLoadingScreenDescription(); /** The minimum time that a loading screen should be opened for, -1 if there is no minimum time. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading) - float MinimumLoadingScreenDisplayTime = -1; - + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Loading") + float MinimumLoadingScreenDisplayTime; + /** If true, the loading screen will disappear as soon as loading is done. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading) - bool bAutoCompleteWhenLoadingCompletes = true; - + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Loading") + bool bAutoCompleteWhenLoadingCompletes; + /** If true, movies can be skipped by clicking the loading screen as long as loading is done. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading) - bool bMoviesAreSkippable = true; - + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Loading") + bool bMoviesAreSkippable; + /** If true, movie playback continues until Stop is called. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Loading) - bool bWaitForManualStop = false; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Loading") + bool bWaitForManualStop; /** Should we just play back, loop, etc. NOTE: if playback type is MT_LoadingLoop, then MoviePlayer will auto complete when in the last movie and load finishes regardless of bAutoCompleteWhenLoadingCompletes */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Loading) - TEnumAsByte PlaybackType; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Movies") + TEnumAsByte PlaybackType; /** The movie paths local to the game's Content/Movies/ directory without extension. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Movies) - TArray MoviePaths; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Movies") + TArray MoviePaths; - /** Should we show the images/tips/loading text? Generally you'll want to set this to false if you just want to show a movie. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Display) - bool bShowUIOverlay = true; + /** Should we show the throbber/loading text etc? Generally you'll want to set this to false if you just want to show a movie. This will render over any movie/background image. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI") + bool bShowUIOverlay; - /** Text displayed beside the animated icon */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Display) - FText LoadingText; + /** Flag for showing UI after all movies have been played successfully if true. False will show during movies. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI", meta = (EditCondition = "bShowUIOverlay")) + bool bShowUiAfterMovies; - /** The texture display while in the loading screen on top of the movie. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Images, meta=(AllowedClasses="Texture2D")) - TArray Images; + /** Throbber to display when loading, can show circular and regular throbber types */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Throbber", meta = (EditCondition = "bShowUIOverlay")) + FLoadingScreenThrobber Throbber; - /** The scaling type to apply to images. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Images) - TEnumAsByte ImageStretch = EStretch::ScaleToFit; + /** Text to display to indicate that the game is loading */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Loading Text", meta = (EditCondition = "bShowUIOverlay")) + FLoadingScreenText LoadingScreenText; + + /** Optional text to display as a description. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Description", meta = (EditCondition = "bShowUIOverlay")) + FLoadingScreenText LoadingScreenDescription; + + /** Optional text to display that will randomly swap out with other tips if applicable */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Tips", meta = (EditCondition = "bShowUIOverlay")) + FLoadingScreenTips LoadingScreenTips; - /** The background color to use */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Images) - FLinearColor BackgroundColor = FLinearColor::Black; + /** Flag for showing images after all movies have been played successfully if true. False will show during movies. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Images") + bool bShowImagesAfterMovies; - /** The background color to use for tips */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Images) - FLinearColor TipBackgroundColor = FLinearColor(0, 0, 0, 0.75f); + /** The texture display while in the loading screen on top of the movie. Will render after and over any movies. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Images", meta = (AllowedClasses = "Texture2D")) + TArray Images; + + /** The scaling type to apply to images. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI|Images") + TEnumAsByte ImageStretch; }; /** @@ -72,31 +264,18 @@ struct LOADINGSCREEN_API FLoadingScreenDescription UCLASS(config=Game, defaultconfig, meta=(DisplayName="Loading Screen")) class LOADINGSCREEN_API ULoadingScreenSettings : public UDeveloperSettings { - GENERATED_UCLASS_BODY() + GENERATED_BODY() public: + ULoadingScreenSettings(const FObjectInitializer& Initializer); + /** The startup screen for the project. */ - UPROPERTY(config, EditAnywhere, Category=Screens) + UPROPERTY(config, EditAnywhere, Category = "Screens") FLoadingScreenDescription StartupScreen; /** The default load screen between maps. */ - UPROPERTY(config, EditAnywhere, Category=Screens) + UPROPERTY(config, EditAnywhere, Category = "Screens") FLoadingScreenDescription DefaultScreen; - /** The font to display the tips in. */ - UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice) - FSlateFontInfo TipFont; - - /** The font to display on loading. */ - UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category = Display) - FSlateFontInfo LoadingFont; - - /** The size of the tip before it's wrapped to the next line. */ - UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice) - float TipWrapAt; - - /** The tips to display on the load screen. */ - UPROPERTY(config, EditAnywhere, BlueprintReadWrite, Category=Advice, meta = (MultiLine = "true")) - TArray Tips; }; diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index b80a27c..d176e90 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -2,19 +2,23 @@ #include "SSimpleLoadingScreen.h" +#include "Slate/DeferredCleanupSlateBrush.h" +#include "SScaleBox.h" +#include "Widgets/Images/SImage.h" +#include "Widgets/Layout/SSpacer.h" #include "Widgets/SOverlay.h" #include "Widgets/SBoxPanel.h" -#include "Widgets/Layout/SScaleBox.h" -#include "Widgets/Layout/SSpacer.h" -#include "Widgets/Layout/SBorder.h" -#include "Widgets/Layout/SSafeZone.h" #include "Widgets/Layout/SDPIScaler.h" #include "Widgets/Text/STextBlock.h" -#include "Widgets/Images/SImage.h" -#include "Widgets/Images/SThrobber.h" +#include "Widgets/Layout/SBorder.h" +#include "Widgets/Layout/SConstraintCanvas.h" +#include "SSafeZone.h" +#include "SThrobber.h" +#include "SDPIScaler.h" +#include "SlateApplication.h" #include "Engine/Texture2D.h" +#include "Engine/Engine.h" #include "Engine/UserInterfaceSettings.h" -#include "Slate/DeferredCleanupSlateBrush.h" #define LOCTEXT_NAMESPACE "LoadingScreen" @@ -32,128 +36,228 @@ static float PointSizeToSlateUnits(float PointSize) } void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScreenDescription& InScreenDescription) -{ - const ULoadingScreenSettings* Settings = GetDefault(); +{ + LastToolTipUpdate = -1.0f; - const FSlateFontInfo& TipFont = Settings->TipFont; - const FSlateFontInfo& LoadingFont = Settings->LoadingFont; + ScreenDescriptionInfo = InScreenDescription; + // Only show on construct if UI is true and we're not showing it after movies + const bool bShowUiOnConstruct = (ScreenDescriptionInfo.bShowUIOverlay && !ScreenDescriptionInfo.bShowUiAfterMovies); + bShowThrobber = InArgs._bShowThrobber; + ThrobberType = InArgs._ThrobberType; + + // Construct the root of this widget TSharedRef Root = SNew(SOverlay); // If there's an image defined - if ( InScreenDescription.Images.Num() > 0 ) + if (ScreenDescriptionInfo.Images.Num() > 0) { - const int32 ImageIndex = FMath::RandRange(0, InScreenDescription.Images.Num() - 1); - const FStringAssetReference& ImageAsset = InScreenDescription.Images[ImageIndex]; + // Construct a random image to use for the loading screen + const int32 ImageIndex = FMath::RandRange(0, ScreenDescriptionInfo.Images.Num() - 1); + const FStringAssetReference& ImageAsset = ScreenDescriptionInfo.Images[ImageIndex]; UObject* ImageObject = ImageAsset.TryLoad(); if ( UTexture2D* LoadingImage = Cast(ImageObject) ) { - LoadingScreenBrush = FDeferredCleanupSlateBrush::CreateBrush(LoadingImage); + FVector2D Size = FVector2D(LoadingImage->GetSizeX(), LoadingImage->GetSizeY()); + LoadingScreenBrush = FDeferredCleanupSlateBrush::CreateBrush(LoadingImage, Size); + //LoadingImage, Size, FName(*ImageAsset.ToString())) + // Adds a slot to the root then add that image to the widget, renders over the movie if supposed to + BackgroundImageWidget = SNew(SImage) + .Visibility(ScreenDescriptionInfo.bShowImagesAfterMovies ? EVisibility::Hidden : EVisibility::SelfHitTestInvisible) + .Image(LoadingScreenBrush->GetSlateBrush()); - Root->AddSlot() + Root->AddSlot(0) .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) + .VAlign(VAlign_Fill) [ - SNew(SBorder) - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .BorderBackgroundColor(InScreenDescription.BackgroundColor) - .BorderImage(FCoreStyle::Get().GetBrush("WhiteBrush")) + SNew(SScaleBox) + .Stretch(ScreenDescriptionInfo.ImageStretch) [ - SNew(SScaleBox) - .Stretch(InScreenDescription.ImageStretch) - [ - SNew(SImage) - .Image(LoadingScreenBrush.IsValid() ? LoadingScreenBrush->GetSlateBrush() : nullptr) - ] + BackgroundImageWidget.ToSharedRef() ] ]; } - } + } - TSharedRef TipWidget = SNullWidget::NullWidget; - if ( Settings->Tips.Num() > 0 ) + // Handles creating the throbber widget { - const int32 TipIndex = FMath::RandRange(0, Settings->Tips.Num() - 1); + // Decides which throbber type to show + switch (ThrobberType) + { + case EThrobberLoadingType::TLT_Circular: + { + // Old comment information may be of use in the future + // Convert font size to pixels, pixel_size = point_size * resolution / 72, then half it to get radius + // (Settings->LoadingFont.Size * 96.0f / 72.0f) / 2.0f - TipWidget = SNew(STextBlock) - .WrapTextAt(Settings->TipWrapAt) - .Font(TipFont) - .Text(Settings->Tips[TipIndex]); + ThrobberWidget = SNew(SCircularThrobber) + .Radius(ScreenDescriptionInfo.Throbber.ThrobberRadius) + .Period(ScreenDescriptionInfo.Throbber.ThrobberPeriod) + .NumPieces(ScreenDescriptionInfo.Throbber.NumPiecesThrobber) + .PieceImage(&ScreenDescriptionInfo.Throbber.ThrobberImage); + break; + } + case EThrobberLoadingType::TLT_Regular: + default: + { + const int32 AnimationParams = (ScreenDescriptionInfo.Throbber.AnimateVertically ? SThrobber::Vertical : 0) | + (ScreenDescriptionInfo.Throbber.AnimateHorizontally ? SThrobber::Horizontal : 0) | + (ScreenDescriptionInfo.Throbber.AnimateOpacity ? SThrobber::Opacity : 0); + + const SThrobber::EAnimation Animation = static_cast(AnimationParams); + + ThrobberWidget = SNew(SThrobber) + .Animate(Animation) + .NumPieces(ScreenDescriptionInfo.Throbber.NumPiecesThrobber) + .PieceImage(&ScreenDescriptionInfo.Throbber.ThrobberImage); + break; + } + } + + // Handles flipping the widget if needed + ThrobberWidget->SetRenderTransformPivot(FVector2D(0.5f, 0.5f)); + const float ThrobberScale = (float)((ScreenDescriptionInfo.Throbber.bFlipThrobberAnimation) ? -1 : 1); + ThrobberWidget->SetRenderTransform(FSlateRenderTransform(FScale2D(ThrobberScale, 1.0f))); + ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); } - else + + // Handles creating the tip text widget + if (ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() > 0) + { + CurrentToolTipIndex = FMath::RandRange(0, ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() - 1); + + CurrentToolTipWidget = SNew(STextBlock) + .Visibility((ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText && bShowUiOnConstruct) + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden) + .WrapTextAt(ScreenDescriptionInfo.LoadingScreenTips.SlotText.WrapAt) + .Font(ScreenDescriptionInfo.LoadingScreenTips.SlotText.Font) + .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextColor) + .Justification(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextJustification) + .Text(ScreenDescriptionInfo.LoadingScreenTips.Tips[CurrentToolTipIndex]); + + LastToolTipUpdate = FSlateApplication::Get().GetCurrentTime(); + } + + // Construct Description Text { - // Need to use a spacer when being rendered on another thread, incrementing the SNullWidget will - // lead to shared ptr crashes. - TipWidget = SNew(SSpacer); + DescriptionTextWidget = SNew(STextBlock) + .Text(ScreenDescriptionInfo.LoadingScreenDescription.Text) + .Font(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.Font) + .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.TextColor) + .Justification(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.TextJustification) + .WrapTextAt(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.WrapAt) + .Visibility((ScreenDescriptionInfo.LoadingScreenDescription.SlotText.bShouldShowText && bShowUiOnConstruct) + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); } + // Construct Loading text + { + LoadingTextWidget = SNew(STextBlock) + .Text(ScreenDescriptionInfo.LoadingScreenText.Text) + .Font(ScreenDescriptionInfo.LoadingScreenText.SlotText.Font) + .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenText.SlotText.TextColor) + .Justification(ScreenDescriptionInfo.LoadingScreenText.SlotText.TextJustification) + .Visibility((ScreenDescriptionInfo.LoadingScreenText.SlotText.bShouldShowText && bShowUiOnConstruct) + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } + + // Adds a slot to the root of this widget to allow for other widgets to be added to it, renders over image/movie Root->AddSlot() .HAlign(HAlign_Fill) - .VAlign(VAlign_Bottom) + .VAlign(VAlign_Fill) [ - SNew(SBorder) - .HAlign(HAlign_Fill) - .VAlign(VAlign_Fill) - .BorderBackgroundColor(InScreenDescription.TipBackgroundColor) - .BorderImage(FCoreStyle::Get().GetBrush("WhiteBrush")) + SNew(SSafeZone) [ - SNew(SSafeZone) - .HAlign(HAlign_Fill) - .VAlign(VAlign_Bottom) - .IsTitleSafe(true) - [ - SNew(SDPIScaler) - .DPIScale(this, &SSimpleLoadingScreen::GetDPIScale) - [ - SNew(SHorizontalBox) - - + SHorizontalBox::Slot() - .Padding(FMargin(25, 0.0f, 0, 0)) - .VAlign(VAlign_Center) - .AutoWidth() - [ - SNew(SCircularThrobber) - .Radius(PointSizeToSlateUnits(LoadingFont.Size) / 2.0f) - ] - - + SHorizontalBox::Slot() - .Padding(FMargin(40.0f, 0.0f, 0, 0)) - .AutoWidth() - .VAlign(VAlign_Center) - [ - SNew(STextBlock) - .Text(InScreenDescription.LoadingText) - .Font(LoadingFont) - ] - - + SHorizontalBox::Slot() - .FillWidth(1) - .HAlign(HAlign_Fill) - [ - SNew(SSpacer) - .Size(FVector2D(1.0f, 1.0f)) - ] - - + SHorizontalBox::Slot() - .AutoWidth() - .HAlign(HAlign_Right) - .VAlign(VAlign_Center) - .Padding(FMargin(10.0f)) - [ - TipWidget - ] - ] - ] + SNew(SConstraintCanvas) + + // Adds the circular throbber to the canvas + + SConstraintCanvas::Slot() + .Anchors(ScreenDescriptionInfo.Throbber.ThrobberSlotPosition.Anchors) + .Offset(FMargin(ScreenDescriptionInfo.Throbber.ThrobberSlotPosition.Offset)) + .Alignment(ScreenDescriptionInfo.Throbber.ThrobberSlotPosition.Alignment) + .AutoSize(true) + .ZOrder(1) + [ + ThrobberWidget.ToSharedRef() + ] + + // Adds the tip text to the canvas + + SConstraintCanvas::Slot() + .Anchors(ScreenDescriptionInfo.LoadingScreenTips.SlotPosition.Anchors) + .Offset(FMargin(ScreenDescriptionInfo.LoadingScreenTips.SlotPosition.Offset)) + .Alignment(ScreenDescriptionInfo.LoadingScreenTips.SlotPosition.Alignment) + .AutoSize(true) + .ZOrder(1) + [ + CurrentToolTipWidget.ToSharedRef() + ] + + // Adds the description text to the canvas + + SConstraintCanvas::Slot() + .Anchors(ScreenDescriptionInfo.LoadingScreenDescription.SlotPosition.Anchors) + .Offset(FMargin(ScreenDescriptionInfo.LoadingScreenDescription.SlotPosition.Offset)) + .Alignment(ScreenDescriptionInfo.LoadingScreenDescription.SlotPosition.Alignment) + .AutoSize(true) + .ZOrder(2) + [ + DescriptionTextWidget.ToSharedRef() ] - ]; + // Adds the loading text to the canvas + + SConstraintCanvas::Slot() + .Anchors(ScreenDescriptionInfo.LoadingScreenText.SlotPosition.Anchors) + .Offset(FMargin(ScreenDescriptionInfo.LoadingScreenText.SlotPosition.Offset)) + .Alignment(ScreenDescriptionInfo.LoadingScreenText.SlotPosition.Alignment) + .AutoSize(true) + .ZOrder(3) + [ + LoadingTextWidget.ToSharedRef() + ] + ] + ]; + ChildSlot [ Root ]; } +void SSimpleLoadingScreen::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) +{ + if ((InCurrentTime - LastToolTipUpdate) > 5.0f) + { + LastToolTipUpdate = InCurrentTime; + + // Safety check that it is a textblock and not something else + if (CurrentToolTipWidget->GetType() == "STextBlock") + { + STextBlock* TextBlock = static_cast(&CurrentToolTipWidget.ToSharedRef().Get()); + TextBlock->SetText(GetRandomToolTip()); + } + } +} + +void SSimpleLoadingScreen::HandleMoviesFinishedPlaying() +{ + // Show the background if we're allowed to + if (ScreenDescriptionInfo.bShowImagesAfterMovies) + { + BackgroundImageWidget->SetVisibility(EVisibility::SelfHitTestInvisible); + } + + // Show ui elements if we're showing ui and we can show it after movies + if (ScreenDescriptionInfo.bShowUiAfterMovies && ScreenDescriptionInfo.bShowUIOverlay) + { + ThrobberWidget->SetVisibility(ScreenDescriptionInfo.Throbber.bShowThrobber ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + + LoadingTextWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenText.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + + DescriptionTextWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + + CurrentToolTipWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } +} + float SSimpleLoadingScreen::GetDPIScale() const { const FVector2D& DrawSize = GetCachedGeometry().ToPaintGeometry().GetLocalSize(); @@ -161,4 +265,38 @@ float SSimpleLoadingScreen::GetDPIScale() const return GetDefault()->GetDPIScaleBasedOnSize(Size); } +FText SSimpleLoadingScreen::GetRandomToolTip() +{ + + // Decides a random tip to show + { + const int32 Total = ScreenDescriptionInfo.LoadingScreenTips.Tips.Num(); + int32 RandomTip = FMath::RandRange(0, Total - 1); + // If there's only one then do nothing + if (Total == 1) + { + RandomTip = 0; + } + else + { + // Find a random index that is not currently used + while (RandomTip == CurrentToolTipIndex) + { + // Randomize the index + RandomTip = FMath::RandRange(0, Total - 1); + } + } + + // Update current index to be this randomized one + CurrentToolTipIndex = RandomTip; + } + + return ScreenDescriptionInfo.LoadingScreenTips.Tips[CurrentToolTipIndex]; +} + +bool SSimpleLoadingScreen::CanShowToolTip() const +{ + return (ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() > 0); +} + #undef LOCTEXT_NAMESPACE diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.h b/Source/LoadingScreen/Private/SSimpleLoadingScreen.h index 91fab88..5493cab 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.h +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.h @@ -1,8 +1,9 @@ -// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. +// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once #include "SCompoundWidget.h" +#include "CoreStyle.h" #include "LoadingScreenSettings.h" class FDeferredCleanupSlateBrush; @@ -11,15 +12,42 @@ class SSimpleLoadingScreen : public SCompoundWidget { public: - SLATE_BEGIN_ARGS(SSimpleLoadingScreen) {} - + SLATE_BEGIN_ARGS(SSimpleLoadingScreen) : + _bShowThrobber(false), + _ThrobberType(EThrobberLoadingType::TLT_Regular) + {} + SLATE_ARGUMENT(bool, bShowThrobber); + SLATE_ARGUMENT(EThrobberLoadingType, ThrobberType); SLATE_END_ARGS() void Construct(const FArguments& InArgs, const FLoadingScreenDescription& ScreenDescription); + virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override; + + /** Handles setting visibility on objects that should be showing after all loading movies finished showing */ + void HandleMoviesFinishedPlaying(); + private: float GetDPIScale() const; + + /** Returns a random tool tip that is not currently used and sets the current index to that new one */ + FText GetRandomToolTip(); + + /** Checks if we're able to show any tool tips */ + bool CanShowToolTip() const; -private: - TSharedPtr LoadingScreenBrush; + TSharedPtr LoadingScreenBrush; + + bool bShowThrobber; + EThrobberLoadingType ThrobberType; + + double LastToolTipUpdate; + int CurrentToolTipIndex; + TSharedPtr CurrentToolTipWidget = SNullWidget::NullWidget; + TSharedPtr LoadingTextWidget = SNullWidget::NullWidget; + TSharedPtr DescriptionTextWidget = SNullWidget::NullWidget; + TSharedPtr ThrobberWidget = SNullWidget::NullWidget; + TSharedPtr BackgroundImageWidget = SNullWidget::NullWidget; + + FLoadingScreenDescription ScreenDescriptionInfo; }; From ad14889cc6828a44de762e1f253893ed2a4d5927 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Thu, 23 May 2019 21:24:09 -0500 Subject: [PATCH 02/14] Update Update --- .../Private/LoadingScreenModule.cpp | 4 ++- .../Private/LoadingScreenSettings.cpp | 3 ++- .../Private/LoadingScreenSettings.h | 26 +++++++++++-------- .../Private/SSimpleLoadingScreen.cpp | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Source/LoadingScreen/Private/LoadingScreenModule.cpp b/Source/LoadingScreen/Private/LoadingScreenModule.cpp index c960095..b5c0ac3 100644 --- a/Source/LoadingScreen/Private/LoadingScreenModule.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenModule.cpp @@ -127,7 +127,9 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S if (LoadingScreen.MoviePaths.Num() == 0) { // Forces the movie player to create a movie streamer to actually show the widget and such - LoadingScreen.MoviePaths.Add(""); + LoadingScreen.MoviePaths.Add(""); + + WidgetLoadingScreen->HandleMoviesFinishedPlaying(); } // If we have movies to show, then setup what happens if we're supposed to show ui otherwise skip this else diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp index 2ca1c35..334696e 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp @@ -47,7 +47,8 @@ FLoadingScreenThrobber::FLoadingScreenThrobber() FLoadingScreenTips::FLoadingScreenTips() : SlotText(FLoadingScreenSlotText()) - , SlotPosition(FLoadingScreenSlotPosition()) + , SlotPosition(FLoadingScreenSlotPosition()) + , TimeBetweenTips(10.0f) { } FLoadingScreenDescription::FLoadingScreenDescription() diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.h b/Source/LoadingScreen/Private/LoadingScreenSettings.h index fa2a73c..f6cda4b 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.h +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.h @@ -120,7 +120,7 @@ struct LOADINGSCREEN_API FLoadingScreenThrobber FLoadingScreenThrobber(); /** Flag for showing the loading throbber if true, false will not show any throbber. */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (InlineEditConditionToggle)) + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") bool bShowThrobber; /** Decides which throbber type to show if true, false will not show any throbber. */ @@ -128,39 +128,39 @@ struct LOADINGSCREEN_API FLoadingScreenThrobber EThrobberLoadingType ThrobberType; /** Should throbber animate in opposite direction? Works for both regular and circular throbber */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (EditCondition = "bShowThrobber")) bool bFlipThrobberAnimation; /** The numbers of pieces in the throbber when it is shown */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (ClampMin = "1", ClampMax = "25")) + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (ClampMin = "1", ClampMax = "25", EditCondition = "bShowThrobber")) int NumPiecesThrobber; /** The image for each throbber piece */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (EditCondition = "bShowThrobber")) FSlateBrush ThrobberImage; /** The slot position of the throbber */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Throbber", meta = (EditCondition = "bShowThrobber")) FLoadingScreenSlotPosition ThrobberSlotPosition; /** Should the pieces animate horizontally? */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular", meta = (EditCondition = "bShowThrobber")) bool AnimateHorizontally; /** Should the pieces animate vertically? */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular", meta = (EditCondition = "bShowThrobber")) bool AnimateVertically; /** Should the pieces animate their opacity? */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Regular", meta = (EditCondition = "bShowThrobber")) bool AnimateOpacity; /** The amount of time for a full circle(in seconds) */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular", meta = (EditCondition = "bShowThrobber")) float ThrobberPeriod; /** The radius of the circle */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular") + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular", meta = (EditCondition = "bShowThrobber")) float ThrobberRadius; }; @@ -182,7 +182,11 @@ struct LOADINGSCREEN_API FLoadingScreenTips UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") FLoadingScreenSlotPosition SlotPosition; - /** The tips to display on the load screen. */ + /** The intended time between tips before it automatically switches to a new tip */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") + float TimeBetweenTips; + + /** The tips to display on the load screen */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips", meta =(MultiLine = "true")) TArray Tips; diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index d176e90..71064aa 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -224,7 +224,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr void SSimpleLoadingScreen::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) { - if ((InCurrentTime - LastToolTipUpdate) > 5.0f) + if ((InCurrentTime - LastToolTipUpdate) > ScreenDescriptionInfo.LoadingScreenTips.TimeBetweenTips) { LastToolTipUpdate = InCurrentTime; From e3c8538d69af7bec50c91c39a8fcbd3cf7fb62e8 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Thu, 23 May 2019 22:02:57 -0500 Subject: [PATCH 03/14] Update Cleanup Cleaned up --- .../Private/LoadingScreenModule.cpp | 26 ++++--- .../Private/LoadingScreenSettings.cpp | 7 +- .../Private/LoadingScreenSettings.h | 12 ++-- .../Private/SSimpleLoadingScreen.cpp | 69 ++++++++++++++----- .../Private/SSimpleLoadingScreen.h | 10 +-- 5 files changed, 85 insertions(+), 39 deletions(-) diff --git a/Source/LoadingScreen/Private/LoadingScreenModule.cpp b/Source/LoadingScreen/Private/LoadingScreenModule.cpp index b5c0ac3..3642813 100644 --- a/Source/LoadingScreen/Private/LoadingScreenModule.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenModule.cpp @@ -68,7 +68,7 @@ void FLoadingScreenModule::ShutdownModule() { if ( !IsRunningDedicatedServer() ) { - if (WidgetLoadingScreen.IsValid()) + if (WidgetLoadingScreen) { WidgetLoadingScreen.Reset(); } @@ -94,7 +94,7 @@ void FLoadingScreenModule::HandleMovieClipFinished(const FString & FinishedClip) GetMoviePlayer()->OnMovieClipFinished().RemoveAll(this); // Show the loading screen widget - if (WidgetLoadingScreen.IsValid()) + if (WidgetLoadingScreen) { WidgetLoadingScreen->HandleMoviesFinishedPlaying(); } @@ -102,7 +102,7 @@ void FLoadingScreenModule::HandleMovieClipFinished(const FString & FinishedClip) void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& ScreenDescription) { - if (WidgetLoadingScreen.IsValid()) + if (WidgetLoadingScreen) { WidgetLoadingScreen.Reset(); } @@ -116,12 +116,15 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S LoadingScreen.PlaybackType = ScreenDescription.PlaybackType; - // Create and store widget - WidgetLoadingScreen = SNew(SSimpleLoadingScreen, ScreenDescription) - .bShowThrobber(ScreenDescription.Throbber.bShowThrobber) - .ThrobberType(ScreenDescription.Throbber.ThrobberType) - ; - LoadingScreen.WidgetLoadingScreen = WidgetLoadingScreen; + if (ScreenDescription.bShowWidget) + { + // Create and store widget + WidgetLoadingScreen = SNew(SSimpleLoadingScreen, ScreenDescription) + .bShowThrobber(ScreenDescription.Throbber.bShowThrobber) + .ThrobberType(ScreenDescription.Throbber.ThrobberType) + ; + LoadingScreen.WidgetLoadingScreen = WidgetLoadingScreen; + } // Incase we have no movie paths, this will force it to show the loading screen anyway if (LoadingScreen.MoviePaths.Num() == 0) @@ -129,7 +132,10 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S // Forces the movie player to create a movie streamer to actually show the widget and such LoadingScreen.MoviePaths.Add(""); - WidgetLoadingScreen->HandleMoviesFinishedPlaying(); + if (WidgetLoadingScreen) + { + WidgetLoadingScreen->HandleMoviesFinishedPlaying(); + } } // If we have movies to show, then setup what happens if we're supposed to show ui otherwise skip this else diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp index 334696e..d5ed40c 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp @@ -48,15 +48,16 @@ FLoadingScreenThrobber::FLoadingScreenThrobber() FLoadingScreenTips::FLoadingScreenTips() : SlotText(FLoadingScreenSlotText()) , SlotPosition(FLoadingScreenSlotPosition()) - , TimeBetweenTips(10.0f) + , TimeBetweenTips(0) { } FLoadingScreenDescription::FLoadingScreenDescription() - : MinimumLoadingScreenDisplayTime(-1.0f) + : bShowWidget(true) + , MinimumLoadingScreenDisplayTime(-1.0f) , bAutoCompleteWhenLoadingCompletes(true) , bMoviesAreSkippable(true) , bWaitForManualStop(false) - , bShowUIOverlay(true) + , bShowUiOverlay(true) , bShowUiAfterMovies(true) , Throbber(FLoadingScreenThrobber()) , LoadingScreenText(FLoadingScreenText()) diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.h b/Source/LoadingScreen/Private/LoadingScreenSettings.h index f6cda4b..bc003cc 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.h +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.h @@ -182,9 +182,9 @@ struct LOADINGSCREEN_API FLoadingScreenTips UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") FLoadingScreenSlotPosition SlotPosition; - /** The intended time between tips before it automatically switches to a new tip */ - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips") - float TimeBetweenTips; + /** The intended time between tips before it automatically switches to a new tip, anything below zero will cause the tips to not change. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips", meta = (ClampMin = "0")) + int TimeBetweenTips; // Using an integer because letting people be able to get it really low might be bad... /** The tips to display on the load screen */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tips", meta =(MultiLine = "true")) @@ -201,6 +201,10 @@ struct LOADINGSCREEN_API FLoadingScreenDescription FLoadingScreenDescription(); + /** Flag for showing any ui elements and images if true(incase you only want to show movies and thats it then set this to false) */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Loading") + bool bShowWidget; + /** The minimum time that a loading screen should be opened for, -1 if there is no minimum time. */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|Loading") float MinimumLoadingScreenDisplayTime; @@ -227,7 +231,7 @@ struct LOADINGSCREEN_API FLoadingScreenDescription /** Should we show the throbber/loading text etc? Generally you'll want to set this to false if you just want to show a movie. This will render over any movie/background image. */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI") - bool bShowUIOverlay; + bool bShowUiOverlay; /** Flag for showing UI after all movies have been played successfully if true. False will show during movies. */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Screens|UI", meta = (EditCondition = "bShowUIOverlay")) diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index 71064aa..1a6217a 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -42,7 +42,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr ScreenDescriptionInfo = InScreenDescription; // Only show on construct if UI is true and we're not showing it after movies - const bool bShowUiOnConstruct = (ScreenDescriptionInfo.bShowUIOverlay && !ScreenDescriptionInfo.bShowUiAfterMovies); + const bool bShowUiOnConstruct = (ScreenDescriptionInfo.bShowUiOverlay && !ScreenDescriptionInfo.bShowUiAfterMovies); bShowThrobber = InArgs._bShowThrobber; ThrobberType = InArgs._ThrobberType; @@ -114,11 +114,14 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr } } - // Handles flipping the widget if needed - ThrobberWidget->SetRenderTransformPivot(FVector2D(0.5f, 0.5f)); - const float ThrobberScale = (float)((ScreenDescriptionInfo.Throbber.bFlipThrobberAnimation) ? -1 : 1); - ThrobberWidget->SetRenderTransform(FSlateRenderTransform(FScale2D(ThrobberScale, 1.0f))); - ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + if (ThrobberWidget) + { + // Handles flipping the widget if needed + ThrobberWidget->SetRenderTransformPivot(FVector2D(0.5f, 0.5f)); + const float ThrobberScale = (float)((ScreenDescriptionInfo.Throbber.bFlipThrobberAnimation) ? -1 : 1); + ThrobberWidget->SetRenderTransform(FSlateRenderTransform(FScale2D(ThrobberScale, 1.0f))); + ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } } // Handles creating the tip text widget @@ -224,15 +227,24 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr void SSimpleLoadingScreen::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) { - if ((InCurrentTime - LastToolTipUpdate) > ScreenDescriptionInfo.LoadingScreenTips.TimeBetweenTips) + const int TipDelay = ScreenDescriptionInfo.LoadingScreenTips.TimeBetweenTips; + + // Dont continue if the delay time is at zero + if (TipDelay == 0) { + return; + } + // If the time between now and last tooltip update is longer than the intended delay + else if ((InCurrentTime - LastToolTipUpdate) > TipDelay) + { + // Record the time LastToolTipUpdate = InCurrentTime; - // Safety check that it is a textblock and not something else - if (CurrentToolTipWidget->GetType() == "STextBlock") + // Valid check + if (CurrentToolTipWidget) { - STextBlock* TextBlock = static_cast(&CurrentToolTipWidget.ToSharedRef().Get()); - TextBlock->SetText(GetRandomToolTip()); + // Update the text to a new random tool tip + CurrentToolTipWidget->SetText(GetRandomToolTip()); } } } @@ -242,19 +254,41 @@ void SSimpleLoadingScreen::HandleMoviesFinishedPlaying() // Show the background if we're allowed to if (ScreenDescriptionInfo.bShowImagesAfterMovies) { - BackgroundImageWidget->SetVisibility(EVisibility::SelfHitTestInvisible); + if (BackgroundImageWidget) + { + BackgroundImageWidget->SetVisibility(EVisibility::SelfHitTestInvisible); + } } // Show ui elements if we're showing ui and we can show it after movies - if (ScreenDescriptionInfo.bShowUiAfterMovies && ScreenDescriptionInfo.bShowUIOverlay) + if (ScreenDescriptionInfo.bShowUiAfterMovies && ScreenDescriptionInfo.bShowUiOverlay) { - ThrobberWidget->SetVisibility(ScreenDescriptionInfo.Throbber.bShowThrobber ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + if (ThrobberWidget) + { + ThrobberWidget->SetVisibility(ScreenDescriptionInfo.Throbber.bShowThrobber + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } - LoadingTextWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenText.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + if (LoadingTextWidget) + { + LoadingTextWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenText.SlotText.bShouldShowText + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } + + if (DescriptionTextWidget) + { + DescriptionTextWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.bShouldShowText + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } - DescriptionTextWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + if (CurrentToolTipWidget) + { + // Reset the time so incase if when we're visible its not shorter than its supposed to be + LastToolTipUpdate = FSlateApplication::Get().GetCurrentTime(); - CurrentToolTipWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + CurrentToolTipWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + } } } @@ -267,7 +301,6 @@ float SSimpleLoadingScreen::GetDPIScale() const FText SSimpleLoadingScreen::GetRandomToolTip() { - // Decides a random tip to show { const int32 Total = ScreenDescriptionInfo.LoadingScreenTips.Tips.Num(); diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.h b/Source/LoadingScreen/Private/SSimpleLoadingScreen.h index 5493cab..e3082b3 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.h +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.h @@ -7,6 +7,8 @@ #include "LoadingScreenSettings.h" class FDeferredCleanupSlateBrush; +class STextBlock; +class SImage; class SSimpleLoadingScreen : public SCompoundWidget { @@ -43,11 +45,11 @@ class SSimpleLoadingScreen : public SCompoundWidget double LastToolTipUpdate; int CurrentToolTipIndex; - TSharedPtr CurrentToolTipWidget = SNullWidget::NullWidget; - TSharedPtr LoadingTextWidget = SNullWidget::NullWidget; - TSharedPtr DescriptionTextWidget = SNullWidget::NullWidget; + TSharedPtr CurrentToolTipWidget; + TSharedPtr LoadingTextWidget; + TSharedPtr DescriptionTextWidget; TSharedPtr ThrobberWidget = SNullWidget::NullWidget; - TSharedPtr BackgroundImageWidget = SNullWidget::NullWidget; + TSharedPtr BackgroundImageWidget; FLoadingScreenDescription ScreenDescriptionInfo; }; From fc36f3898f152f715fb7b1df6cd2da311dc8b206 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Fri, 24 May 2019 10:57:08 -0500 Subject: [PATCH 04/14] Fixed startup crash Fixed crash where slate application was not valid on startup, replaced it with FPlatformTime. --- .../Private/LoadingScreenModule.cpp | 18 +++++++++++------- .../Private/SSimpleLoadingScreen.cpp | 17 ++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Source/LoadingScreen/Private/LoadingScreenModule.cpp b/Source/LoadingScreen/Private/LoadingScreenModule.cpp index 3642813..bc42dd1 100644 --- a/Source/LoadingScreen/Private/LoadingScreenModule.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenModule.cpp @@ -126,16 +126,12 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S LoadingScreen.WidgetLoadingScreen = WidgetLoadingScreen; } + bool IsPlayingValidMovies = LoadingScreen.MoviePaths.Num() != 0; // Incase we have no movie paths, this will force it to show the loading screen anyway - if (LoadingScreen.MoviePaths.Num() == 0) + if (!IsPlayingValidMovies) { // Forces the movie player to create a movie streamer to actually show the widget and such - LoadingScreen.MoviePaths.Add(""); - - if (WidgetLoadingScreen) - { - WidgetLoadingScreen->HandleMoviesFinishedPlaying(); - } + LoadingScreen.MoviePaths.Add(""); } // If we have movies to show, then setup what happens if we're supposed to show ui otherwise skip this else @@ -148,6 +144,14 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S // This happens last after everything has been prepared ahead of time GetMoviePlayer()->SetupLoadingScreen(LoadingScreen); + + if (!IsPlayingValidMovies) + { + if (WidgetLoadingScreen) + { + WidgetLoadingScreen->HandleMoviesFinishedPlaying(); + } + } } diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index 1a6217a..8319df8 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -114,14 +114,11 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr } } - if (ThrobberWidget) - { // Handles flipping the widget if needed ThrobberWidget->SetRenderTransformPivot(FVector2D(0.5f, 0.5f)); const float ThrobberScale = (float)((ScreenDescriptionInfo.Throbber.bFlipThrobberAnimation) ? -1 : 1); ThrobberWidget->SetRenderTransform(FSlateRenderTransform(FScale2D(ThrobberScale, 1.0f))); - ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); - } + ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); } // Handles creating the tip text widget @@ -138,7 +135,8 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr .Justification(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextJustification) .Text(ScreenDescriptionInfo.LoadingScreenTips.Tips[CurrentToolTipIndex]); - LastToolTipUpdate = FSlateApplication::Get().GetCurrentTime(); + LastToolTipUpdate = FPlatformTime::Seconds(); + } // Construct Description Text @@ -226,7 +224,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr } void SSimpleLoadingScreen::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) -{ +{ const int TipDelay = ScreenDescriptionInfo.LoadingScreenTips.TimeBetweenTips; // Dont continue if the delay time is at zero @@ -282,9 +280,10 @@ void SSimpleLoadingScreen::HandleMoviesFinishedPlaying() } if (CurrentToolTipWidget) - { + { // Reset the time so incase if when we're visible its not shorter than its supposed to be - LastToolTipUpdate = FSlateApplication::Get().GetCurrentTime(); + LastToolTipUpdate = FPlatformTime::Seconds(); + CurrentToolTipWidget->SetVisibility(ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); @@ -301,7 +300,7 @@ float SSimpleLoadingScreen::GetDPIScale() const FText SSimpleLoadingScreen::GetRandomToolTip() { - // Decides a random tip to show + // Decides a random tip to show thats not the current tooltip { const int32 Total = ScreenDescriptionInfo.LoadingScreenTips.Tips.Num(); int32 RandomTip = FMath::RandRange(0, Total - 1); From b299069dbfcebeb0cb1640cdf03d7abc6c75b12f Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Fri, 24 May 2019 11:00:48 -0500 Subject: [PATCH 05/14] Added const correctness Constant for a boolean that isnt getting changed anywhere else --- Source/LoadingScreen/Private/LoadingScreenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/LoadingScreen/Private/LoadingScreenModule.cpp b/Source/LoadingScreen/Private/LoadingScreenModule.cpp index bc42dd1..c5bfcaf 100644 --- a/Source/LoadingScreen/Private/LoadingScreenModule.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenModule.cpp @@ -126,7 +126,7 @@ void FLoadingScreenModule::BeginLoadingScreen(const FLoadingScreenDescription& S LoadingScreen.WidgetLoadingScreen = WidgetLoadingScreen; } - bool IsPlayingValidMovies = LoadingScreen.MoviePaths.Num() != 0; + const bool IsPlayingValidMovies = LoadingScreen.MoviePaths.Num() != 0; // Incase we have no movie paths, this will force it to show the loading screen anyway if (!IsPlayingValidMovies) { From 03dd475931d606f045b873d386f76590c0f97bbf Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Mon, 27 May 2019 10:39:18 -0500 Subject: [PATCH 06/14] Fixed crash from tooltips Fixed crash from tooltips not having any to display. Where the widget was not created when it should have been --- .../Private/SSimpleLoadingScreen.cpp | 85 ++++++++++--------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index 8319df8..252ac4c 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -26,8 +26,7 @@ // SSimpleLoadingScreen static float PointSizeToSlateUnits(float PointSize) -{ - //FreeTypeConstants::HorizontalDPI = 96; +{ const float SlateFreeTypeHorizontalResolutionDPI = 96.0f; const float FreeTypeNativeDPI = 72.0f; const float PixelSize = PointSize * (SlateFreeTypeHorizontalResolutionDPI / FreeTypeNativeDPI); @@ -86,10 +85,7 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr { case EThrobberLoadingType::TLT_Circular: { - // Old comment information may be of use in the future - // Convert font size to pixels, pixel_size = point_size * resolution / 72, then half it to get radius - // (Settings->LoadingFont.Size * 96.0f / 72.0f) / 2.0f - + // Construct circular throbber ThrobberWidget = SNew(SCircularThrobber) .Radius(ScreenDescriptionInfo.Throbber.ThrobberRadius) .Period(ScreenDescriptionInfo.Throbber.ThrobberPeriod) @@ -100,12 +96,13 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr case EThrobberLoadingType::TLT_Regular: default: { + // Decide which animation to play for regular throbber const int32 AnimationParams = (ScreenDescriptionInfo.Throbber.AnimateVertically ? SThrobber::Vertical : 0) | (ScreenDescriptionInfo.Throbber.AnimateHorizontally ? SThrobber::Horizontal : 0) | (ScreenDescriptionInfo.Throbber.AnimateOpacity ? SThrobber::Opacity : 0); - const SThrobber::EAnimation Animation = static_cast(AnimationParams); + // Construct regular throbber ThrobberWidget = SNew(SThrobber) .Animate(Animation) .NumPieces(ScreenDescriptionInfo.Throbber.NumPiecesThrobber) @@ -118,49 +115,52 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr ThrobberWidget->SetRenderTransformPivot(FVector2D(0.5f, 0.5f)); const float ThrobberScale = (float)((ScreenDescriptionInfo.Throbber.bFlipThrobberAnimation) ? -1 : 1); ThrobberWidget->SetRenderTransform(FSlateRenderTransform(FScale2D(ThrobberScale, 1.0f))); + // Show throbber if allowed ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); } + // Construct tooltip widget + CurrentToolTipWidget = SNew(STextBlock) + .Visibility(EVisibility::Hidden) // Default to hidden just incase + .WrapTextAt(ScreenDescriptionInfo.LoadingScreenTips.SlotText.WrapAt) + .Font(ScreenDescriptionInfo.LoadingScreenTips.SlotText.Font) + .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextColor) + .Justification(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextJustification); + // Handles creating the tip text widget if (ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() > 0) { + // Decide tool tip to show CurrentToolTipIndex = FMath::RandRange(0, ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() - 1); - CurrentToolTipWidget = SNew(STextBlock) - .Visibility((ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText && bShowUiOnConstruct) - ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden) - .WrapTextAt(ScreenDescriptionInfo.LoadingScreenTips.SlotText.WrapAt) - .Font(ScreenDescriptionInfo.LoadingScreenTips.SlotText.Font) - .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextColor) - .Justification(ScreenDescriptionInfo.LoadingScreenTips.SlotText.TextJustification) - .Text(ScreenDescriptionInfo.LoadingScreenTips.Tips[CurrentToolTipIndex]); - - LastToolTipUpdate = FPlatformTime::Seconds(); + // Update the text + CurrentToolTipWidget->SetText(ScreenDescriptionInfo.LoadingScreenTips.Tips[CurrentToolTipIndex]); + // Show tooltip widget if allowed + CurrentToolTipWidget->SetVisibility((ScreenDescriptionInfo.LoadingScreenTips.SlotText.bShouldShowText && bShowUiOnConstruct) + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + // For deciding the time between tooltips + LastToolTipUpdate = FPlatformTime::Seconds(); } // Construct Description Text - { - DescriptionTextWidget = SNew(STextBlock) - .Text(ScreenDescriptionInfo.LoadingScreenDescription.Text) - .Font(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.Font) - .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.TextColor) - .Justification(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.TextJustification) - .WrapTextAt(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.WrapAt) - .Visibility((ScreenDescriptionInfo.LoadingScreenDescription.SlotText.bShouldShowText && bShowUiOnConstruct) - ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); - } - - // Construct Loading text - { - LoadingTextWidget = SNew(STextBlock) - .Text(ScreenDescriptionInfo.LoadingScreenText.Text) - .Font(ScreenDescriptionInfo.LoadingScreenText.SlotText.Font) - .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenText.SlotText.TextColor) - .Justification(ScreenDescriptionInfo.LoadingScreenText.SlotText.TextJustification) - .Visibility((ScreenDescriptionInfo.LoadingScreenText.SlotText.bShouldShowText && bShowUiOnConstruct) - ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); - } + DescriptionTextWidget = SNew(STextBlock) + .Text(ScreenDescriptionInfo.LoadingScreenDescription.Text) + .Font(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.Font) + .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.TextColor) + .Justification(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.TextJustification) + .WrapTextAt(ScreenDescriptionInfo.LoadingScreenDescription.SlotText.WrapAt) + .Visibility((ScreenDescriptionInfo.LoadingScreenDescription.SlotText.bShouldShowText && bShowUiOnConstruct) + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); + + // Construct Loading text + LoadingTextWidget = SNew(STextBlock) + .Text(ScreenDescriptionInfo.LoadingScreenText.Text) + .Font(ScreenDescriptionInfo.LoadingScreenText.SlotText.Font) + .ColorAndOpacity(ScreenDescriptionInfo.LoadingScreenText.SlotText.TextColor) + .Justification(ScreenDescriptionInfo.LoadingScreenText.SlotText.TextJustification) + .Visibility((ScreenDescriptionInfo.LoadingScreenText.SlotText.bShouldShowText && bShowUiOnConstruct) + ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); // Adds a slot to the root of this widget to allow for other widgets to be added to it, renders over image/movie Root->AddSlot() @@ -225,6 +225,12 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr void SSimpleLoadingScreen::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) { + // Dont continue if we only have 1 tip to show + if (ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() == 1) + { + return; + } + const int TipDelay = ScreenDescriptionInfo.LoadingScreenTips.TimeBetweenTips; // Dont continue if the delay time is at zero @@ -279,7 +285,8 @@ void SSimpleLoadingScreen::HandleMoviesFinishedPlaying() ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); } - if (CurrentToolTipWidget) + // Only show tooltip widget if we have any tips to show + if (CurrentToolTipWidget && ScreenDescriptionInfo.LoadingScreenTips.Tips.Num() != 0) { // Reset the time so incase if when we're visible its not shorter than its supposed to be LastToolTipUpdate = FPlatformTime::Seconds(); From 569bcdd5784cadf9adaef94b646750e82d7693f3 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Tue, 28 May 2019 12:24:37 -0500 Subject: [PATCH 07/14] Added image support for throbber An image(or material) can be used in place of a throbber --- .../Private/LoadingScreenSettings.cpp | 2 ++ .../Private/LoadingScreenSettings.h | 14 ++++++++- .../Private/SSimpleLoadingScreen.cpp | 31 ++++++++++++++++--- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp index d5ed40c..7aefef3 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp @@ -43,6 +43,8 @@ FLoadingScreenThrobber::FLoadingScreenThrobber() , AnimateOpacity(true) , ThrobberPeriod(0.75f) , ThrobberRadius(16.0f) + , ImageBrush(*FCoreStyle::Get().GetDefaultBrush()) + , ImageColorAndOpacity(FLinearColor::White) { } FLoadingScreenTips::FLoadingScreenTips() diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.h b/Source/LoadingScreen/Private/LoadingScreenSettings.h index bc003cc..7b176cf 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.h +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.h @@ -15,8 +15,12 @@ UENUM(BlueprintType) enum class EThrobberLoadingType : uint8 { + /** Uses a regular throbber to indicate loading */ TLT_Regular UMETA(DisplayName = "Regular"), - TLT_Circular UMETA(DisplayName = "Circular") + /** Uses a circular throbber to indicate loading */ + TLT_Circular UMETA(DisplayName = "Circular"), + /** Uses an image instead of a throbber type incase you want to use an image with a material or something to indicate loading */ + TLT_Image UMETA(DisplayName = "Image") }; USTRUCT(BlueprintType) @@ -163,6 +167,14 @@ struct LOADINGSCREEN_API FLoadingScreenThrobber UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Circular", meta = (EditCondition = "bShowThrobber")) float ThrobberRadius; + /** Image to draw (adjust image size here to adjust the size in X and Y) */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Image", meta = (EditCondition = "bShowThrobber")) + FSlateBrush ImageBrush; + + /** Color and opacity */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Image", meta = (EditCondition = "bShowThrobber", sRGB = "true")) + FLinearColor ImageColorAndOpacity; + }; USTRUCT(BlueprintType) diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index 252ac4c..568f202 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -86,15 +86,16 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr case EThrobberLoadingType::TLT_Circular: { // Construct circular throbber - ThrobberWidget = SNew(SCircularThrobber) + TSharedPtr ConstructedThrobber = SNew(SCircularThrobber) .Radius(ScreenDescriptionInfo.Throbber.ThrobberRadius) .Period(ScreenDescriptionInfo.Throbber.ThrobberPeriod) .NumPieces(ScreenDescriptionInfo.Throbber.NumPiecesThrobber) .PieceImage(&ScreenDescriptionInfo.Throbber.ThrobberImage); + + ThrobberWidget = ConstructedThrobber; break; } - case EThrobberLoadingType::TLT_Regular: - default: + case EThrobberLoadingType::TLT_Regular: { // Decide which animation to play for regular throbber const int32 AnimationParams = (ScreenDescriptionInfo.Throbber.AnimateVertically ? SThrobber::Vertical : 0) | @@ -103,18 +104,38 @@ void SSimpleLoadingScreen::Construct(const FArguments& InArgs, const FLoadingScr const SThrobber::EAnimation Animation = static_cast(AnimationParams); // Construct regular throbber - ThrobberWidget = SNew(SThrobber) + TSharedPtr ConstructedThrobber = SNew(SThrobber) .Animate(Animation) .NumPieces(ScreenDescriptionInfo.Throbber.NumPiecesThrobber) .PieceImage(&ScreenDescriptionInfo.Throbber.ThrobberImage); + + ThrobberWidget = ConstructedThrobber; + break; + } + case EThrobberLoadingType::TLT_Image: + default: + { + // Setup image to show + const FSlateBrush* ImageBrush = &ScreenDescriptionInfo.Throbber.ImageBrush; + + // Construct an image in place of throbber + TSharedPtr ConstructedImage = SNew(SImage) + .Image(ImageBrush) + .ColorAndOpacity(ScreenDescriptionInfo.Throbber.ImageColorAndOpacity); + + ThrobberWidget = ConstructedImage; break; } } - // Handles flipping the widget if needed + // Only adjust the the scaling if we're not using an image + if (ThrobberType != EThrobberLoadingType::TLT_Image) + { + // Handles flipping the throbber if needed ThrobberWidget->SetRenderTransformPivot(FVector2D(0.5f, 0.5f)); const float ThrobberScale = (float)((ScreenDescriptionInfo.Throbber.bFlipThrobberAnimation) ? -1 : 1); ThrobberWidget->SetRenderTransform(FSlateRenderTransform(FScale2D(ThrobberScale, 1.0f))); + } // Show throbber if allowed ThrobberWidget->SetVisibility((bShowThrobber && bShowUiOnConstruct) ? EVisibility::SelfHitTestInvisible : EVisibility::Hidden); } From 87dfe51047737ed39ecf26da0d8f1aab89a77407 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Sun, 18 Aug 2019 21:34:00 -0500 Subject: [PATCH 08/14] Fixed Include paths to account for wherever module is Just an ease of use thing that fixes any warning or issues where it cannot find the public/private include paths when compiling from source. --- Source/LoadingScreen/LoadingScreen.Build.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/LoadingScreen/LoadingScreen.Build.cs b/Source/LoadingScreen/LoadingScreen.Build.cs index 0742db4..94bbbaf 100644 --- a/Source/LoadingScreen/LoadingScreen.Build.cs +++ b/Source/LoadingScreen/LoadingScreen.Build.cs @@ -9,9 +9,10 @@ public LoadingScreen(ReadOnlyTargetRules Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; - PrivateIncludePaths.Add("LoadingScreen/Private"); + PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public")); + PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private")); - PublicDependencyModuleNames.AddRange( + PublicDependencyModuleNames.AddRange( new string[] { "Core", From 573ee955fdb5546e415d3bdda36d1a8d97b3d2e6 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Sun, 18 Aug 2019 21:47:07 -0500 Subject: [PATCH 09/14] Forgot to include the proper libraries Fixed system.io library not being included, formatted file to be with the way build files for unreal are currently formatted and setup --- Source/LoadingScreen/LoadingScreen.Build.cs | 48 +++++++++++---------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/Source/LoadingScreen/LoadingScreen.Build.cs b/Source/LoadingScreen/LoadingScreen.Build.cs index 94bbbaf..78aec13 100644 --- a/Source/LoadingScreen/LoadingScreen.Build.cs +++ b/Source/LoadingScreen/LoadingScreen.Build.cs @@ -1,28 +1,32 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. -namespace UnrealBuildTool.Rules +using UnrealBuildTool; +using System.IO; + +public class LoadingScreen : ModuleRules { - public class LoadingScreen : ModuleRules - { - public LoadingScreen(ReadOnlyTargetRules Target) - : base(Target) - { - PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + public LoadingScreen(ReadOnlyTargetRules Target) + : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public")); + PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private")); - PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public")); - PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private")); + PublicDependencyModuleNames.AddRange( + new string[] { + "Core", + }); - PublicDependencyModuleNames.AddRange( - new string[] - { - "Core", - "CoreUObject", - "MoviePlayer", - "Slate", - "SlateCore", - "InputCore", - "Engine" - }); - } - } + PrivateDependencyModuleNames.AddRange( + new string[] { + "CoreUObject", + "MoviePlayer", + "Slate", + "SlateCore", + "InputCore", + "Engine" + }); + } } + From 65135f230ebdd9dbc498237d2469af20e20227d3 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Mon, 9 Sep 2019 22:09:21 -0500 Subject: [PATCH 10/14] Add function library and added the ability to get and set the loading screen settings --- .../Private/LoadingScreenFunctionLibrary.cpp | 20 +++++++++++ .../Public/LoadingScreenFunctionLibrary.h | 35 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 Source/LoadingScreen/Private/LoadingScreenFunctionLibrary.cpp create mode 100644 Source/LoadingScreen/Public/LoadingScreenFunctionLibrary.h diff --git a/Source/LoadingScreen/Private/LoadingScreenFunctionLibrary.cpp b/Source/LoadingScreen/Private/LoadingScreenFunctionLibrary.cpp new file mode 100644 index 0000000..190eb77 --- /dev/null +++ b/Source/LoadingScreen/Private/LoadingScreenFunctionLibrary.cpp @@ -0,0 +1,20 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "LoadingScreenFunctionLibrary.h" + + +FLoadingScreenDescription ULoadingScreenFunctionLibrary::GetStartupLoadingScreen() +{ + return GetDefault()->StartupScreen; +} + +FLoadingScreenDescription ULoadingScreenFunctionLibrary::GetDefaultLoadingScreen() +{ + return GetDefault()->DefaultScreen; +} + +void ULoadingScreenFunctionLibrary::SetLoadingScreen(FLoadingScreenDescription InDescription) +{ + GetMutableDefault()->DefaultScreen = InDescription; +} diff --git a/Source/LoadingScreen/Public/LoadingScreenFunctionLibrary.h b/Source/LoadingScreen/Public/LoadingScreenFunctionLibrary.h new file mode 100644 index 0000000..0c24cfc --- /dev/null +++ b/Source/LoadingScreen/Public/LoadingScreenFunctionLibrary.h @@ -0,0 +1,35 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "LoadingScreenSettings.h" +#include "LoadingScreenFunctionLibrary.generated.h" + +/** + * + */ +UCLASS() +class LOADINGSCREEN_API ULoadingScreenFunctionLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + +public: + + /** Returns the startup loading screen settings */ + UFUNCTION(BlueprintPure, Category = "Loading Screen") + static FLoadingScreenDescription GetStartupLoadingScreen(); + + /** Returns the current default loading screen settings. */ + UFUNCTION(BlueprintPure, Category = "Loading Screen") + static FLoadingScreenDescription GetDefaultLoadingScreen(); + + /** + * Sets the current default loading screen settings to InDescription. + * NOTE: This by default does not save those changes so when the application closes, it will reset those settings. + */ + UFUNCTION(BlueprintCallable, Category = "Loading Screen") + static void SetLoadingScreen(FLoadingScreenDescription InDescription); + +}; From 8c9ce033cccc75a7254048e2647cf27edca3189d Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Thu, 19 Sep 2019 01:45:28 -0500 Subject: [PATCH 11/14] Updated to 4.23 Let me know of any bugs :) --- LoadingScreen.uplugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LoadingScreen.uplugin b/LoadingScreen.uplugin index d120ee7..4767043 100644 --- a/LoadingScreen.uplugin +++ b/LoadingScreen.uplugin @@ -10,7 +10,7 @@ "CreatedByURL": "https://www.epicgames.com", "DocsURL": "https://github.com/ue4plugins/LoadingScreen", "SupportURL": "https://github.com/ue4plugins/LoadingScreen/issues", - "EngineVersion": "4.22", + "EngineVersion": "4.23", "EnabledByDefault": true, "CanContainContent": true, From 3860b0c01d314fc1dc96aaa9d3690f80e52db639 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Mon, 27 Jan 2020 14:39:43 -0600 Subject: [PATCH 12/14] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a897293..50438f7 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,11 @@ The LoadingScreen plug-in implements a module that allows you to configure a sim Loading Screen system in the engine. To goal is to make it more customizable over time to avoid needing to write a new loading screen manually. +This is based off of Nick Darnell's version of the plugin which you can find [HERE](https://github.com/ue4plugins/LoadingScreen) ## Supported Platforms -This plug-in was last built against **Unreal Engine 4.22**. It works on all platforms (probably). +This plug-in was last built against **Unreal Engine 4.23**. It works on all platforms (probably). ## Dependencies @@ -39,9 +40,9 @@ The plug-in configured to be enabled by default once it's in your game's plug-in **Note: This plugin is not supported by Epic Games.** -Please [file an issue](https://github.com/nickdarnell/LoadingScreen/issues), -submit a [pull request](https://github.com/nickdarnell/LoadingScreen/pulls?q=is%3Aopen+is%3Apr) -or hit me up on twitter [@NickDarnell](https://twitter.com/NickDarnell) +Please [file an issue](https://github.com/Oldsiren/LoadingScreen/issues), +submit a [pull request](https://github.com/Oldsiren/LoadingScreen/pulls) +or hit me up on twitter [@Oldsiren](https://twitter.com/oldsiren) ## References From 5b66f174ee63189728460a3bbb99157a94766992 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Mon, 13 Apr 2020 14:12:58 -0400 Subject: [PATCH 13/14] 4.24 Update --- LoadingScreen.uplugin | 2 +- Source/LoadingScreen/Private/LoadingScreenSettings.cpp | 2 +- Source/LoadingScreen/Private/LoadingScreenSettings.h | 6 +++--- Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp | 9 ++++----- Source/LoadingScreen/Private/SSimpleLoadingScreen.h | 4 ++-- Source/LoadingScreen/Public/ILoadingScreenModule.h | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/LoadingScreen.uplugin b/LoadingScreen.uplugin index 4767043..057ad33 100644 --- a/LoadingScreen.uplugin +++ b/LoadingScreen.uplugin @@ -10,7 +10,7 @@ "CreatedByURL": "https://www.epicgames.com", "DocsURL": "https://github.com/ue4plugins/LoadingScreen", "SupportURL": "https://github.com/ue4plugins/LoadingScreen/issues", - "EngineVersion": "4.23", + "EngineVersion": "4.24", "EnabledByDefault": true, "CanContainContent": true, diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp index 7aefef3..d6f0b5d 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.cpp +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.cpp @@ -1,7 +1,7 @@ // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #include "LoadingScreenSettings.h" -#include "CoreStyle.h" +#include "Styling/CoreStyle.h" #include "Engine/Font.h" #include "UObject/ConstructorHelpers.h" diff --git a/Source/LoadingScreen/Private/LoadingScreenSettings.h b/Source/LoadingScreen/Private/LoadingScreenSettings.h index 7b176cf..b93ca88 100644 --- a/Source/LoadingScreen/Private/LoadingScreenSettings.h +++ b/Source/LoadingScreen/Private/LoadingScreenSettings.h @@ -3,11 +3,11 @@ #pragma once #include "CoreMinimal.h" -#include "Anchors.h" +#include "Widgets/Layout/Anchors.h" #include "Fonts/SlateFontInfo.h" #include "MoviePlayer.h" -#include "SScaleBox.h" -#include "TextLayout.h" +#include "Widgets/Layout/SScaleBox.h" +#include "Framework/Text/TextLayout.h" #include "Engine/DeveloperSettings.h" #include "LoadingScreenSettings.generated.h" diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp index 568f202..d7e69ce 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.cpp @@ -3,7 +3,7 @@ #include "SSimpleLoadingScreen.h" #include "Slate/DeferredCleanupSlateBrush.h" -#include "SScaleBox.h" +#include "Widgets/Layout/SScaleBox.h" #include "Widgets/Images/SImage.h" #include "Widgets/Layout/SSpacer.h" #include "Widgets/SOverlay.h" @@ -12,10 +12,9 @@ #include "Widgets/Text/STextBlock.h" #include "Widgets/Layout/SBorder.h" #include "Widgets/Layout/SConstraintCanvas.h" -#include "SSafeZone.h" -#include "SThrobber.h" -#include "SDPIScaler.h" -#include "SlateApplication.h" +#include "Widgets/Layout/SSafeZone.h" +#include "Widgets/Images/SThrobber.h" +#include "Framework/Application/SlateApplication.h" #include "Engine/Texture2D.h" #include "Engine/Engine.h" #include "Engine/UserInterfaceSettings.h" diff --git a/Source/LoadingScreen/Private/SSimpleLoadingScreen.h b/Source/LoadingScreen/Private/SSimpleLoadingScreen.h index e3082b3..245e028 100644 --- a/Source/LoadingScreen/Private/SSimpleLoadingScreen.h +++ b/Source/LoadingScreen/Private/SSimpleLoadingScreen.h @@ -2,8 +2,8 @@ #pragma once -#include "SCompoundWidget.h" -#include "CoreStyle.h" +#include "SlateCore/Public/Widgets/SCompoundWidget.h" +#include "Styling/CoreStyle.h" #include "LoadingScreenSettings.h" class FDeferredCleanupSlateBrush; diff --git a/Source/LoadingScreen/Public/ILoadingScreenModule.h b/Source/LoadingScreen/Public/ILoadingScreenModule.h index b5b5294..55e2204 100644 --- a/Source/LoadingScreen/Public/ILoadingScreenModule.h +++ b/Source/LoadingScreen/Public/ILoadingScreenModule.h @@ -2,7 +2,7 @@ #pragma once -#include "ModuleManager.h" +#include "Modules/ModuleManager.h" /** * The public interface to this module From d6d39e5cedfed8437672d5faaae92377aa55ec30 Mon Sep 17 00:00:00 2001 From: Nicholas Helish Date: Sat, 16 May 2020 14:19:01 -0400 Subject: [PATCH 14/14] Remove engine specific line --- LoadingScreen.uplugin | 1 - 1 file changed, 1 deletion(-) diff --git a/LoadingScreen.uplugin b/LoadingScreen.uplugin index 057ad33..7abcc13 100644 --- a/LoadingScreen.uplugin +++ b/LoadingScreen.uplugin @@ -10,7 +10,6 @@ "CreatedByURL": "https://www.epicgames.com", "DocsURL": "https://github.com/ue4plugins/LoadingScreen", "SupportURL": "https://github.com/ue4plugins/LoadingScreen/issues", - "EngineVersion": "4.24", "EnabledByDefault": true, "CanContainContent": true,