Loading Screen (#13)

Reviewed-on: #13
Co-authored-by: Oleg Petruny <oleg.petruny@gmail.com>
Co-committed-by: Oleg Petruny <oleg.petruny@gmail.com>
This commit is contained in:
Oleg Petruny 2025-05-01 16:10:43 +00:00 committed by oleg.petruny
parent 71ff7e773d
commit 727921f1a4
71 changed files with 257 additions and 106 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 351 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 378 KiB

View File

@ -1,5 +1,3 @@
[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=09D27A7F49EDD2A17DE1879F3BDEF448
ProjectVersion=0.1
@ -133,3 +131,7 @@ bShouldAcquireMissingChunksOnLoad=False
bShouldWarnAboutInvalidAssets=True
MetaDataTagsForAssetRegistry=()
[/Script/LoadingScreenSettings.LoadingScreenSettings]
minimumDisplayTime=2.000000
levels=(("/Game/Levels/Test/L_Test.L_Test", NSLOCTEXT("[/Script/LoadingScreenSettings]", "38913E074A1A7FB8CEC17CA454DB93CA", "Test level")),("/Game/Levels/Level_1/L_Level1.L_Level1", NSLOCTEXT("[/Script/LoadingScreenSettings]", "F5CCDF174DFA012184FEC8815ECFC60A", "Chapter 1")),("/Game/Levels/Level_2/L_Level2.L_Level2", NSLOCTEXT("[/Script/LoadingScreenSettings]", "CFCC13A248739EEE82C1D4B184356774", "Chapter 2")),("/Game/Levels/Level_3/L_Level3.L_Level3", NSLOCTEXT("[/Script/LoadingScreenSettings]", "3132A33A4C4D1781D269F88B79713C68", "Chapter 3")),("/Game/Levels/Level_4/L_Level4.L_Level4", NSLOCTEXT("[/Script/LoadingScreenSettings]", "C0EA4190480108E377AA78AA7BAA3A05", "Chapter 4")),("/Game/Levels/Level_5/L_Level5.L_Level5", NSLOCTEXT("[/Script/LoadingScreenSettings]", "61D418214496DCBC2286B89D87611BE2", "Chapter 5")))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -22,6 +22,11 @@
"AdditionalDependencies": [
"Engine"
]
},
{
"Name": "Lost_EdgeStyle",
"Type": "Runtime",
"LoadingPhase": "PostConfigInit"
}
],
"Plugins": [

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,8 +2,10 @@
using UnrealBuildTool;
public class Lost_EdgeTarget : TargetRules {
public Lost_EdgeTarget(TargetInfo Target) : base(Target) {
public class Lost_EdgeTarget : TargetRules
{
public Lost_EdgeTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.Latest;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;

View File

@ -12,7 +12,7 @@ public class Lost_Edge : ModuleRules
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OpenCV" });
PrivateDependencyModuleNames.AddRange(new string[] { "EnhancedInput", "UMG", "RHI", "RenderCore", "Lost_EdgeShaders", "PakFile", //"TextureCompressor",
"LevelSequence", "MovieScene", "HTTP", "Json", "ApplicationCore", "ProceduralMeshComponent", "Landscape", }); // "Slate", "SlateCore"
"LevelSequence", "MovieScene", "HTTP", "Json", "ApplicationCore", "ProceduralMeshComponent", "Landscape" });
if (Target.bBuildEditor)
{

View File

@ -1,4 +0,0 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "Lost_EdgeGameModeBase.h"

View File

@ -1,17 +0,0 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "Lost_EdgeGameModeBase.generated.h"
/**
*
*/
UCLASS()
class LOST_EDGE_API ALost_EdgeGameModeBase : public AGameModeBase
{
GENERATED_BODY()
};

View File

@ -16,13 +16,13 @@ struct FIntByteView
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
uint8 first;
uint8 first = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
uint8 second;
uint8 second = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
uint8 third;
uint8 third = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
uint8 fourth;
uint8 fourth = 0;
static FIntByteView Make(const int32 in);
int32 AsInt() const;
@ -70,7 +70,6 @@ public:
UFUNCTION(BlueprintPure, Category = TypeCasts)
static FIntByteView MakeIntByteView(const int32 in);
UFUNCTION(BlueprintPure)

View File

@ -24,7 +24,7 @@ namespace
const auto pakFileSavePath = FString::Printf(TEXT("%sDownloaded/"), *FPaths::ProjectDir());
}
void UContentLoader::BeginDestroy()
void UContentLoader::Deinitialize()
{
//if(mountedFiles.Num() > 0)
//{
@ -34,7 +34,7 @@ void UContentLoader::BeginDestroy()
// FPlatformFileManager::Get().RemovePlatformFile(GetPakPlatformFile());
//}
UObject::BeginDestroy();
Super::Deinitialize();
}
void UContentLoader::HttpGet(const FString& url, FHttpRequestCompleteDelegate requestCompleteCallback)

View File

@ -3,7 +3,7 @@
#pragma once
#include "Http.h"
#include "UObject/Object.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "ContentLoader.generated.h"
@ -21,7 +21,7 @@ DECLARE_DYNAMIC_DELEGATE_OneParam(FContentDownloadedCallback, FString, pakFilePa
* High language wrapper for Paks(Assets) download and loading.
*/
UCLASS(BlueprintType)
class UContentLoader : public UObject
class UContentLoader : public UGameInstanceSubsystem
{
GENERATED_BODY()
@ -36,7 +36,7 @@ public:
bool UnloadPak(const FString& pakFilePath);
protected:
virtual void BeginDestroy() override;
virtual void Deinitialize() override;
/** Sends http get request */
void HttpGet(const FString& url, FHttpRequestCompleteDelegate requestCompleteCallback);

View File

@ -21,11 +21,11 @@ UCustomGameInstance* UCustomGameInstance::instance = nullptr;
void UCustomGameInstance::Init()
{
// init game instance
UGameInstance::Init();
instance = this;
contentLoader = NewObject<UContentLoader>(this);
// setup global singletons
for(auto& _class : globalInstancesClasses)
{
UObject* gi = NewObject<UObject>(_class);
@ -34,10 +34,19 @@ void UCustomGameInstance::Init()
}
globalInstancesClasses.Empty();
// set current save
if(auto save = UGameplayStatics::LoadGameFromSlot(saveName, saveIndex))
saveData = Cast<USaveData>(save);
else
saveData = Cast<USaveData>(UGameplayStatics::CreateSaveGameObject(USaveData::StaticClass()));
//FCoreUObjectDelegates::PreLoadMap.AddLambda([&](const FString& mapName)
// {
// if(auto loadingScreen = FModuleManager::LoadModulePtr<FLoadingScreen>("LoadingScreen"))
// loadingScreen->StartLoadingScreen();
// });
//FCoreUObjectDelegates::PostLoadMapWithWorld.AddLambda(loadingScreen, &ULoadingScreen::EndLoadingScreen);
}
void UCustomGameInstance::Shutdown()
@ -56,7 +65,7 @@ UCustomGameInstance* UCustomGameInstance::Get()
UContentLoader* UCustomGameInstance::GetContentLoader()
{
if(auto GI = Get())
return GI->contentLoader;
return GI->GetSubsystem<UContentLoader>();
return nullptr;
}

View File

@ -25,7 +25,7 @@ public:
UFUNCTION(BlueprintPure, meta = (DisplayName = "Get Custom Game Instance"))
static UCustomGameInstance* Get();
UFUNCTION(BlueprintPure)
UFUNCTION(BlueprintPure, meta = (DeprecatedFunction, DeprecationMessage = "Use original Get Submodule pure function instead."))
static class UContentLoader* GetContentLoader();
UFUNCTION(BlueprintPure)
static UObject* GetGlobalInstance(UClass* _class);
@ -50,9 +50,6 @@ public:
class USaveData* saveData = nullptr;
protected:
UPROPERTY()
class UContentLoader* contentLoader;
UPROPERTY(EditDefaultsOnly)
TSet<TSubclassOf<UObject>> globalInstancesClasses;
TMap<UClass*, UObject*> globalInstances;

View File

@ -159,7 +159,6 @@ void UCutsceneManager::OnFirstCutsceneInit() // most first sequence, so widgets
static FSkipCutsceneDelegate skipCutsceneDelegate;
if(!skipCutsceneDelegate.IsBound())
skipCutsceneDelegate.BindDynamic(this, &UCutsceneManager::SkipSequence);
WM->AnimateCutsceneWidget(EInputAnimatedWidgetAnimation::Reset);
WM->EnableCutsceneWidget(skipCutsceneDelegate);
}
}

View File

@ -13,7 +13,7 @@ struct FResolutionAndRefreshRates
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FIntPoint resolution;
FIntPoint resolution = { 0, 0 };
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<int32> refreshRates;
};

View File

@ -85,7 +85,7 @@ protected:
void OnDeactivate(EActivatorType type);
/** Mask of active activator types */
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (Bitmask, BitmaskEnum = "EActivatorType"))
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (Bitmask, BitmaskEnum = "/Script/Lost_Edge.EActivatorType"))
int32 activated = 0;
UPROPERTY(EditAnywhere)
bool lockOnBeginPlay = false;

