complete
This commit is contained in:
parent
1ad9d9e48a
commit
09ae2330b9
Binary file not shown.
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/MaterialsLibrary/M_BlinkColor.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/MaterialsLibrary/M_BlinkColor.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/UI_CheatMenu.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Blueprints/UI_CheatMenu.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset
(Stored with Git LFS)
BIN
UnrealProject/Lost_Edge/Content/UI/Components/UIC_ComboBox.uasset
(Stored with Git LFS)
Binary file not shown.
@ -96,6 +96,16 @@ FString UContentLoader::SelectContentByMethod(const TArray<FString>& content, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UContentLoader::TryConnectToServer(FContentDownloadedCallback result)
|
||||||
|
{
|
||||||
|
FHttpRequestCompleteDelegate indexRequestCallback;
|
||||||
|
indexRequestCallback.BindLambda([=](FHttpRequestPtr request, FHttpResponsePtr response, bool successful)
|
||||||
|
{
|
||||||
|
result.ExecuteIfBound(!successful ? "" : "Connected");
|
||||||
|
});
|
||||||
|
HttpGet(pakIndexUrl, indexRequestCallback);
|
||||||
|
}
|
||||||
|
|
||||||
void UContentLoader::DownloadPak(FContentDownloadedCallback downloadedCallback, const FString& directory, const EContentDownloadMethod method)
|
void UContentLoader::DownloadPak(FContentDownloadedCallback downloadedCallback, const FString& directory, const EContentDownloadMethod method)
|
||||||
{
|
{
|
||||||
const FString url = FString::Printf(TEXT("%s%s/"), pakIndexUrl, *directory);
|
const FString url = FString::Printf(TEXT("%s%s/"), pakIndexUrl, *directory);
|
||||||
@ -259,4 +269,4 @@ bool UContentLoader::UnloadPak(const FString& pakFilePath)
|
|||||||
FPackageName::UnRegisterMountPoint("/Game/", mountPoint);
|
FPackageName::UnRegisterMountPoint("/Game/", mountPoint);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@ class UContentLoader : public UGameInstanceSubsystem
|
|||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "ContentLoader")
|
||||||
|
void TryConnectToServer(FContentDownloadedCallback result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "ContentLoader")
|
UFUNCTION(BlueprintCallable, Category = "ContentLoader")
|
||||||
void DownloadPak(FContentDownloadedCallback downloadedCallback, const FString& directory = "", const EContentDownloadMethod method = EContentDownloadMethod::NonRepeatRandom);
|
void DownloadPak(FContentDownloadedCallback downloadedCallback, const FString& directory = "", const EContentDownloadMethod method = EContentDownloadMethod::NonRepeatRandom);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "CustomGameInstance.h"
|
#include "CustomGameInstance.h"
|
||||||
|
|
||||||
|
#include "AssetRegistry/AssetRegistryModule.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "Kismet/KismetSystemLibrary.h"
|
#include "Kismet/KismetSystemLibrary.h"
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ void UCustomGameInstance::Init()
|
|||||||
else
|
else
|
||||||
saveData = Cast<USaveData>(UGameplayStatics::CreateSaveGameObject(USaveData::StaticClass()));
|
saveData = Cast<USaveData>(UGameplayStatics::CreateSaveGameObject(USaveData::StaticClass()));
|
||||||
|
|
||||||
|
(void)GetLevelsList();
|
||||||
//FCoreUObjectDelegates::PreLoadMap.AddLambda([&](const FString& mapName)
|
//FCoreUObjectDelegates::PreLoadMap.AddLambda([&](const FString& mapName)
|
||||||
// {
|
// {
|
||||||
// if(auto loadingScreen = FModuleManager::LoadModulePtr<FLoadingScreen>("LoadingScreen"))
|
// if(auto loadingScreen = FModuleManager::LoadModulePtr<FLoadingScreen>("LoadingScreen"))
|
||||||
@ -78,6 +80,42 @@ UObject* UCustomGameInstance::GetGlobalInstance(UClass* _class)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TArray<UWorld*> UCustomGameInstance::GetLevelsList()
|
||||||
|
{
|
||||||
|
#if WITH_EDITOR
|
||||||
|
return {}; // to slow for editor, just use cmd or open a file
|
||||||
|
#else
|
||||||
|
static TArray<UWorld*> result;
|
||||||
|
if(result.Num() > 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
FAssetRegistryModule& arm = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
|
||||||
|
arm.Get().SearchAllAssets(true);
|
||||||
|
|
||||||
|
FARFilter filter;
|
||||||
|
filter.ClassPaths.Add({ "/Script/Engine", "World" });
|
||||||
|
filter.bRecursivePaths = true;
|
||||||
|
filter.PackagePaths.Add(FName("/Game/Levels"));
|
||||||
|
|
||||||
|
TArray<FAssetData> assets;
|
||||||
|
arm.Get().GetAssets(filter, assets);
|
||||||
|
|
||||||
|
result.Reserve(assets.Num());
|
||||||
|
for(auto& i : assets)
|
||||||
|
result.Add(static_cast<UWorld*>(i.GetAsset()));
|
||||||
|
|
||||||
|
return MoveTemp(result);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
UWorld* UCustomGameInstance::GetCurrentWorld()
|
||||||
|
{
|
||||||
|
if(auto GI = Get())
|
||||||
|
return GI->GetWorld();
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool UCustomGameInstance::IsGameSaved()
|
bool UCustomGameInstance::IsGameSaved()
|
||||||
{
|
{
|
||||||
if(auto GI = Get())
|
if(auto GI = Get())
|
||||||
|
@ -30,6 +30,11 @@ public:
|
|||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
static UObject* GetGlobalInstance(UClass* _class);
|
static UObject* GetGlobalInstance(UClass* _class);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintPure)
|
||||||
|
static TArray<UWorld*> GetLevelsList();
|
||||||
|
UFUNCTION(BlueprintPure)
|
||||||
|
static UWorld* GetCurrentWorld();
|
||||||
|
|
||||||
/** Return true is save data are present and valid */
|
/** Return true is save data are present and valid */
|
||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
static bool IsGameSaved();
|
static bool IsGameSaved();
|
||||||
|
Loading…
Reference in New Issue
Block a user