You've already forked LuckyWorld
fixed build issues, added binaries, and updated the AsyncLoadingScreen plugin directory
This commit is contained in:
@ -1,55 +0,0 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class AsyncLoadingScreen : ModuleRules
|
||||
{
|
||||
public AsyncLoadingScreen(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add public include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateIncludePaths.AddRange(
|
||||
new string[] {
|
||||
// ... add other private include paths required here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PublicDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"Core"
|
||||
// ... add other public dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"Slate",
|
||||
"SlateCore",
|
||||
"MoviePlayer",
|
||||
"DeveloperSettings"
|
||||
// ... add private dependencies that you statically link with here ...
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
DynamicallyLoadedModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
// ... add any modules that your module loads dynamically here ...
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "AsyncLoadingScreen.h"
|
||||
#include "MoviePlayer.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "SCenterLayout.h"
|
||||
#include "SClassicLayout.h"
|
||||
#include "SLetterboxLayout.h"
|
||||
#include "SSidebarLayout.h"
|
||||
#include "SDualSidebarLayout.h"
|
||||
#include "Framework/Application/SlateApplication.h"
|
||||
#include "AsyncLoadingScreenLibrary.h"
|
||||
#include "Engine/Texture2D.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FAsyncLoadingScreenModule"
|
||||
|
||||
void FAsyncLoadingScreenModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
if (!IsRunningDedicatedServer() && FSlateApplication::IsInitialized())
|
||||
{
|
||||
const ULoadingScreenSettings* Settings = GetDefault<ULoadingScreenSettings>();
|
||||
|
||||
if (IsMoviePlayerEnabled())
|
||||
{
|
||||
GetMoviePlayer()->OnPrepareLoadingScreen().AddRaw(this, &FAsyncLoadingScreenModule::PreSetupLoadingScreen);
|
||||
}
|
||||
|
||||
// If PreloadBackgroundImages option is check, load all background images into memory
|
||||
if (Settings->bPreloadBackgroundImages)
|
||||
{
|
||||
LoadBackgroundImages();
|
||||
}
|
||||
|
||||
// Prepare the startup screen, the PreSetupLoadingScreen callback won't be called
|
||||
// if we've already explicitly setup the loading screen
|
||||
bIsStartupLoadingScreen = true;
|
||||
SetupLoadingScreen(Settings->StartupLoadingScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void FAsyncLoadingScreenModule::ShutdownModule()
|
||||
{
|
||||
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
||||
// we call this function before unloading the module.
|
||||
if (!IsRunningDedicatedServer())
|
||||
{
|
||||
// TODO: Unregister later
|
||||
GetMoviePlayer()->OnPrepareLoadingScreen().RemoveAll(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool FAsyncLoadingScreenModule::IsGameModule() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
TArray<UTexture2D*> FAsyncLoadingScreenModule::GetBackgroundImages()
|
||||
{
|
||||
return bIsStartupLoadingScreen ? StartupBackgroundImages : DefaultBackgroundImages;
|
||||
}
|
||||
|
||||
void FAsyncLoadingScreenModule::PreSetupLoadingScreen()
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("PreSetupLoadingScreen"));
|
||||
const bool bIsEnableLoadingScreen = UAsyncLoadingScreenLibrary::GetIsEnableLoadingScreen();
|
||||
if (bIsEnableLoadingScreen)
|
||||
{
|
||||
const ULoadingScreenSettings* Settings = GetDefault<ULoadingScreenSettings>();
|
||||
bIsStartupLoadingScreen = false;
|
||||
SetupLoadingScreen(Settings->DefaultLoadingScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void FAsyncLoadingScreenModule::SetupLoadingScreen(const FALoadingScreenSettings& LoadingScreenSettings)
|
||||
{
|
||||
TArray<FString> MoviesList = LoadingScreenSettings.MoviePaths;
|
||||
|
||||
// Shuffle the movies list
|
||||
if (LoadingScreenSettings.bShuffle == true)
|
||||
{
|
||||
ShuffleMovies(MoviesList);
|
||||
}
|
||||
|
||||
if (LoadingScreenSettings.bSetDisplayMovieIndexManually == true)
|
||||
{
|
||||
MoviesList.Empty();
|
||||
|
||||
// Show specific movie if valid otherwise show original movies list
|
||||
if (LoadingScreenSettings.MoviePaths.IsValidIndex(UAsyncLoadingScreenLibrary::GetDisplayMovieIndex()))
|
||||
{
|
||||
MoviesList.Add(LoadingScreenSettings.MoviePaths[UAsyncLoadingScreenLibrary::GetDisplayMovieIndex()]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoviesList = LoadingScreenSettings.MoviePaths;
|
||||
}
|
||||
}
|
||||
|
||||
FLoadingScreenAttributes LoadingScreen;
|
||||
LoadingScreen.MinimumLoadingScreenDisplayTime = LoadingScreenSettings.MinimumLoadingScreenDisplayTime;
|
||||
LoadingScreen.bAutoCompleteWhenLoadingCompletes = LoadingScreenSettings.bAutoCompleteWhenLoadingCompletes;
|
||||
LoadingScreen.bMoviesAreSkippable = LoadingScreenSettings.bMoviesAreSkippable;
|
||||
LoadingScreen.bWaitForManualStop = LoadingScreenSettings.bWaitForManualStop;
|
||||
LoadingScreen.bAllowInEarlyStartup = LoadingScreenSettings.bAllowInEarlyStartup;
|
||||
LoadingScreen.bAllowEngineTick = LoadingScreenSettings.bAllowEngineTick;
|
||||
LoadingScreen.MoviePaths = MoviesList;
|
||||
LoadingScreen.PlaybackType = LoadingScreenSettings.PlaybackType;
|
||||
|
||||
if (LoadingScreenSettings.bShowWidgetOverlay)
|
||||
{
|
||||
const ULoadingScreenSettings* Settings = GetDefault<ULoadingScreenSettings>();
|
||||
|
||||
switch (LoadingScreenSettings.Layout)
|
||||
{
|
||||
case EAsyncLoadingScreenLayout::ALSL_Classic:
|
||||
LoadingScreen.WidgetLoadingScreen = SNew(SClassicLayout, LoadingScreenSettings, Settings->Classic);
|
||||
break;
|
||||
case EAsyncLoadingScreenLayout::ALSL_Center:
|
||||
LoadingScreen.WidgetLoadingScreen = SNew(SCenterLayout, LoadingScreenSettings, Settings->Center);
|
||||
break;
|
||||
case EAsyncLoadingScreenLayout::ALSL_Letterbox:
|
||||
LoadingScreen.WidgetLoadingScreen = SNew(SLetterboxLayout, LoadingScreenSettings, Settings->Letterbox);
|
||||
break;
|
||||
case EAsyncLoadingScreenLayout::ALSL_Sidebar:
|
||||
LoadingScreen.WidgetLoadingScreen = SNew(SSidebarLayout, LoadingScreenSettings, Settings->Sidebar);
|
||||
break;
|
||||
case EAsyncLoadingScreenLayout::ALSL_DualSidebar:
|
||||
LoadingScreen.WidgetLoadingScreen = SNew(SDualSidebarLayout, LoadingScreenSettings, Settings->DualSidebar);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
|
||||
}
|
||||
|
||||
void FAsyncLoadingScreenModule::ShuffleMovies(TArray<FString>& MoviesList)
|
||||
{
|
||||
if (MoviesList.Num() > 0)
|
||||
{
|
||||
int32 LastIndex = MoviesList.Num() - 1;
|
||||
for (int32 i = 0; i <= LastIndex; ++i)
|
||||
{
|
||||
int32 Index = FMath::RandRange(i, LastIndex);
|
||||
if (i != Index)
|
||||
{
|
||||
MoviesList.Swap(i, Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FAsyncLoadingScreenModule::LoadBackgroundImages()
|
||||
{
|
||||
// Empty all background images array
|
||||
RemoveAllBackgroundImages();
|
||||
|
||||
const ULoadingScreenSettings* Settings = GetDefault<ULoadingScreenSettings>();
|
||||
|
||||
// Preload startup background images
|
||||
for (auto& Image : Settings->StartupLoadingScreen.Background.Images)
|
||||
{
|
||||
UTexture2D* LoadedImage = Cast<UTexture2D>(Image.TryLoad());
|
||||
if (LoadedImage)
|
||||
{
|
||||
StartupBackgroundImages.Add(LoadedImage);
|
||||
}
|
||||
}
|
||||
|
||||
// Preload default background images
|
||||
for (auto& Image : Settings->DefaultLoadingScreen.Background.Images)
|
||||
{
|
||||
UTexture2D* LoadedImage = Cast<UTexture2D> (Image.TryLoad());
|
||||
if (LoadedImage)
|
||||
{
|
||||
DefaultBackgroundImages.Add(LoadedImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FAsyncLoadingScreenModule::RemoveAllBackgroundImages()
|
||||
{
|
||||
StartupBackgroundImages.Empty();
|
||||
DefaultBackgroundImages.Empty();
|
||||
}
|
||||
|
||||
bool FAsyncLoadingScreenModule::IsPreloadBackgroundImagesEnabled()
|
||||
{
|
||||
return GetDefault<ULoadingScreenSettings>()->bPreloadBackgroundImages;
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
IMPLEMENT_MODULE(FAsyncLoadingScreenModule, AsyncLoadingScreen)
|
@ -1,64 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#include "AsyncLoadingScreenLibrary.h"
|
||||
#include "MoviePlayer.h"
|
||||
#include "AsyncLoadingScreen.h"
|
||||
|
||||
int32 UAsyncLoadingScreenLibrary::DisplayBackgroundIndex = -1;
|
||||
int32 UAsyncLoadingScreenLibrary::DisplayTipTextIndex = -1;
|
||||
int32 UAsyncLoadingScreenLibrary::DisplayMovieIndex = -1;
|
||||
bool UAsyncLoadingScreenLibrary::bShowLoadingScreen = true;
|
||||
|
||||
void UAsyncLoadingScreenLibrary::SetDisplayBackgroundIndex(int32 BackgroundIndex)
|
||||
{
|
||||
UAsyncLoadingScreenLibrary::DisplayBackgroundIndex = BackgroundIndex;
|
||||
}
|
||||
|
||||
void UAsyncLoadingScreenLibrary::SetDisplayTipTextIndex(int32 TipTextIndex)
|
||||
{
|
||||
UAsyncLoadingScreenLibrary::DisplayTipTextIndex = TipTextIndex;
|
||||
}
|
||||
|
||||
void UAsyncLoadingScreenLibrary::SetDisplayMovieIndex(int32 MovieIndex)
|
||||
{
|
||||
UAsyncLoadingScreenLibrary::DisplayMovieIndex = MovieIndex;
|
||||
}
|
||||
|
||||
void UAsyncLoadingScreenLibrary::SetEnableLoadingScreen(bool bIsEnableLoadingScreen)
|
||||
{
|
||||
bShowLoadingScreen = bIsEnableLoadingScreen;
|
||||
}
|
||||
|
||||
void UAsyncLoadingScreenLibrary::StopLoadingScreen()
|
||||
{
|
||||
GetMoviePlayer()->StopMovie();
|
||||
}
|
||||
|
||||
void UAsyncLoadingScreenLibrary::PreloadBackgroundImages()
|
||||
{
|
||||
if (FAsyncLoadingScreenModule::IsAvailable())
|
||||
{
|
||||
FAsyncLoadingScreenModule& LoadingScreenModule = FAsyncLoadingScreenModule::Get();
|
||||
if (LoadingScreenModule.IsPreloadBackgroundImagesEnabled())
|
||||
{
|
||||
LoadingScreenModule.LoadBackgroundImages();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UAsyncLoadingScreenLibrary::RemovePreloadedBackgroundImages()
|
||||
{
|
||||
if (FAsyncLoadingScreenModule::IsAvailable())
|
||||
{
|
||||
FAsyncLoadingScreenModule& LoadingScreenModule = FAsyncLoadingScreenModule::Get();
|
||||
LoadingScreenModule.RemoveAllBackgroundImages();
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
#include "Engine/Font.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "AsyncLoadingScreen"
|
||||
|
||||
FLoadingWidgetSettings::FLoadingWidgetSettings() : LoadingText(LOCTEXT("Loading", "LOADING")) {}
|
||||
//FLoadingCompleteTextSettings::FLoadingCompleteTextSettings() : LoadingCompleteText(LOCTEXT("Loading Complete", "Loading is complete! Press any key to continue...")) {}
|
||||
|
||||
|
||||
ULoadingScreenSettings::ULoadingScreenSettings(const FObjectInitializer& Initializer) : Super(Initializer)
|
||||
{
|
||||
StartupLoadingScreen.TipWidget.TipWrapAt = 1000.0f;
|
||||
StartupLoadingScreen.bShowWidgetOverlay = false;
|
||||
DefaultLoadingScreen.TipWidget.TipWrapAt = 1000.0f;
|
||||
// Set default font
|
||||
if (!IsRunningDedicatedServer())
|
||||
{
|
||||
static ConstructorHelpers::FObjectFinder<UFont> RobotoFontObj(TEXT("/Engine/EngineFonts/Roboto"));
|
||||
StartupLoadingScreen.TipWidget.Appearance.Font = FSlateFontInfo(RobotoFontObj.Object, 20, FName("Normal"));
|
||||
DefaultLoadingScreen.TipWidget.Appearance.Font = FSlateFontInfo(RobotoFontObj.Object, 20, FName("Normal"));
|
||||
StartupLoadingScreen.LoadingWidget.Appearance.Font = FSlateFontInfo(RobotoFontObj.Object, 32, FName("Bold"));
|
||||
DefaultLoadingScreen.LoadingWidget.Appearance.Font = FSlateFontInfo(RobotoFontObj.Object, 32, FName("Bold"));
|
||||
StartupLoadingScreen.LoadingCompleteTextSettings.Appearance.Font = FSlateFontInfo(RobotoFontObj.Object, 24, FName("Normal"));
|
||||
DefaultLoadingScreen.LoadingCompleteTextSettings.Appearance.Font = FSlateFontInfo(RobotoFontObj.Object, 24, FName("Normal"));
|
||||
}
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
|
@ -1,72 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SBackgroundWidget.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Slate/DeferredCleanupSlateBrush.h"
|
||||
#include "Widgets/Images/SImage.h"
|
||||
#include "Widgets/Layout/SBorder.h"
|
||||
#include "Engine/Texture2D.h"
|
||||
#include "AsyncLoadingScreenLibrary.h"
|
||||
#include "AsyncLoadingScreen.h"
|
||||
|
||||
void SBackgroundWidget::Construct(const FArguments& InArgs, const FBackgroundSettings& Settings)
|
||||
{
|
||||
// If there's an image defined
|
||||
if (Settings.Images.Num() > 0)
|
||||
{
|
||||
int32 ImageIndex = FMath::RandRange(0, Settings.Images.Num() - 1);
|
||||
|
||||
if (Settings.bSetDisplayBackgroundManually == true)
|
||||
{
|
||||
if (Settings.Images.IsValidIndex(UAsyncLoadingScreenLibrary::GetDisplayBackgroundIndex()))
|
||||
{
|
||||
ImageIndex = UAsyncLoadingScreenLibrary::GetDisplayBackgroundIndex();
|
||||
}
|
||||
}
|
||||
|
||||
// Load background from settings
|
||||
UTexture2D* LoadingImage = nullptr;
|
||||
const FSoftObjectPath& ImageAsset = Settings.Images[ImageIndex];
|
||||
UObject* ImageObject = ImageAsset.TryLoad();
|
||||
LoadingImage = Cast<UTexture2D>(ImageObject);
|
||||
|
||||
// If IsPreloadBackgroundImagesEnabled is enabled, load from images array
|
||||
FAsyncLoadingScreenModule& LoadingScreenModule = FAsyncLoadingScreenModule::Get();
|
||||
if (LoadingScreenModule.IsPreloadBackgroundImagesEnabled())
|
||||
{
|
||||
TArray<UTexture2D*> BackgroundImages = LoadingScreenModule.GetBackgroundImages();
|
||||
if (!BackgroundImages.IsEmpty() && BackgroundImages.IsValidIndex(ImageIndex))
|
||||
{
|
||||
LoadingImage = BackgroundImages[ImageIndex];
|
||||
}
|
||||
}
|
||||
|
||||
if (LoadingImage)
|
||||
{
|
||||
ImageBrush = FDeferredCleanupSlateBrush::CreateBrush(LoadingImage);
|
||||
ChildSlot
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.Padding(Settings.Padding)
|
||||
.BorderBackgroundColor(Settings.BackgroundColor)
|
||||
.BorderImage(FCoreStyle::Get().GetBrush("WhiteBrush"))
|
||||
[
|
||||
SNew(SScaleBox)
|
||||
.Stretch(Settings.ImageStretch)
|
||||
[
|
||||
SNew(SImage)
|
||||
.Image(ImageBrush.IsValid() ? ImageBrush->GetSlateBrush() : nullptr)
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SCenterLayout.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSafeZone.h"
|
||||
#include "Widgets/Layout/SDPIScaler.h"
|
||||
#include "SHorizontalLoadingWidget.h"
|
||||
#include "SVerticalLoadingWidget.h"
|
||||
#include "SBackgroundWidget.h"
|
||||
#include "STipWidget.h"
|
||||
#include "Widgets/SOverlay.h"
|
||||
#include "Widgets/Layout/SBorder.h"
|
||||
#include "SLoadingCompleteText.h"
|
||||
|
||||
|
||||
void SCenterLayout::Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FCenterLayoutSettings& LayoutSettings)
|
||||
{
|
||||
// Root widget and background
|
||||
TSharedRef<SOverlay> Root = SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SBackgroundWidget, Settings.Background)
|
||||
];
|
||||
|
||||
// Placeholder for loading widget
|
||||
TSharedRef<SWidget> LoadingWidget = SNullWidget::NullWidget;
|
||||
if (Settings.LoadingWidget.LoadingWidgetType == ELoadingWidgetType::LWT_Horizontal)
|
||||
{
|
||||
LoadingWidget = SNew(SHorizontalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingWidget = SNew(SVerticalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
|
||||
// Add loading widget at center
|
||||
Root->AddSlot()
|
||||
.HAlign(HAlign_Center)
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
LoadingWidget
|
||||
];
|
||||
|
||||
|
||||
if (LayoutSettings.bIsTipAtBottom)
|
||||
{
|
||||
// Add tip widget at bottom
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.BorderHorizontalAlignment)
|
||||
.VAlign(VAlign_Bottom)
|
||||
.Padding(0, 0, 0, LayoutSettings.BorderVerticalOffset)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SCenterLayout::GetDPIScale)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add tip widget at top
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.BorderHorizontalAlignment)
|
||||
.VAlign(VAlign_Top)
|
||||
.Padding(0, LayoutSettings.BorderVerticalOffset, 0, 0)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SCenterLayout::GetDPIScale)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// Construct loading complete text if enable
|
||||
if (Settings.bShowLoadingCompleteText)
|
||||
{
|
||||
Root->AddSlot()
|
||||
.VAlign(Settings.LoadingCompleteTextSettings.Alignment.VerticalAlignment)
|
||||
.HAlign(Settings.LoadingCompleteTextSettings.Alignment.HorizontalAlignment)
|
||||
.Padding(Settings.LoadingCompleteTextSettings.Padding)
|
||||
[
|
||||
SNew(SLoadingCompleteText, Settings.LoadingCompleteTextSettings)
|
||||
];
|
||||
}
|
||||
|
||||
// Add root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SClassicLayout.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSafeZone.h"
|
||||
#include "Widgets/Layout/SDPIScaler.h"
|
||||
#include "Widgets/Layout/SSpacer.h"
|
||||
#include "Widgets/SBoxPanel.h"
|
||||
#include "SHorizontalLoadingWidget.h"
|
||||
#include "SVerticalLoadingWidget.h"
|
||||
#include "SBackgroundWidget.h"
|
||||
#include "STipWidget.h"
|
||||
#include "SLoadingCompleteText.h"
|
||||
|
||||
void SClassicLayout::Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FClassicLayoutSettings& LayoutSettings)
|
||||
{
|
||||
// Root widget and background
|
||||
TSharedRef<SOverlay> Root = SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SBackgroundWidget, Settings.Background)
|
||||
];
|
||||
|
||||
// Placeholder for loading widget
|
||||
TSharedRef<SWidget> LoadingWidget = SNullWidget::NullWidget;
|
||||
if (Settings.LoadingWidget.LoadingWidgetType == ELoadingWidgetType::LWT_Horizontal)
|
||||
{
|
||||
LoadingWidget = SNew(SHorizontalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingWidget = SNew(SVerticalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
|
||||
TSharedRef<SHorizontalBox> HorizontalBox = SNew(SHorizontalBox);
|
||||
|
||||
if (LayoutSettings.bIsLoadingWidgetAtLeft)
|
||||
{
|
||||
// Add Loading widget on left first
|
||||
HorizontalBox.Get().AddSlot()
|
||||
.VAlign(VAlign_Center)
|
||||
.HAlign(HAlign_Center)
|
||||
.AutoWidth()
|
||||
[
|
||||
LoadingWidget
|
||||
];
|
||||
|
||||
// Add spacer at midder
|
||||
HorizontalBox.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(LayoutSettings.Space, 0.0f))
|
||||
];
|
||||
|
||||
// Tip Text on the right
|
||||
HorizontalBox.Get().AddSlot()
|
||||
.FillWidth(1.0f)
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tip Text on the left
|
||||
HorizontalBox.Get().AddSlot()
|
||||
.FillWidth(1.0f)
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
[
|
||||
// Add tip text
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
];
|
||||
|
||||
// Add spacer at midder
|
||||
HorizontalBox.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(LayoutSettings.Space, 0.0f))
|
||||
];
|
||||
|
||||
// Add Loading widget on right
|
||||
HorizontalBox.Get().AddSlot()
|
||||
.VAlign(VAlign_Center)
|
||||
.HAlign(HAlign_Center)
|
||||
.AutoWidth()
|
||||
[
|
||||
LoadingWidget
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
EVerticalAlignment VerticalAlignment;
|
||||
// Set vertical alignment for widget
|
||||
if (LayoutSettings.bIsWidgetAtBottom)
|
||||
{
|
||||
VerticalAlignment = EVerticalAlignment::VAlign_Bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
VerticalAlignment = EVerticalAlignment::VAlign_Top;
|
||||
}
|
||||
|
||||
// Creating loading theme
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.BorderHorizontalAlignment)
|
||||
.VAlign(VerticalAlignment)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SClassicLayout::GetDPIScale)
|
||||
[
|
||||
HorizontalBox
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Construct loading complete text if enable
|
||||
if (Settings.bShowLoadingCompleteText)
|
||||
{
|
||||
Root->AddSlot()
|
||||
.VAlign(Settings.LoadingCompleteTextSettings.Alignment.VerticalAlignment)
|
||||
.HAlign(Settings.LoadingCompleteTextSettings.Alignment.HorizontalAlignment)
|
||||
.Padding(Settings.LoadingCompleteTextSettings.Padding)
|
||||
[
|
||||
SNew(SLoadingCompleteText, Settings.LoadingCompleteTextSettings)
|
||||
];
|
||||
}
|
||||
|
||||
// Add root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#include "SDualSidebarLayout.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSafeZone.h"
|
||||
#include "Widgets/Layout/SDPIScaler.h"
|
||||
#include "Widgets/Layout/SSpacer.h"
|
||||
#include "SHorizontalLoadingWidget.h"
|
||||
#include "SVerticalLoadingWidget.h"
|
||||
#include "SBackgroundWidget.h"
|
||||
#include "STipWidget.h"
|
||||
#include "SLoadingCompleteText.h"
|
||||
|
||||
void SDualSidebarLayout::Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FDualSidebarLayoutSettings& LayoutSettings)
|
||||
{
|
||||
// Root widget and background
|
||||
TSharedRef<SOverlay> Root = SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SBackgroundWidget, Settings.Background)
|
||||
];
|
||||
|
||||
// Placeholder for loading widget
|
||||
TSharedRef<SWidget> LoadingWidget = SNullWidget::NullWidget;
|
||||
if (Settings.LoadingWidget.LoadingWidgetType == ELoadingWidgetType::LWT_Horizontal)
|
||||
{
|
||||
LoadingWidget = SNew(SHorizontalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingWidget = SNew(SVerticalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (LayoutSettings.bIsLoadingWidgetAtRight)
|
||||
{
|
||||
// Add loading widget at right
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Right)
|
||||
.VAlign(LayoutSettings.RightBorderVerticalAlignment)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.RightBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(LayoutSettings.RightVerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.RightBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SDualSidebarLayout::GetDPIScale)
|
||||
[
|
||||
LoadingWidget
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Add tip widget at left
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Left)
|
||||
.VAlign(LayoutSettings.LeftBorderVerticalAlignment)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.LeftBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(LayoutSettings.LeftVerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.LeftBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SDualSidebarLayout::GetDPIScale)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Add Tip widget at right
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Right)
|
||||
.VAlign(LayoutSettings.RightBorderVerticalAlignment)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.RightBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(LayoutSettings.RightVerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.RightBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SDualSidebarLayout::GetDPIScale)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Add Loading widget at left
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Left)
|
||||
.VAlign(LayoutSettings.LeftBorderVerticalAlignment)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.LeftBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(LayoutSettings.LeftVerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.LeftBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SDualSidebarLayout::GetDPIScale)
|
||||
[
|
||||
LoadingWidget
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// Construct loading complete text if enable
|
||||
if (Settings.bShowLoadingCompleteText)
|
||||
{
|
||||
Root->AddSlot()
|
||||
.VAlign(Settings.LoadingCompleteTextSettings.Alignment.VerticalAlignment)
|
||||
.HAlign(Settings.LoadingCompleteTextSettings.Alignment.HorizontalAlignment)
|
||||
.Padding(Settings.LoadingCompleteTextSettings.Padding)
|
||||
[
|
||||
SNew(SLoadingCompleteText, Settings.LoadingCompleteTextSettings)
|
||||
];
|
||||
}
|
||||
|
||||
// Add root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SHorizontalLoadingWidget.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSpacer.h"
|
||||
#include "Widgets/Images/SImage.h"
|
||||
#include "Slate/DeferredCleanupSlateBrush.h"
|
||||
#include "Widgets/Text/STextBlock.h"
|
||||
#include "Widgets/SBoxPanel.h"
|
||||
|
||||
void SHorizontalLoadingWidget::Construct(const FArguments& InArgs, const FLoadingWidgetSettings& Settings)
|
||||
{
|
||||
bPlayReverse = Settings.ImageSequenceSettings.bPlayReverse;
|
||||
|
||||
// Root is a Horizontal Box of course
|
||||
TSharedRef<SHorizontalBox> Root = SNew(SHorizontalBox);
|
||||
|
||||
// Construct Loading Icon Widget
|
||||
ConstructLoadingIcon(Settings);
|
||||
|
||||
EVisibility LoadingTextVisibility;
|
||||
|
||||
if (Settings.LoadingText.IsEmpty())
|
||||
{
|
||||
LoadingTextVisibility = EVisibility::Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingTextVisibility = EVisibility::SelfHitTestInvisible;
|
||||
}
|
||||
|
||||
// If loading text is on the right
|
||||
if (Settings.bLoadingTextRightPosition)
|
||||
{
|
||||
// Add Loading Icon on the left first
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.LoadingIconAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.LoadingIconAlignment.VerticalAlignment)
|
||||
.AutoWidth()
|
||||
[
|
||||
LoadingIcon
|
||||
];
|
||||
|
||||
// Add a Spacer in middle
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(Settings.Space, 0.0f))
|
||||
];
|
||||
|
||||
// Add Loading Text on the right
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.TextAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.TextAlignment.VerticalAlignment)
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Visibility(LoadingTextVisibility)
|
||||
.ColorAndOpacity(Settings.Appearance.ColorAndOpacity)
|
||||
.Font(Settings.Appearance.Font)
|
||||
.ShadowOffset(Settings.Appearance.ShadowOffset)
|
||||
.ShadowColorAndOpacity(Settings.Appearance.ShadowColorAndOpacity)
|
||||
.Justification(Settings.Appearance.Justification)
|
||||
.Text(Settings.LoadingText)
|
||||
];
|
||||
}
|
||||
|
||||
// If loading text is on the left
|
||||
else
|
||||
{
|
||||
// Add Loading Text on the left first
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.TextAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.TextAlignment.VerticalAlignment)
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Visibility(LoadingTextVisibility)
|
||||
.ColorAndOpacity(Settings.Appearance.ColorAndOpacity)
|
||||
.Font(Settings.Appearance.Font)
|
||||
.ShadowOffset(Settings.Appearance.ShadowOffset)
|
||||
.ShadowColorAndOpacity(Settings.Appearance.ShadowColorAndOpacity)
|
||||
.Justification(Settings.Appearance.Justification)
|
||||
.Text(Settings.LoadingText)
|
||||
];
|
||||
|
||||
|
||||
// Add a Spacer in middle
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(Settings.Space, 0.0f))
|
||||
];
|
||||
|
||||
// Add Loading Icon on the right finally
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.LoadingIconAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.LoadingIconAlignment.VerticalAlignment)
|
||||
.AutoWidth()
|
||||
[
|
||||
LoadingIcon
|
||||
];
|
||||
}
|
||||
|
||||
// Add root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SLetterboxLayout.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSafeZone.h"
|
||||
#include "Widgets/Layout/SDPIScaler.h"
|
||||
#include "SHorizontalLoadingWidget.h"
|
||||
#include "SVerticalLoadingWidget.h"
|
||||
#include "SBackgroundWidget.h"
|
||||
#include "STipWidget.h"
|
||||
#include "SLoadingCompleteText.h"
|
||||
|
||||
void SLetterboxLayout::Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FLetterboxLayoutSettings& LayoutSettings)
|
||||
{
|
||||
// Root widget and background
|
||||
TSharedRef<SOverlay> Root = SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SBackgroundWidget, Settings.Background)
|
||||
];
|
||||
|
||||
// Placeholder for loading widget
|
||||
TSharedRef<SWidget> LoadingWidget = SNullWidget::NullWidget;
|
||||
if (Settings.LoadingWidget.LoadingWidgetType == ELoadingWidgetType::LWT_Horizontal)
|
||||
{
|
||||
LoadingWidget = SNew(SHorizontalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingWidget = SNew(SVerticalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
|
||||
|
||||
if (LayoutSettings.bIsLoadingWidgetAtTop)
|
||||
{
|
||||
// Add a border widget at top, then add Loading widget
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.TopBorderHorizontalAlignment)
|
||||
.VAlign(VAlign_Top)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.TopBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(LayoutSettings.LoadingWidgetAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.LoadingWidgetAlignment.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.TopBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SLetterboxLayout::GetDPIScale)
|
||||
[
|
||||
LoadingWidget
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Add a border widget at bottom, then add Tip widget
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.BottomBorderHorizontalAlignment)
|
||||
.VAlign(VAlign_Bottom)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BottomBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BottomBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SLetterboxLayout::GetDPIScale)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add a border widget at top, then add Tip widget
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.TopBorderHorizontalAlignment)
|
||||
.VAlign(VAlign_Top)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.TopBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.TopBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SLetterboxLayout::GetDPIScale)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Add a border widget at bottom, then add Loading widget
|
||||
Root->AddSlot()
|
||||
.HAlign(LayoutSettings.BottomBorderHorizontalAlignment)
|
||||
.VAlign(VAlign_Bottom)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BottomBorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(LayoutSettings.LoadingWidgetAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.LoadingWidgetAlignment.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BottomBorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SLetterboxLayout::GetDPIScale)
|
||||
[
|
||||
LoadingWidget
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// Construct loading complete text if enable
|
||||
if (Settings.bShowLoadingCompleteText)
|
||||
{
|
||||
Root->AddSlot()
|
||||
.VAlign(Settings.LoadingCompleteTextSettings.Alignment.VerticalAlignment)
|
||||
.HAlign(Settings.LoadingCompleteTextSettings.Alignment.HorizontalAlignment)
|
||||
.Padding(Settings.LoadingCompleteTextSettings.Padding)
|
||||
[
|
||||
SNew(SLoadingCompleteText, Settings.LoadingCompleteTextSettings)
|
||||
];
|
||||
}
|
||||
|
||||
// Add Root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#include "SLoadingCompleteText.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "MoviePlayer.h"
|
||||
#include "Widgets/Text/STextBlock.h"
|
||||
|
||||
void SLoadingCompleteText::Construct(const FArguments& InArgs, const FLoadingCompleteTextSettings& CompleteTextSettings)
|
||||
{
|
||||
CompleteTextColor = CompleteTextSettings.Appearance.ColorAndOpacity.GetSpecifiedColor();
|
||||
CompleteTextAnimationSpeed = CompleteTextSettings.AnimationSpeed;
|
||||
|
||||
ChildSlot
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Font(CompleteTextSettings.Appearance.Font)
|
||||
.ShadowOffset(CompleteTextSettings.Appearance.ShadowOffset)
|
||||
.ShadowColorAndOpacity(CompleteTextSettings.Appearance.ShadowColorAndOpacity)
|
||||
.Justification(CompleteTextSettings.Appearance.Justification)
|
||||
.Text(CompleteTextSettings.LoadingCompleteText)
|
||||
.ColorAndOpacity(this, &SLoadingCompleteText::GetLoadingCompleteTextColor)
|
||||
.Visibility(this, &SLoadingCompleteText::GetLoadingCompleteTextVisibility)
|
||||
];
|
||||
|
||||
// Register animated image sequence active timer event
|
||||
if (CompleteTextSettings.bFadeInOutAnim && !bIsActiveTimerRegistered)
|
||||
{
|
||||
bIsActiveTimerRegistered = true;
|
||||
RegisterActiveTimer(0.f, FWidgetActiveTimerDelegate::CreateSP(this, &SLoadingCompleteText::AnimateText));
|
||||
}
|
||||
}
|
||||
|
||||
EVisibility SLoadingCompleteText::GetLoadingCompleteTextVisibility() const
|
||||
{
|
||||
return GetMoviePlayer()->IsLoadingFinished() ? EVisibility::Visible : EVisibility::Hidden;
|
||||
}
|
||||
|
||||
FSlateColor SLoadingCompleteText::GetLoadingCompleteTextColor() const
|
||||
{
|
||||
return CompleteTextColor;
|
||||
}
|
||||
|
||||
EActiveTimerReturnType SLoadingCompleteText::AnimateText(double InCurrentTime, float InDeltaTime)
|
||||
{
|
||||
const float MinAlpha = 0.1f;
|
||||
const float MaxAlpha = 1.0f;
|
||||
|
||||
float TextAlpha = CompleteTextColor.A;
|
||||
|
||||
if (TextAlpha >= MaxAlpha)
|
||||
{
|
||||
bCompleteTextReverseAnim = true;
|
||||
}
|
||||
else if (TextAlpha <= MinAlpha)
|
||||
{
|
||||
bCompleteTextReverseAnim = false;
|
||||
}
|
||||
|
||||
if (!bCompleteTextReverseAnim)
|
||||
{
|
||||
TextAlpha += InDeltaTime * CompleteTextAnimationSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
TextAlpha -= InDeltaTime * CompleteTextAnimationSpeed;
|
||||
}
|
||||
|
||||
CompleteTextColor.A = TextAlpha;
|
||||
|
||||
return EActiveTimerReturnType::Continue;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SLoadingScreenLayout.h"
|
||||
#include "Engine/UserInterfaceSettings.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Engine/GameViewportClient.h"
|
||||
|
||||
float SLoadingScreenLayout::PointSizeToSlateUnits(float PointSize)
|
||||
{
|
||||
const float SlateFreeTypeHorizontalResolutionDPI = 96.0f;
|
||||
const float FreeTypeNativeDPI = 72.0;
|
||||
const float PixelSize = PointSize * (SlateFreeTypeHorizontalResolutionDPI / FreeTypeNativeDPI);
|
||||
return PixelSize;
|
||||
}
|
||||
|
||||
float SLoadingScreenLayout::GetDPIScale() const
|
||||
{
|
||||
FIntPoint Size;
|
||||
if (GEngine && GEngine->GameViewport)
|
||||
{
|
||||
FVector2D ViewportSize;
|
||||
GEngine->GameViewport->GetViewportSize(ViewportSize);
|
||||
int32 X = FGenericPlatformMath::FloorToInt(ViewportSize.X);
|
||||
int32 Y = FGenericPlatformMath::FloorToInt(ViewportSize.Y);
|
||||
Size = FIntPoint(X, Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
const FVector2D DrawSize = GetTickSpaceGeometry().ToPaintGeometry().GetLocalSize();
|
||||
if (DrawSize.Equals(FVector2D::ZeroVector))
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
int32 X = FGenericPlatformMath::FloorToInt(DrawSize.X);
|
||||
int32 Y = FGenericPlatformMath::FloorToInt(DrawSize.Y);
|
||||
Size = FIntPoint(X, Y);
|
||||
}
|
||||
|
||||
return FMath::Clamp(GetDefault<UUserInterfaceSettings>()->GetDPIScaleBasedOnSize(Size), 0.1f, 1.0f);
|
||||
}
|
||||
|
@ -1,128 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SLoadingWidget.h"
|
||||
#include "Widgets/Images/SImage.h"
|
||||
#include "Slate/DeferredCleanupSlateBrush.h"
|
||||
#include "Widgets/Layout/SSpacer.h"
|
||||
#include "Engine/Texture2D.h"
|
||||
#include "MoviePlayer.h"
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
int32 SLoadingWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const
|
||||
{
|
||||
TotalDeltaTime += Args.GetDeltaTime();
|
||||
|
||||
if (TotalDeltaTime >= Interval)
|
||||
{
|
||||
if (CleanupBrushList.Num() > 1)
|
||||
{
|
||||
if (bPlayReverse)
|
||||
{
|
||||
ImageIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImageIndex++;
|
||||
}
|
||||
|
||||
if (ImageIndex >= CleanupBrushList.Num())
|
||||
{
|
||||
ImageIndex = 0;
|
||||
}
|
||||
else if (ImageIndex < 0)
|
||||
{
|
||||
ImageIndex = CleanupBrushList.Num() - 1;
|
||||
}
|
||||
|
||||
StaticCastSharedRef<SImage>(LoadingIcon)->SetImage(CleanupBrushList[ImageIndex].IsValid() ? CleanupBrushList[ImageIndex]->GetSlateBrush() : nullptr);
|
||||
}
|
||||
|
||||
TotalDeltaTime = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
return SCompoundWidget::OnPaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
|
||||
}
|
||||
|
||||
SThrobber::EAnimation SLoadingWidget::GetThrobberAnimation(const FThrobberSettings& ThrobberSettings) const
|
||||
{
|
||||
const int32 AnimationParams = (ThrobberSettings.bAnimateVertically ? SThrobber::Vertical : 0) |
|
||||
(ThrobberSettings.bAnimateHorizontally ? SThrobber::Horizontal : 0) |
|
||||
(ThrobberSettings.bAnimateOpacity ? SThrobber::Opacity : 0);
|
||||
|
||||
return static_cast<SThrobber::EAnimation>(AnimationParams);
|
||||
}
|
||||
|
||||
void SLoadingWidget::ConstructLoadingIcon(const FLoadingWidgetSettings& Settings)
|
||||
{
|
||||
if (Settings.LoadingIconType == ELoadingIconType::LIT_ImageSequence)
|
||||
{
|
||||
// Loading Widget is image sequence
|
||||
if (Settings.ImageSequenceSettings.Images.Num() > 0)
|
||||
{
|
||||
CleanupBrushList.Empty();
|
||||
ImageIndex = 0;
|
||||
|
||||
FVector2D Scale = Settings.ImageSequenceSettings.Scale;
|
||||
|
||||
for (auto Image: Settings.ImageSequenceSettings.Images)
|
||||
{
|
||||
if (Image)
|
||||
{
|
||||
CleanupBrushList.Add(FDeferredCleanupSlateBrush::CreateBrush(Image, FVector2D(Image->GetSurfaceWidth() * Scale.X, Image->GetSurfaceHeight() * Scale.Y)));
|
||||
}
|
||||
}
|
||||
|
||||
// Create Image slate widget
|
||||
LoadingIcon = SNew(SImage)
|
||||
.Image(CleanupBrushList[ImageIndex]->GetSlateBrush());
|
||||
|
||||
// Update play animation interval
|
||||
Interval = Settings.ImageSequenceSettings.Interval;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there is no image in the array then create a spacer instead
|
||||
LoadingIcon = SNew(SSpacer).Size(FVector2D::ZeroVector);
|
||||
}
|
||||
|
||||
}
|
||||
else if (Settings.LoadingIconType == ELoadingIconType::LIT_CircularThrobber)
|
||||
{
|
||||
// Loading Widget is SCircularThrobber
|
||||
LoadingIcon = SNew(SCircularThrobber)
|
||||
.NumPieces(Settings.CircularThrobberSettings.NumberOfPieces)
|
||||
.Period(Settings.CircularThrobberSettings.Period)
|
||||
.Radius(Settings.CircularThrobberSettings.Radius)
|
||||
.PieceImage(&Settings.CircularThrobberSettings.Image);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loading Widget is SThrobber
|
||||
LoadingIcon = SNew(SThrobber)
|
||||
.NumPieces(Settings.ThrobberSettings.NumberOfPieces)
|
||||
.Animate(GetThrobberAnimation(Settings.ThrobberSettings))
|
||||
.PieceImage(&Settings.ThrobberSettings.Image);
|
||||
}
|
||||
|
||||
// Set Loading Icon render transform
|
||||
LoadingIcon.Get().SetRenderTransform(FSlateRenderTransform(FScale2D(Settings.TransformScale), Settings.TransformTranslation));
|
||||
LoadingIcon.Get().SetRenderTransformPivot(Settings.TransformPivot);
|
||||
|
||||
// Hide loading widget when level loading is done if bHideLoadingWidgetWhenCompletes is true
|
||||
if (Settings.bHideLoadingWidgetWhenCompletes)
|
||||
{
|
||||
SetVisibility(TAttribute<EVisibility>::Create(TAttribute<EVisibility>::FGetter::CreateRaw(this, &SLoadingWidget::GetLoadingWidgetVisibility)));
|
||||
}
|
||||
}
|
||||
|
||||
EVisibility SLoadingWidget::GetLoadingWidgetVisibility() const
|
||||
{
|
||||
return GetMoviePlayer()->IsLoadingFinished() ? EVisibility::Hidden : EVisibility::Visible;
|
||||
}
|
@ -1,184 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SSidebarLayout.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSafeZone.h"
|
||||
#include "Widgets/Layout/SDPIScaler.h"
|
||||
#include "Widgets/Layout/SSpacer.h"
|
||||
#include "SHorizontalLoadingWidget.h"
|
||||
#include "SVerticalLoadingWidget.h"
|
||||
#include "SBackgroundWidget.h"
|
||||
#include "STipWidget.h"
|
||||
#include "SLoadingCompleteText.h"
|
||||
#include "Widgets/SBoxPanel.h"
|
||||
|
||||
void SSidebarLayout::Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FSidebarLayoutSettings& LayoutSettings)
|
||||
{
|
||||
// Root widget and background
|
||||
TSharedRef<SOverlay> Root = SNew(SOverlay)
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SNew(SBackgroundWidget, Settings.Background)
|
||||
];
|
||||
|
||||
// Placeholder for loading widget
|
||||
TSharedRef<SWidget> LoadingWidget = SNullWidget::NullWidget;
|
||||
if (Settings.LoadingWidget.LoadingWidgetType == ELoadingWidgetType::LWT_Horizontal)
|
||||
{
|
||||
LoadingWidget = SNew(SHorizontalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingWidget = SNew(SVerticalLoadingWidget, Settings.LoadingWidget);
|
||||
}
|
||||
|
||||
|
||||
TSharedRef<SVerticalBox> VerticalBox = SNew(SVerticalBox);
|
||||
if (LayoutSettings.bIsLoadingWidgetAtTop)
|
||||
{
|
||||
// Add loading widget at top
|
||||
VerticalBox.Get().AddSlot()
|
||||
.AutoHeight()
|
||||
.HAlign(LayoutSettings.LoadingWidgetAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.LoadingWidgetAlignment.VerticalAlignment)
|
||||
[
|
||||
LoadingWidget
|
||||
];
|
||||
|
||||
// Add SSpacer at middle
|
||||
VerticalBox.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(0.0f, LayoutSettings.Space))
|
||||
];
|
||||
|
||||
// Add tip widget at bottom
|
||||
VerticalBox.Get().AddSlot()
|
||||
.AutoHeight()
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add tip widget at top
|
||||
VerticalBox.Get().AddSlot()
|
||||
.AutoHeight()
|
||||
.HAlign(LayoutSettings.TipAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.TipAlignment.VerticalAlignment)
|
||||
[
|
||||
SNew(STipWidget, Settings.TipWidget)
|
||||
];
|
||||
|
||||
// Add SSpacer at middle
|
||||
VerticalBox.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(0.0f, LayoutSettings.Space))
|
||||
];
|
||||
|
||||
// Add loading widget at bottom
|
||||
VerticalBox.Get().AddSlot()
|
||||
.AutoHeight()
|
||||
.HAlign(LayoutSettings.LoadingWidgetAlignment.HorizontalAlignment)
|
||||
.VAlign(LayoutSettings.LoadingWidgetAlignment.VerticalAlignment)
|
||||
[
|
||||
LoadingWidget
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (LayoutSettings.bIsWidgetAtRight)
|
||||
{
|
||||
// Add widget at right
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Right)
|
||||
.VAlign(LayoutSettings.BorderVerticalAlignment)
|
||||
.Padding(0, 0, LayoutSettings.BorderHorizontalOffset, 0)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(LayoutSettings.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SSidebarLayout::GetDPIScale)
|
||||
[
|
||||
VerticalBox
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add widget at left
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Left)
|
||||
.VAlign(LayoutSettings.BorderVerticalAlignment)
|
||||
.Padding(LayoutSettings.BorderHorizontalOffset, 0, 0, 0)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.BorderImage(&LayoutSettings.BorderBackground)
|
||||
.BorderBackgroundColor(FLinearColor::White)
|
||||
[
|
||||
SNew(SSafeZone)
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(LayoutSettings.VerticalAlignment)
|
||||
.IsTitleSafe(true)
|
||||
.Padding(LayoutSettings.BorderPadding)
|
||||
[
|
||||
SNew(SDPIScaler)
|
||||
.DPIScale(this, &SSidebarLayout::GetDPIScale)
|
||||
[
|
||||
VerticalBox
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// Construct loading complete text if enable
|
||||
if (Settings.bShowLoadingCompleteText)
|
||||
{
|
||||
Root->AddSlot()
|
||||
.VAlign(Settings.LoadingCompleteTextSettings.Alignment.VerticalAlignment)
|
||||
.HAlign(Settings.LoadingCompleteTextSettings.Alignment.HorizontalAlignment)
|
||||
.Padding(Settings.LoadingCompleteTextSettings.Padding)
|
||||
[
|
||||
SNew(SLoadingCompleteText, Settings.LoadingCompleteTextSettings)
|
||||
];
|
||||
}
|
||||
|
||||
// Add root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "STipWidget.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Text/STextBlock.h"
|
||||
#include "AsyncLoadingScreenLibrary.h"
|
||||
|
||||
void STipWidget::Construct(const FArguments& InArgs, const FTipSettings& Settings)
|
||||
{
|
||||
if (Settings.TipText.Num() > 0)
|
||||
{
|
||||
int32 TipIndex = FMath::RandRange(0, Settings.TipText.Num() - 1);
|
||||
|
||||
if (Settings.bSetDisplayTipTextManually == true)
|
||||
{
|
||||
if (Settings.TipText.IsValidIndex(UAsyncLoadingScreenLibrary::GetDisplayTipTextIndex()))
|
||||
{
|
||||
TipIndex = UAsyncLoadingScreenLibrary::GetDisplayTipTextIndex();
|
||||
}
|
||||
}
|
||||
|
||||
ChildSlot
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.ColorAndOpacity(Settings.Appearance.ColorAndOpacity)
|
||||
.Font(Settings.Appearance.Font)
|
||||
.ShadowOffset(Settings.Appearance.ShadowOffset)
|
||||
.ShadowColorAndOpacity(Settings.Appearance.ShadowColorAndOpacity)
|
||||
.Justification(Settings.Appearance.Justification)
|
||||
.WrapTextAt(Settings.TipWrapAt)
|
||||
.Text(Settings.TipText[TipIndex])
|
||||
];
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#include "SVerticalLoadingWidget.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
#include "Widgets/Layout/SSpacer.h"
|
||||
#include "Widgets/Images/SImage.h"
|
||||
#include "Slate/DeferredCleanupSlateBrush.h"
|
||||
#include "Widgets/Text/STextBlock.h"
|
||||
|
||||
void SVerticalLoadingWidget::Construct(const FArguments& InArgs, const FLoadingWidgetSettings& Settings)
|
||||
{
|
||||
bPlayReverse = Settings.ImageSequenceSettings.bPlayReverse;
|
||||
|
||||
// Root is a Vertical Box
|
||||
TSharedRef<SVerticalBox> Root = SNew(SVerticalBox);
|
||||
|
||||
// Construct Loading Icon Widget
|
||||
ConstructLoadingIcon(Settings);
|
||||
|
||||
EVisibility LoadingTextVisibility;
|
||||
|
||||
if (Settings.LoadingText.IsEmpty())
|
||||
{
|
||||
LoadingTextVisibility = EVisibility::Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadingTextVisibility = EVisibility::SelfHitTestInvisible;
|
||||
}
|
||||
|
||||
// If loading text is on the top
|
||||
if (Settings.bLoadingTextTopPosition)
|
||||
{
|
||||
// Add Loading Text on the top first
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.TextAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.TextAlignment.VerticalAlignment)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Visibility(LoadingTextVisibility)
|
||||
.ColorAndOpacity(Settings.Appearance.ColorAndOpacity)
|
||||
.Font(Settings.Appearance.Font)
|
||||
.ShadowOffset(Settings.Appearance.ShadowOffset)
|
||||
.ShadowColorAndOpacity(Settings.Appearance.ShadowColorAndOpacity)
|
||||
.Justification(Settings.Appearance.Justification)
|
||||
.Text(Settings.LoadingText)
|
||||
];
|
||||
|
||||
// Add a Spacer in middle
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(0.0f, Settings.Space))
|
||||
];
|
||||
|
||||
// Add Loading Icon at the bottom finally
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.LoadingIconAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.LoadingIconAlignment.VerticalAlignment)
|
||||
.AutoHeight()
|
||||
[
|
||||
LoadingIcon
|
||||
];
|
||||
}
|
||||
|
||||
// If loading text is at the bottom
|
||||
else
|
||||
{
|
||||
// Add Loading Icon on the top
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.LoadingIconAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.LoadingIconAlignment.VerticalAlignment)
|
||||
.AutoHeight()
|
||||
[
|
||||
LoadingIcon
|
||||
];
|
||||
|
||||
// Add a Spacer in middle
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(SSpacer)
|
||||
.Size(FVector2D(0.0f, Settings.Space))
|
||||
];
|
||||
|
||||
// Add Loading Text at the bottom
|
||||
Root.Get().AddSlot()
|
||||
.HAlign(Settings.TextAlignment.HorizontalAlignment)
|
||||
.VAlign(Settings.TextAlignment.VerticalAlignment)
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Visibility(LoadingTextVisibility)
|
||||
.ColorAndOpacity(Settings.Appearance.ColorAndOpacity)
|
||||
.Font(Settings.Appearance.Font)
|
||||
.ShadowOffset(Settings.Appearance.ShadowOffset)
|
||||
.ShadowColorAndOpacity(Settings.Appearance.ShadowColorAndOpacity)
|
||||
.Justification(Settings.Appearance.Justification)
|
||||
.Text(Settings.LoadingText)
|
||||
];
|
||||
}
|
||||
|
||||
// Add root to this widget
|
||||
ChildSlot
|
||||
[
|
||||
Root
|
||||
];
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
struct FALoadingScreenSettings;
|
||||
|
||||
class FAsyncLoadingScreenModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
|
||||
/**
|
||||
* Called right after the module DLL has been loaded and the module object has been created
|
||||
*/
|
||||
virtual void StartupModule() override;
|
||||
|
||||
/**
|
||||
* Called before the module is unloaded, right before the module object is destroyed.
|
||||
*/
|
||||
virtual void ShutdownModule() override;
|
||||
|
||||
/**
|
||||
* Returns true if this module hosts gameplay code
|
||||
*
|
||||
* @return True for "gameplay modules", or false for engine code modules, plugins, etc.
|
||||
*/
|
||||
virtual bool IsGameModule() const override;
|
||||
|
||||
/**
|
||||
* Singleton-like access to this module's interface. This is just for convenience!
|
||||
* Beware of calling this during the shutdown phase, though. Your module might have been unloaded already.
|
||||
*
|
||||
* @return Returns singleton instance, loading the module on demand if needed
|
||||
*/
|
||||
static inline FAsyncLoadingScreenModule& Get()
|
||||
{
|
||||
return FModuleManager::LoadModuleChecked<FAsyncLoadingScreenModule>("AsyncLoadingScreen");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if this module is loaded and ready. It is only valid to call Get() if IsAvailable() returns true.
|
||||
*
|
||||
* @return True if the module is loaded and ready to use
|
||||
*/
|
||||
static inline bool IsAvailable()
|
||||
{
|
||||
return FModuleManager::Get().IsModuleLoaded("AsyncLoadingScreen");
|
||||
}
|
||||
|
||||
TArray<UTexture2D*> GetBackgroundImages();
|
||||
|
||||
/**
|
||||
* Check if "bPreloadBackgroundImages" option is enabled
|
||||
*/
|
||||
bool IsPreloadBackgroundImagesEnabled();
|
||||
|
||||
/**
|
||||
* Is showing Startup Loading Screen?
|
||||
*/
|
||||
bool IsStartupLoadingScreen() { return bIsStartupLoadingScreen; }
|
||||
|
||||
/**
|
||||
* Load all background images from settings into array
|
||||
*/
|
||||
void LoadBackgroundImages();
|
||||
|
||||
/**
|
||||
* Remove all background images from array
|
||||
*/
|
||||
void RemoveAllBackgroundImages();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Loading screen callback, it won't be called if we've already explicitly setup the loading screen
|
||||
*/
|
||||
void PreSetupLoadingScreen();
|
||||
|
||||
/**
|
||||
* Setup loading screen settings
|
||||
*/
|
||||
void SetupLoadingScreen(const FALoadingScreenSettings& LoadingScreenSettings);
|
||||
|
||||
/**
|
||||
* Shuffle the movies list
|
||||
*/
|
||||
void ShuffleMovies(TArray<FString>& MoviesList);
|
||||
private:
|
||||
// Startup background images array
|
||||
UPROPERTY()
|
||||
TArray<class UTexture2D*> StartupBackgroundImages;
|
||||
|
||||
// Default background images array
|
||||
UPROPERTY()
|
||||
TArray<class UTexture2D*> DefaultBackgroundImages;
|
||||
|
||||
bool bIsStartupLoadingScreen = false;
|
||||
};
|
@ -1,111 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "AsyncLoadingScreenLibrary.generated.h"
|
||||
|
||||
/**
|
||||
* Async Loading Screen Function Library
|
||||
*/
|
||||
UCLASS()
|
||||
class ASYNCLOADINGSCREEN_API UAsyncLoadingScreenLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_BODY()
|
||||
private:
|
||||
static int32 DisplayBackgroundIndex;
|
||||
static int32 DisplayTipTextIndex;
|
||||
static int32 DisplayMovieIndex;
|
||||
static bool bShowLoadingScreen;
|
||||
public:
|
||||
|
||||
/**
|
||||
* Set which background will be displayed on the loading screen by index. The "SetDisplayBackgroundManually" option in Background setting needs to be "true" to use this function.
|
||||
*
|
||||
* @param BackgroundIndex Valid index of the Background in "Images" array in Background setting. If the index is not valid, then it will display random background instead.
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void SetDisplayBackgroundIndex(int32 BackgroundIndex);
|
||||
|
||||
/**
|
||||
* Set which text will be displayed on the loading screen by index. The "SetDisplayTipTextManually" option in Tip Widget setting needs to be "true" to use this function.
|
||||
*
|
||||
* @param TipTextIndex Valid index of the text in "TipText" array in Tip Widget setting. If the index is not valid, then it will display random text instead.
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void SetDisplayTipTextIndex(int32 TipTextIndex);
|
||||
|
||||
/**
|
||||
* Set which movie will be displayed on the loading screen by index. The "SetDisplayMovieIndexManually" option needs to be "true" to use this function.
|
||||
*
|
||||
* @param MovieIndex Valid index of the movie in "MoviePaths" array.
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void SetDisplayMovieIndex(int32 MovieIndex);
|
||||
|
||||
|
||||
/**
|
||||
* Set enable/disable the loading screen for next levels
|
||||
*
|
||||
* @param bIsEnableLoadingScreen Should we enable the loading screen for next level?
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void SetEnableLoadingScreen(bool bIsEnableLoadingScreen);
|
||||
|
||||
|
||||
/**
|
||||
* Get enable/disable the loading screen for next levels
|
||||
*
|
||||
**/
|
||||
UFUNCTION(BlueprintPure, Category = "Async Loading Screen")
|
||||
static inline bool GetIsEnableLoadingScreen() { return bShowLoadingScreen; }
|
||||
|
||||
/**
|
||||
* Stop the loading screen. To use this function, you must enable the "bAllowEngineTick" option.
|
||||
* Call this function in BeginPlay event to stop the Loading Screen (works with Delay node).
|
||||
*
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void StopLoadingScreen();
|
||||
|
||||
static inline int32 GetDisplayBackgroundIndex() { return DisplayBackgroundIndex; }
|
||||
static inline int32 GetDisplayTipTextIndex() { return DisplayTipTextIndex; }
|
||||
static inline int32 GetDisplayMovieIndex() { return DisplayMovieIndex; }
|
||||
|
||||
/**
|
||||
* Load all background images into memory
|
||||
*
|
||||
* Only use this function when:
|
||||
* "bPreloadBackgroundImages" option is checked,
|
||||
* and you called "RemovePreloadedBackgroundImages" before.
|
||||
*
|
||||
* You don't need to use this if you never call
|
||||
* "RemovePreloadedBackgroundImages" function,
|
||||
* since the background images are still in the memory
|
||||
*
|
||||
* Note: Call this function before calling "OpenLevel" node.
|
||||
*
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void PreloadBackgroundImages();
|
||||
|
||||
/**
|
||||
* Remove all preloaded background images
|
||||
*
|
||||
* Only need to use this function when
|
||||
* "bPreloadBackgroundImages" is checked.
|
||||
*
|
||||
* You need to call "PreloadBackgroundImages"
|
||||
* to manually load all background images again.
|
||||
*
|
||||
**/
|
||||
UFUNCTION(BlueprintCallable, Category = "Async Loading Screen")
|
||||
static void RemovePreloadedBackgroundImages();
|
||||
};
|
@ -1,754 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DeveloperSettings.h"
|
||||
#include "MoviePlayer.h"
|
||||
#include "Widgets/Layout/SScaleBox.h"
|
||||
#include "Styling/SlateBrush.h"
|
||||
#include "Framework/Text/TextLayout.h"
|
||||
#include "LoadingScreenSettings.generated.h"
|
||||
|
||||
|
||||
/**
|
||||
* Asynce Loading Screen Layouts
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EAsyncLoadingScreenLayout : uint8
|
||||
{
|
||||
/**
|
||||
* The Classic is a simple, generic layout and fits well with many designs.
|
||||
* Loading and tip widgets can be at the bottom or top.
|
||||
*/
|
||||
ALSL_Classic UMETA(DisplayName = "Classic"),
|
||||
/**
|
||||
* The loading widget is at the center of the screen, tip widget can be at the bottom or top.
|
||||
* The Center layout is a good choice if your loading icon is the main design.
|
||||
*/
|
||||
ALSL_Center UMETA(DisplayName = "Center"),
|
||||
/**
|
||||
* The Letterbox layout has two borders on top and bottom of the screen. Loading widget
|
||||
* can be on the top and the tip is at the bottom of the screen, or vice versa.
|
||||
*/
|
||||
ALSL_Letterbox UMETA(DisplayName = "Letterbox"),
|
||||
/**
|
||||
* The Sidebar layout has a vertical border on the left or right of the screen. The Sidebar
|
||||
* is suitable for storytelling, long paragraphs due to the height of the tip widget.
|
||||
*/
|
||||
ALSL_Sidebar UMETA(DisplayName = "Sidebar"),
|
||||
|
||||
/**
|
||||
* Similar to Sidebar layout but Dual Sidebar layout has two vertical borders on both left and right of the screen.
|
||||
* The Dual Sidebar layout is suitable for storytelling, long paragraphs due to the height of the tip widget.
|
||||
*/
|
||||
ALSL_DualSidebar UMETA(DisplayName = "Dual Sidebar")
|
||||
};
|
||||
|
||||
/** Loading Icon Type*/
|
||||
UENUM(BlueprintType)
|
||||
enum class ELoadingIconType : uint8
|
||||
{
|
||||
/** SThrobber widget */
|
||||
LIT_Throbber UMETA(DisplayName = "Throbber"),
|
||||
/** SCircularThrobber widget */
|
||||
LIT_CircularThrobber UMETA(DisplayName = "Circular Throbber"),
|
||||
/** Animated images */
|
||||
LIT_ImageSequence UMETA(DisplayName = "Image Sequence")
|
||||
};
|
||||
|
||||
/** Loading Widget type */
|
||||
UENUM(BlueprintType)
|
||||
enum class ELoadingWidgetType : uint8
|
||||
{
|
||||
/** Horizontal alignment */
|
||||
LWT_Horizontal UMETA(DisplayName = "Horizontal"),
|
||||
/** Vertical alignment */
|
||||
LWT_Vertical UMETA(DisplayName = "Vertical"),
|
||||
};
|
||||
|
||||
/** Alignment for widget*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FWidgetAlignment
|
||||
{
|
||||
GENERATED_BODY()
|
||||
/** The horizontal alignment of the widget.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Alignment Setting")
|
||||
TEnumAsByte<EHorizontalAlignment> HorizontalAlignment = EHorizontalAlignment::HAlign_Center;
|
||||
|
||||
/** The vertical alignment of the widget.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Alignment Setting")
|
||||
TEnumAsByte<EVerticalAlignment> VerticalAlignment = EVerticalAlignment::VAlign_Center;
|
||||
};
|
||||
|
||||
// Text appearance settings
|
||||
USTRUCT(BlueprintType)
|
||||
struct FTextAppearance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Text color and opacity */
|
||||
UPROPERTY(BlueprintReadWrite, Config, EditAnywhere, Category = "Text Appearance")
|
||||
FSlateColor ColorAndOpacity = FSlateColor(FLinearColor::White);
|
||||
|
||||
// The font to render the text with.
|
||||
UPROPERTY(BlueprintReadWrite, Config, EditAnywhere, Category = "Text Appearance")
|
||||
FSlateFontInfo Font;
|
||||
|
||||
/** Drop shadow offset in pixels */
|
||||
UPROPERTY(BlueprintReadWrite, Config, EditAnywhere, Category = "Text Appearance")
|
||||
FVector2D ShadowOffset = FVector2D::ZeroVector;
|
||||
|
||||
/** Shadow color and opacity */
|
||||
UPROPERTY(BlueprintReadWrite, Config, EditAnywhere, Category = "Text Appearance")
|
||||
FLinearColor ShadowColorAndOpacity = FLinearColor::White;
|
||||
|
||||
/** How the text should be aligned with the margin. */
|
||||
UPROPERTY(BlueprintReadWrite, Config, EditAnywhere, Category = "Text Appearance")
|
||||
TEnumAsByte <ETextJustify::Type> Justification = ETextJustify::Left;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FThrobberSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** How many pieces there are */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Appearance, meta = (ClampMin = "1", ClampMax = "25", UIMin = "1", UIMax = "25"))
|
||||
int32 NumberOfPieces = 3;
|
||||
|
||||
/** Should the pieces animate horizontally? */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Appearance)
|
||||
bool bAnimateHorizontally = true;
|
||||
|
||||
/** Should the pieces animate vertically? */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Appearance)
|
||||
bool bAnimateVertically = true;
|
||||
|
||||
/** Should the pieces animate their opacity? */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Appearance)
|
||||
bool bAnimateOpacity = true;
|
||||
|
||||
/** Image to use for each segment of the throbber */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Appearance)
|
||||
FSlateBrush Image;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FCircularThrobberSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** How many pieces there are */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Appearance, meta = (ClampMin = "1", ClampMax = "25", UIMin = "1", UIMax = "25"))
|
||||
int32 NumberOfPieces = 6;
|
||||
|
||||
/** The amount of time for a full circle (in seconds) */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Appearance, meta = (ClampMin = "0", UIMin = "0"))
|
||||
float Period = 0.75f;
|
||||
|
||||
/** The radius of the circle. If the throbber is a child of Canvas Panel, the 'Size to Content' option must be enabled in order to set Radius. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Appearance)
|
||||
float Radius = 64.0f;
|
||||
|
||||
/** Image to use for each segment of the throbber */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Appearance)
|
||||
FSlateBrush Image;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FImageSequenceSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** An array of images for animating the loading icon.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting", meta = (AllowedClasses = "/Script/Engine.Texture2D"))
|
||||
TArray<UTexture2D*> Images;
|
||||
|
||||
/** Scale of the images.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FVector2D Scale = FVector2D(1.0f, 1.0f);
|
||||
|
||||
/**
|
||||
* Time in second to update the images, the smaller value the faster of the animation. A zero value will update the images every frame.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting", meta = (UIMax = 1.00, UIMin = 0.00, ClampMin = "0", ClampMax = "1"))
|
||||
float Interval = 0.05f;
|
||||
|
||||
/** Play the image sequence in reverse.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
bool bPlayReverse = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Background widget for the widget loading screen
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ASYNCLOADINGSCREEN_API FBackgroundSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// The images randomly display while in the loading screen on top of the movie
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Background", meta = (AllowedClasses = "/Script/Engine.Texture2D"))
|
||||
TArray<FSoftObjectPath> Images;
|
||||
|
||||
// The scaling type to apply to images.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Background")
|
||||
TEnumAsByte<EStretch::Type> ImageStretch = EStretch::ScaleToFit;
|
||||
|
||||
/** The padding area between the border and the image it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Background")
|
||||
FMargin Padding;
|
||||
|
||||
// The border's background color if there is any image defined. If padding = 0 you will not see the border color.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Background")
|
||||
FLinearColor BackgroundColor = FLinearColor::Black;
|
||||
|
||||
/**
|
||||
* If true, you will have to manually set which background index you want to display on the loading screen by calling "SetDisplayBackgroundIndex" function
|
||||
* in your Blueprint before opening a new level. If the index you set is not valid, then it will display random background in the "Images" array.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Background")
|
||||
bool bSetDisplayBackgroundManually = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Loading widget settings
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ASYNCLOADINGSCREEN_API FLoadingWidgetSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
FLoadingWidgetSettings();
|
||||
|
||||
/** Loading icon type*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
ELoadingIconType LoadingIconType = ELoadingIconType::LIT_CircularThrobber;
|
||||
|
||||
/** Loading Widget type*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
ELoadingWidgetType LoadingWidgetType = ELoadingWidgetType::LWT_Horizontal;
|
||||
|
||||
/** Render transform translation of the loading icon.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FVector2D TransformTranslation = FVector2D(0.0f, 0.0f);
|
||||
|
||||
/** Render transform scale of the loading icon, a negative value will flip the icon.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FVector2D TransformScale = FVector2D(1.0f, 1.0f);
|
||||
|
||||
/** Render transform pivot of the loading icon (in normalized local space).*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FVector2D TransformPivot = FVector2D(0.5f, 0.5f);
|
||||
|
||||
// Text displayed beside the animated icon
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FText LoadingText;
|
||||
|
||||
/** Is Loading Text on the right of the loading icon? Ignore this if you don't choose Loading Widget Type = Horizontal.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
bool bLoadingTextRightPosition = true;
|
||||
|
||||
/** Is Loading Text on the top of the loading icon? Ignore this if you don't choose Loading Widget Type = Vertical.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
bool bLoadingTextTopPosition = true;
|
||||
|
||||
// Loading text appearance settings
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tip Settings")
|
||||
FTextAppearance Appearance;
|
||||
|
||||
/** Throbber settings. Ignore this if you don't choose the 'Throbber' icon type*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FThrobberSettings ThrobberSettings;
|
||||
|
||||
/** Circular Throbber settings. Ignore this if you don't choose the 'Circular Throbber' icon type*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FCircularThrobberSettings CircularThrobberSettings;
|
||||
|
||||
/** Image Sequence settings. Ignore this if you don't choose the 'Image Sequence' icon type*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Widget Setting")
|
||||
FImageSequenceSettings ImageSequenceSettings;
|
||||
|
||||
/** The alignment of the loading text.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Widget Setting")
|
||||
FWidgetAlignment TextAlignment;
|
||||
|
||||
/** The alignment of the loading icon. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Widget Setting")
|
||||
FWidgetAlignment LoadingIconAlignment;
|
||||
|
||||
/** Empty space between the loading text and the loading icon */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Widget Setting")
|
||||
float Space = 1.0f;
|
||||
|
||||
/** Hide the loading widget when the level loading is complete*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Widget Setting")
|
||||
bool bHideLoadingWidgetWhenCompletes = false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Tips text settings
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ASYNCLOADINGSCREEN_API FTipSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// The tip text randomly display in the loading screen.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tip Settings", meta = (MultiLine = true))
|
||||
TArray<FText> TipText;
|
||||
|
||||
// Tip text appearance settings
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tip Settings")
|
||||
FTextAppearance Appearance;
|
||||
|
||||
// The size of the tip before it's wrapped to the next line
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tip Settings")
|
||||
float TipWrapAt = 0.0f;
|
||||
|
||||
/**
|
||||
* If true, you will have to manually set which TipText index you want to display on the loading screen by calling "SetDisplayTipTextIndex" function
|
||||
* in your Blueprint before opening a new level. If the index you set is not valid, then it will display random Tip in the "TipText" array.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Background")
|
||||
bool bSetDisplayTipTextManually = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* The text that displayed when loading is complete. Ignore this if you don't set "bShowLoadingCompletedText" = true
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ASYNCLOADINGSCREEN_API FLoadingCompleteTextSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// FLoadingCompleteTextSettings();
|
||||
|
||||
// The text that shows up when level loading is done.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Complete Text Settings")
|
||||
FText LoadingCompleteText;
|
||||
|
||||
// Text appearance settings
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Complete Text Settings")
|
||||
FTextAppearance Appearance;
|
||||
|
||||
/** The alignment of the text.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Loading Widget Setting")
|
||||
FWidgetAlignment Alignment;
|
||||
|
||||
/** Text padding. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Complete Text Settings")
|
||||
FMargin Padding;
|
||||
|
||||
// Animate the text?
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Complete Text Settings")
|
||||
bool bFadeInOutAnim = true;
|
||||
|
||||
/**
|
||||
* Animation speed
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Complete Text Settings", meta = (UIMax = 10.00, UIMin = 0.00, ClampMin = "0", ClampMax = "10"))
|
||||
float AnimationSpeed = 1.0f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Loading Screen Settings
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct ASYNCLOADINGSCREEN_API FALoadingScreenSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// The minimum time that a loading screen should be opened for, -1 if there is no minimum time. I recommend set it to -1.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
float MinimumLoadingScreenDisplayTime = -1;
|
||||
|
||||
// If true, the loading screen will disappear as soon as loading is done.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bAutoCompleteWhenLoadingCompletes = true;
|
||||
|
||||
// If true, movies can be skipped by clicking the loading screen as long as loading is done.
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bMoviesAreSkippable = true;
|
||||
|
||||
/**
|
||||
* If true, movie playback continue until Stop is called.
|
||||
*
|
||||
* NOTE: If set "Minimum Loading Screen Display Time" = -1, it will allow players to press any key to stop the loading screen.
|
||||
* If "Minimum Loading Screen Display Time" >= 0, you have to call "StopLoadingScreen" in the BeginPlay event
|
||||
* of your GameInstance, GameMode, or PlayerController blueprint to stop the loading screen ("bAllowEngineTick" must be true)
|
||||
**/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bWaitForManualStop = false;
|
||||
|
||||
/** If true loading screens here cannot have any uobjects of any kind or use any engine features at all. This will start the movies very early as a result on platforms that support it */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bAllowInEarlyStartup = false;
|
||||
|
||||
/** If true, this will call the engine tick while the game thread is stalled waiting for a loading movie to finish. This only works for post-startup load screens and is potentially unsafe */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bAllowEngineTick = false;
|
||||
|
||||
/** Should we just play back, loop, etc. NOTE: if the playback type is MT_LoopLast, then bAutoCompleteWhenLoadingCompletes will be togged on when the last movie is hit*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
TEnumAsByte<EMoviePlaybackType> PlaybackType = EMoviePlaybackType::MT_Normal;
|
||||
|
||||
/**
|
||||
* All movie files must be locate at Content/Movies/ directory. Suggested format: MPEG-4 Movie (mp4). Enter file path/name without the extension.
|
||||
* E.g., if you have a movie name my_movie.mp4 in the 'Content/Movies' folder, then enter my_movie in the input field.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
TArray<FString> MoviePaths;
|
||||
|
||||
/**
|
||||
* If true, shuffle the movies list before playing.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bShuffle = false;
|
||||
|
||||
/**
|
||||
* If true, the "Shuffle" option will be ignored, and you will have to manually set which Movie index you want to display on the loading screen
|
||||
* by calling "SetDisplayMovieIndex" function in your Blueprint before opening a new level.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Movies Settings")
|
||||
bool bSetDisplayMovieIndexManually = false;
|
||||
|
||||
|
||||
/**
|
||||
* Should we show the loading screen widgets (background/tips/loading widget)? Generally you'll want to set this to false if you just want to show a movie.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
bool bShowWidgetOverlay = true;
|
||||
|
||||
/**
|
||||
* If true show a text when level loading is completed. Ignore this if you choose "Show Widget Overlay" = false
|
||||
*
|
||||
* NOTE: To enable this option properly, you need to set "Wait For Manual Stop" = true, and "Minimum Loading Screen Display Time" = -1.
|
||||
* This also allows players press any button to stop the Loading Screen.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
bool bShowLoadingCompleteText = false;
|
||||
|
||||
/**
|
||||
* The text that displayed when loading is complete. Ignore this if you set "Show Loading Complete Text" = false.
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
FLoadingCompleteTextSettings LoadingCompleteTextSettings;
|
||||
|
||||
/** Background widget for the loading screen. Ignore this if you choose "Show Widget Overlay = false" */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
FBackgroundSettings Background;
|
||||
|
||||
/** Tip widget for the loading screen. Ignore this if you choose "Show Widget Overlay = false" */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
FTipSettings TipWidget;
|
||||
|
||||
/** Loading widget for the loading screen. Ignore this if you choose "Show Widget Overlay = false" */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
FLoadingWidgetSettings LoadingWidget;
|
||||
|
||||
/**
|
||||
* Select async loading screen Layout. Ignore this if you choose "Show Widget Overlay = false"
|
||||
*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Loading Screen Settings")
|
||||
EAsyncLoadingScreenLayout Layout = EAsyncLoadingScreenLayout::ALSL_Classic;
|
||||
};
|
||||
|
||||
/** Classic Layout settings*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FClassicLayoutSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Is the border that contains loading and tip widget located at the bottom or top? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Classic Layout")
|
||||
bool bIsWidgetAtBottom = true;
|
||||
|
||||
/** Is loading widget on the left of the tip? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Classic Layout")
|
||||
bool bIsLoadingWidgetAtLeft = true;
|
||||
|
||||
/** The empty space between loading widget and the tip.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Classic Layout")
|
||||
float Space = 1.0f;
|
||||
|
||||
/** The alignment of the tips. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Classic Layout")
|
||||
FWidgetAlignment TipAlignment;
|
||||
|
||||
/** The horizontal alignment of the border background.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Center Layout")
|
||||
TEnumAsByte<EHorizontalAlignment> BorderHorizontalAlignment = EHorizontalAlignment::HAlign_Fill;
|
||||
|
||||
/** The padding area between the border and the widget it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Classic Layout")
|
||||
FMargin BorderPadding;
|
||||
|
||||
/** Background appearance settings for the border widget */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Classic Layout")
|
||||
FSlateBrush BorderBackground;
|
||||
};
|
||||
|
||||
/** Center Layout settings*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FCenterLayoutSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Is tip located at the bottom or top? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Center Layout")
|
||||
bool bIsTipAtBottom = true;
|
||||
|
||||
/** The alignment of the tips. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Center Layout")
|
||||
FWidgetAlignment TipAlignment;
|
||||
|
||||
/** The horizontal alignment of the border.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Center Layout")
|
||||
TEnumAsByte<EHorizontalAlignment> BorderHorizontalAlignment = EHorizontalAlignment::HAlign_Fill;
|
||||
|
||||
/** Offset to bottom or top of the screen depending on the tip located at the bottom or top position.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Center Layout")
|
||||
float BorderVerticalOffset = 0.0f;
|
||||
|
||||
/** The padding area between the border and the tips it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Center Layout")
|
||||
FMargin BorderPadding;
|
||||
|
||||
/** Background appearance settings for tip area */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Center Layout")
|
||||
FSlateBrush BorderBackground;
|
||||
};
|
||||
|
||||
/** Letterbox Layout settings*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FLetterboxLayoutSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Is loading widget located at the bottom or top? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Letterbox Layout")
|
||||
bool bIsLoadingWidgetAtTop = true;
|
||||
|
||||
/** The alignment of the tips. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Letterbox Layout")
|
||||
FWidgetAlignment TipAlignment;
|
||||
|
||||
/** The alignment of the loading widget. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Letterbox Layout")
|
||||
FWidgetAlignment LoadingWidgetAlignment;
|
||||
|
||||
/** The horizontal alignment of the top border.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Letterbox Layout")
|
||||
TEnumAsByte<EHorizontalAlignment> TopBorderHorizontalAlignment = EHorizontalAlignment::HAlign_Fill;
|
||||
|
||||
/** The horizontal alignment of the bottom border.*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Letterbox Layout")
|
||||
TEnumAsByte<EHorizontalAlignment> BottomBorderHorizontalAlignment = EHorizontalAlignment::HAlign_Fill;
|
||||
|
||||
/** The top padding area between the border and the widget it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Letterbox Layout")
|
||||
FMargin TopBorderPadding;
|
||||
|
||||
/** The bottom padding area between the border and the widget it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Letterbox Layout")
|
||||
FMargin BottomBorderPadding;
|
||||
|
||||
/** Background appearance settings for top border */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Letterbox Layout")
|
||||
FSlateBrush TopBorderBackground;
|
||||
|
||||
/** Background appearance settings for bottom border */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Letterbox Layout")
|
||||
FSlateBrush BottomBorderBackground;
|
||||
};
|
||||
|
||||
/** Sidebar Layout settings*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FSidebarLayoutSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Is the border that contains loading and tip widgets located at the right or left? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
bool bIsWidgetAtRight = true;
|
||||
|
||||
/** Is loading widget on the top of the tip? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
bool bIsLoadingWidgetAtTop = true;
|
||||
|
||||
/** The empty space between loading widget and the tip.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
float Space = 1.0f;
|
||||
|
||||
/** The vertical alignment of the vertical box that contains loading/tip widgets. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
TEnumAsByte<EVerticalAlignment> VerticalAlignment = EVerticalAlignment::VAlign_Center;
|
||||
|
||||
/** The alignment of the loading widget. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sidebar Layout")
|
||||
FWidgetAlignment LoadingWidgetAlignment;
|
||||
|
||||
/** The alignment of the tips. */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sidebar Layout")
|
||||
FWidgetAlignment TipAlignment;
|
||||
|
||||
/** The vertical alignment of the border background that contains all widgets. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
TEnumAsByte<EVerticalAlignment> BorderVerticalAlignment = EVerticalAlignment::VAlign_Fill;
|
||||
|
||||
/** Offset to left or right of the screen depending on the border that contains loading and tip widgets located at the left or right position.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
float BorderHorizontalOffset = 0.0f;
|
||||
|
||||
/** The padding area between the border and the widget it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
FMargin BorderPadding;
|
||||
|
||||
/** Background appearance settings for the border widget */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Sidebar Layout")
|
||||
FSlateBrush BorderBackground;
|
||||
};
|
||||
|
||||
/** Dual Sidebar Layout settings*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FDualSidebarLayoutSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** Is loading widget on the right or left border? */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
bool bIsLoadingWidgetAtRight = true;
|
||||
|
||||
/** The vertical alignment of the left widget. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
TEnumAsByte<EVerticalAlignment> LeftVerticalAlignment = EVerticalAlignment::VAlign_Center;
|
||||
|
||||
/** The vertical alignment of the right widget. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
TEnumAsByte<EVerticalAlignment> RightVerticalAlignment = EVerticalAlignment::VAlign_Center;
|
||||
|
||||
/** The vertical alignment of the left border background that contains all widgets. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
TEnumAsByte<EVerticalAlignment> LeftBorderVerticalAlignment = EVerticalAlignment::VAlign_Fill;
|
||||
|
||||
/** The vertical alignment of the right border background that contains all widgets. */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
TEnumAsByte<EVerticalAlignment> RightBorderVerticalAlignment = EVerticalAlignment::VAlign_Fill;
|
||||
|
||||
/** The padding area between the left border and the widget it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
FMargin LeftBorderPadding;
|
||||
|
||||
/** The padding area between the right border and the widget it contains.*/
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
FMargin RightBorderPadding;
|
||||
|
||||
/** Background appearance settings for the left border widget */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
FSlateBrush LeftBorderBackground;
|
||||
|
||||
/** Background appearance settings for the right border widget */
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Dual Sidebar Layout")
|
||||
FSlateBrush RightBorderBackground;
|
||||
};
|
||||
|
||||
/**
|
||||
* Async Loading Screen Settings
|
||||
*/
|
||||
UCLASS(Config = "Game", defaultconfig, meta = (DisplayName = "Async Loading Screen"))
|
||||
class ASYNCLOADINGSCREEN_API ULoadingScreenSettings : public UDeveloperSettings
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
ULoadingScreenSettings(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
|
||||
|
||||
/**
|
||||
* If true, load all background images at the start of the game.
|
||||
*
|
||||
* This is a workaround for the issue when the background image
|
||||
* is loaded too late with the wrong image scaling.
|
||||
*
|
||||
* This issue only happens in the Standalone or Launch mode.
|
||||
* The packaged game should work fine.
|
||||
*
|
||||
* If you don't encounter this issue when developing, don't enable
|
||||
* this option, since it will keep the background images in the
|
||||
* memory all the time, therefore consumes memory resources.
|
||||
*
|
||||
* However, you can manually remove all the preloaded background
|
||||
* images by calling the Blueprint function
|
||||
* "RemovePreloadedBackgroundImages"
|
||||
*
|
||||
* You will need to re-load all background images by calling
|
||||
* the Blueprint function "PreloadBackgroundImages"
|
||||
*
|
||||
* Note: Call "PreloadBackgroundImages" before the "OpenLevel"
|
||||
*
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "General")
|
||||
bool bPreloadBackgroundImages = false;
|
||||
|
||||
/**
|
||||
* The startup loading screen when you first open the game. Setup any studio logo movies here.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "General")
|
||||
FALoadingScreenSettings StartupLoadingScreen;
|
||||
|
||||
/**
|
||||
* The default loading screen that shows up whenever you open a new level.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "General")
|
||||
FALoadingScreenSettings DefaultLoadingScreen;
|
||||
|
||||
/**
|
||||
* Classic Layout settings.
|
||||
* The Classic is a simple, generic layout and fits well with many designs.
|
||||
* A border that contains loading and tip widgets can be at the bottom or top.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "Layout")
|
||||
FClassicLayoutSettings Classic;
|
||||
|
||||
/**
|
||||
* Center Layout settings.
|
||||
* The loading widget is at the center of the screen, tip widget can be at the bottom or top.
|
||||
* The Center layout is a good choice if your loading icon is the main design.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "Layout")
|
||||
FCenterLayoutSettings Center;
|
||||
|
||||
/**
|
||||
* Letterbox Layout settings.
|
||||
* The Letterbox layout has two borders on top and bottom of the screen. Loading widget
|
||||
* can be on the top and the tip is at the bottom of the screen, or vice versa.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "Layout")
|
||||
FLetterboxLayoutSettings Letterbox;
|
||||
|
||||
/**
|
||||
* Sidebar Layout settings.
|
||||
* The Sidebar layout has a vertical border on the left or right of the screen. The Sidebar
|
||||
* is suitable for storytelling, long paragraphs due to the height of the tip widget.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "Layout")
|
||||
FSidebarLayoutSettings Sidebar;
|
||||
|
||||
/**
|
||||
* Dual Sidebar Layout settings
|
||||
* Similar to Sidebar layout but Dual Sidebar layout has two vertical borders on both left and right of the screen.
|
||||
* The Dual Sidebar layout is suitable for storytelling, long paragraphs due to the height of the tip widget.
|
||||
*/
|
||||
UPROPERTY(Config, EditAnywhere, Category = "Layout")
|
||||
FDualSidebarLayoutSettings DualSidebar;
|
||||
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
struct FBackgroundSettings;
|
||||
class FDeferredCleanupSlateBrush;
|
||||
|
||||
/**
|
||||
* Background widget
|
||||
*/
|
||||
class SBackgroundWidget : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SBackgroundWidget) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, const FBackgroundSettings& Settings);
|
||||
|
||||
private:
|
||||
TSharedPtr<FDeferredCleanupSlateBrush> ImageBrush;
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingScreenLayout.h"
|
||||
|
||||
struct FALoadingScreenSettings;
|
||||
struct FCenterLayoutSettings;
|
||||
|
||||
/**
|
||||
* Center layout loading screen
|
||||
*/
|
||||
class SCenterLayout : public SLoadingScreenLayout
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SCenterLayout) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/**
|
||||
* Construct this widget
|
||||
*/
|
||||
void Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FCenterLayoutSettings& LayoutSettings);
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingScreenLayout.h"
|
||||
|
||||
struct FALoadingScreenSettings;
|
||||
struct FClassicLayoutSettings;
|
||||
|
||||
/**
|
||||
* Classic layout loading screen
|
||||
*/
|
||||
class SClassicLayout : public SLoadingScreenLayout
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SClassicLayout) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/**
|
||||
* Construct this widget
|
||||
*/
|
||||
void Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FClassicLayoutSettings& LayoutSettings);
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingScreenLayout.h"
|
||||
|
||||
struct FALoadingScreenSettings;
|
||||
struct FDualSidebarLayoutSettings;
|
||||
|
||||
/**
|
||||
* Dual Sidebar Layout
|
||||
*/
|
||||
class SDualSidebarLayout : public SLoadingScreenLayout
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SDualSidebarLayout) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/**
|
||||
* Construct this widget
|
||||
*/
|
||||
void Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FDualSidebarLayoutSettings& LayoutSettings);
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingWidget.h"
|
||||
|
||||
struct FLoadingWidgetSettings;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class SHorizontalLoadingWidget : public SLoadingWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SHorizontalLoadingWidget) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, const FLoadingWidgetSettings& Settings);
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingScreenLayout.h"
|
||||
|
||||
struct FALoadingScreenSettings;
|
||||
struct FLetterboxLayoutSettings;
|
||||
|
||||
/**
|
||||
* Letterbox layout loading screen
|
||||
*/
|
||||
class SLetterboxLayout : public SLoadingScreenLayout
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SLetterboxLayout) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/**
|
||||
* Construct this widget
|
||||
*/
|
||||
void Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FLetterboxLayoutSettings& LayoutSettings);
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
struct FLoadingCompleteTextSettings;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class SLoadingCompleteText : public SCompoundWidget
|
||||
{
|
||||
private:
|
||||
// Complete text color
|
||||
FLinearColor CompleteTextColor = FLinearColor::White;
|
||||
|
||||
// Complete text fade in or fade out animation
|
||||
bool bCompleteTextReverseAnim = false;
|
||||
|
||||
// Complete text animation speed
|
||||
float CompleteTextAnimationSpeed = 1.0f;
|
||||
|
||||
// Active timer registered flag
|
||||
bool bIsActiveTimerRegistered = false;
|
||||
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SLoadingCompleteText) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, const FLoadingCompleteTextSettings& CompleteTextSettings);
|
||||
|
||||
// Getter for text visibility
|
||||
EVisibility GetLoadingCompleteTextVisibility() const;
|
||||
|
||||
// Getter for complete text color and opacity
|
||||
FSlateColor GetLoadingCompleteTextColor() const;
|
||||
|
||||
/** Active timer event for animating the image sequence */
|
||||
EActiveTimerReturnType AnimateText(double InCurrentTime, float InDeltaTime);
|
||||
};
|
@ -1,22 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
/**
|
||||
* Loading screen base theme
|
||||
*/
|
||||
class SLoadingScreenLayout : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
static float PointSizeToSlateUnits(float PointSize);
|
||||
protected:
|
||||
float GetDPIScale() const;
|
||||
};
|
@ -1,54 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
#include "Widgets/Images/SThrobber.h"
|
||||
#include "LoadingScreenSettings.h"
|
||||
|
||||
class FDeferredCleanupSlateBrush;
|
||||
struct FLoadingWidgetSettings;
|
||||
|
||||
/**
|
||||
* Loading Widget base class
|
||||
*/
|
||||
class SLoadingWidget : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
|
||||
// SWidgetOverrides
|
||||
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
|
||||
|
||||
/** Gets the combined value of the animation properties as a single SThrobber::EAnimation value. */
|
||||
SThrobber::EAnimation GetThrobberAnimation(const FThrobberSettings& ThrobberSettings) const;
|
||||
|
||||
/** Construct loading icon*/
|
||||
void ConstructLoadingIcon(const FLoadingWidgetSettings& Settings);
|
||||
|
||||
protected:
|
||||
// Placeholder widgets
|
||||
TSharedRef<SWidget> LoadingIcon = SNullWidget::NullWidget;
|
||||
// Image slate brush list
|
||||
TArray<TSharedPtr<FDeferredCleanupSlateBrush>> CleanupBrushList;
|
||||
|
||||
// Play image sequence in reverse
|
||||
bool bPlayReverse = false;
|
||||
|
||||
// Current image sequence index
|
||||
mutable int32 ImageIndex = 0;
|
||||
|
||||
// Current total delta time
|
||||
mutable float TotalDeltaTime = 0.0f;
|
||||
|
||||
//Time in second to update the images, the smaller value the faster of the animation. A zero value will update the images every frame.
|
||||
float Interval = 0.05f;
|
||||
|
||||
// Getter for text visibility
|
||||
EVisibility GetLoadingWidgetVisibility() const;
|
||||
};
|
@ -1,30 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingScreenLayout.h"
|
||||
|
||||
struct FALoadingScreenSettings;
|
||||
struct FSidebarLayoutSettings;
|
||||
|
||||
/**
|
||||
* Sidebar layout loading screen
|
||||
*/
|
||||
class SSidebarLayout : public SLoadingScreenLayout
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SSidebarLayout) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
/**
|
||||
* Construct this widget
|
||||
*/
|
||||
void Construct(const FArguments& InArgs, const FALoadingScreenSettings& Settings, const FSidebarLayoutSettings& LayoutSettings);
|
||||
};
|
@ -1,26 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Widgets/SCompoundWidget.h"
|
||||
|
||||
struct FTipSettings;
|
||||
|
||||
/**
|
||||
* Tip widget
|
||||
*/
|
||||
class STipWidget : public SCompoundWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(STipWidget) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, const FTipSettings& Settings);
|
||||
};
|
@ -1,24 +0,0 @@
|
||||
/************************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2020 Truong Bui. *
|
||||
* Website: https://github.com/truong-bui/AsyncLoadingScreen *
|
||||
* Licensed under the MIT License. See 'LICENSE' file for full license information. *
|
||||
* *
|
||||
************************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SLoadingWidget.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class SVerticalLoadingWidget : public SLoadingWidget
|
||||
{
|
||||
public:
|
||||
SLATE_BEGIN_ARGS(SVerticalLoadingWidget) {}
|
||||
|
||||
SLATE_END_ARGS()
|
||||
|
||||
void Construct(const FArguments& InArgs, const FLoadingWidgetSettings& Settings);
|
||||
};
|
Reference in New Issue
Block a user