View File

@ -51,7 +51,7 @@ protected:
UPROPERTY(EditDefaultsOnly)
TArray<FText> inputDescription;
UPROPERTY(EditDefaultsOnly, NoClear, meta = (Bitmask, BitmaskEnum = "EActivatorType"))
UPROPERTY(EditDefaultsOnly, NoClear, meta = (Bitmask, BitmaskEnum = "/Script/Lost_Edge.EActivatorType"))
int32 activatorTypes = 0;
};

View File

@ -12,19 +12,19 @@ struct FFishVariation
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float difficulty;
float difficulty = 1.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float size;
float size = 1.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float duration;
float duration = 1.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 price;
int32 price = 100;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FLinearColor color;
FLinearColor color = FLinearColor::Blue;
};
UCLASS(Blueprintable, BlueprintType, MinimalAPI)

View File

@ -17,17 +17,17 @@ struct FPlayerLock
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
uint8 walk : 1;
uint8 walk : 1 = 0;
UPROPERTY(BlueprintReadWrite)
uint8 jump : 1;
uint8 jump : 1 = 0;
UPROPERTY(BlueprintReadWrite)
uint8 run : 1;
uint8 run : 1 = 0;
UPROPERTY(BlueprintReadWrite)
uint8 interaction : 1;
uint8 interaction : 1 = 0;
UPROPERTY(BlueprintReadWrite)
uint8 camera : 1;
uint8 camera : 1 = 0;
UPROPERTY(BlueprintReadWrite)
uint8 inventory : 1;
uint8 inventory : 1 = 0;
static FPlayerLock All();
};

View File

@ -4,5 +4,6 @@ void UCutsceneSkipWidget::SetVisibility(ESlateVisibility InVisibility)
{
if(InVisibility == ESlateVisibility::Hidden)
RunAnimation(EInputAnimatedWidgetAnimation::Reset);
PlayAnimation(unHide, 0.0f, 1, (InVisibility == ESlateVisibility::Visible ? EUMGSequencePlayMode::Forward : EUMGSequencePlayMode::Reverse));
Super::SetVisibility(InVisibility);
}

View File

@ -22,6 +22,9 @@ public:
UPROPERTY(meta = (BindWidget))
class UTextBlock* keyText;
UPROPERTY(Transient, meta = (BindWidgetAnim))
class UWidgetAnimation* unHide;
protected:
UFUNCTION(BlueprintCallable)
void SkipCutscene() { skipCutsceneDelegate.Execute(); }

View File

@ -2,8 +2,10 @@
using UnrealBuildTool;
public class Lost_EdgeEditorTarget : TargetRules {
public Lost_EdgeEditorTarget(TargetInfo Target) : base(Target) {
public class Lost_EdgeEditorTarget : TargetRules
{
public Lost_EdgeEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.Latest;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;

View File

@ -1,13 +1,14 @@
// Oleg Petruny proprietary.
using System.IO;
using UnrealBuildTool;
public class Lost_EdgeShaders : ModuleRules
{
public Lost_EdgeShaders(ReadOnlyTargetRules Target) : base(Target)
{
//bPrecompile = true;
//bUsePrecompiled = true;
//if (File.Exists($"{PlatformDirectory.FullName}\\..\\..\\Intermediate\\Build\\Win64\\x64\\UnrealEditor\\DebugGame\\{Path.GetFileName(PlatformDirectory.FullName)}\\UnrealEditor-{Path.GetFileName(PlatformDirectory.FullName)}-Win64-DebugGame.lib"))
// bUsePrecompiled = true;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { });
PrivateDependencyModuleNames.AddRange(new string[] { "Core",

View File

@ -0,0 +1,23 @@
// Oleg Petruny proprietary.
using System;
using System.IO;
using System.Reflection;
using UnrealBuildTool;
public class Lost_EdgeStyle : ModuleRules
{
public Lost_EdgeStyle(ReadOnlyTargetRules Target) : base(Target)
{
//if (File.Exists($"{PlatformDirectory.FullName}\\..\\..\\Intermediate\\Build\\Win64\\x64\\UnrealEditor\\DebugGame\\{Path.GetFileName(PlatformDirectory.FullName)}\\UnrealEditor-{Path.GetFileName(PlatformDirectory.FullName)}-Win64-DebugGame.lib"))
// bUsePrecompiled = true;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { });
PrivateDependencyModuleNames.AddRange(new string[] {
"Core",
"CoreUObject",
"Slate",
"SlateCore"
});
}
}

View File

@ -0,0 +1,48 @@
// Oleg Petruny proprietary.
#include "Lost_EdgeStyle.h"
#include "Styling/SlateStyleRegistry.h"
TUniquePtr<FSlateStyleSet> FLost_EdgeStyle::style = nullptr;
void FLost_EdgeStyle::StartupModule()
{
if(style.IsValid())
return;
style = MakeUnique<FSlateStyleSet>(GetStyleSetName());
style->Set(TEXT("BackgroundBlack"), FLinearColor(0.01f, 0.01f, 0.01f, 0));
style->Set(TEXT("BackgroundBlack"), FSlateColor(style->GetColor(TEXT("BackgroundBlack"))));
style->Set(TEXT("BackgroundBlack"), new FSlateColorBrush(style->GetColor(TEXT("BackgroundBlack"))));
FSlateStyleRegistry::RegisterSlateStyle(Get());
}
void FLost_EdgeStyle::ShutdownModule()
{
if(!style.IsValid())
return;
FSlateStyleRegistry::UnRegisterSlateStyle(Get());
style.Reset();
}
bool FLost_EdgeStyle::IsGameModule() const
{
return true;
}
const ISlateStyle& FLost_EdgeStyle::Get()
{
return *style.Get();
}
FName FLost_EdgeStyle::GetStyleSetName()
{
static const FName name(TEXT("Lost_EdgeStyle"));
return name;
}
IMPLEMENT_GAME_MODULE(FLost_EdgeStyle, Lost_EdgeStyle);

View File

@ -0,0 +1,21 @@
// Oleg Petruny proprietary.
#pragma once
#include "Modules/ModuleInterface.h"
#include "Styling/SlateStyle.h"
class LOST_EDGESTYLE_API FLost_EdgeStyle : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
virtual bool IsGameModule() const override;
static const ISlateStyle& Get();
static FName GetStyleSetName();
private:
static TUniquePtr<FSlateStyleSet> style;
};