diff --git a/Content/Blueprints/DistanceRing/BP_DistanceRing.uasset b/Content/Blueprints/DistanceRing/BP_DistanceRing.uasset index 0e1a1d84..379c40e6 100644 Binary files a/Content/Blueprints/DistanceRing/BP_DistanceRing.uasset and b/Content/Blueprints/DistanceRing/BP_DistanceRing.uasset differ diff --git a/Content/Blueprints/Managers/BP_Controller.uasset b/Content/Blueprints/Managers/BP_Controller.uasset index 9629503c..de7672c2 100644 Binary files a/Content/Blueprints/Managers/BP_Controller.uasset and b/Content/Blueprints/Managers/BP_Controller.uasset differ diff --git a/Content/Blueprints/Managers/BP_PawnWalking.uasset b/Content/Blueprints/Managers/BP_PawnWalking.uasset index 73b6b35e..ee9648fa 100644 Binary files a/Content/Blueprints/Managers/BP_PawnWalking.uasset and b/Content/Blueprints/Managers/BP_PawnWalking.uasset differ diff --git a/Content/Blueprints/Managers/Floor/BP_FloorManager.uasset b/Content/Blueprints/Managers/Floor/BP_FloorManager.uasset index 5e685199..75b3835b 100644 Binary files a/Content/Blueprints/Managers/Floor/BP_FloorManager.uasset and b/Content/Blueprints/Managers/Floor/BP_FloorManager.uasset differ diff --git a/Content/Core/Data/LevelsRC/DT_LevelsRC.uasset b/Content/Core/Data/LevelsRC/DT_LevelsRC.uasset index a586e510..137eb25d 100644 Binary files a/Content/Core/Data/LevelsRC/DT_LevelsRC.uasset and b/Content/Core/Data/LevelsRC/DT_LevelsRC.uasset differ diff --git a/Content/HUD/Templates/UW_TemplateButton.uasset b/Content/HUD/Templates/UW_TemplateButton.uasset index 4b4a090c..cc68aea4 100644 Binary files a/Content/HUD/Templates/UW_TemplateButton.uasset and b/Content/HUD/Templates/UW_TemplateButton.uasset differ diff --git a/Content/HUD/Widgets/UW_ButtonPoint.uasset b/Content/HUD/Widgets/UW_ButtonPoint.uasset index defa6265..73703ab0 100644 Binary files a/Content/HUD/Widgets/UW_ButtonPoint.uasset and b/Content/HUD/Widgets/UW_ButtonPoint.uasset differ diff --git a/Content/Maps/L_DeveloperTactics.umap b/Content/Maps/L_DeveloperTactics.umap index c4a91472..f57353cc 100644 Binary files a/Content/Maps/L_DeveloperTactics.umap and b/Content/Maps/L_DeveloperTactics.umap differ diff --git a/Content/Maps/L_Test.umap b/Content/Maps/L_Test.umap index 04da0e4a..962a1917 100644 Binary files a/Content/Maps/L_Test.umap and b/Content/Maps/L_Test.umap differ diff --git a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_1.uasset b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_1.uasset index eca93534..f3020d5b 100644 Binary files a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_1.uasset and b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_1.uasset differ diff --git a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_2.uasset b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_2.uasset index 221d34d8..5a7dcfa7 100644 Binary files a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_2.uasset and b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Facade_2.uasset differ diff --git a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_1.uasset b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_1.uasset index 06e48cca..00e8a12f 100644 Binary files a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_1.uasset and b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_1.uasset differ diff --git a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_2.uasset b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_2.uasset index 31858797..807b8cbe 100644 Binary files a/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_2.uasset and b/Content/Taktika/Assets/Exterior/MainBuilding/PROCEDURAL/SM_Exterior_Windows_2.uasset differ diff --git a/Content/Taktika/Assets/Exterior/Yard_V2/SM_TKT_Yard_Inner.uasset b/Content/Taktika/Assets/Exterior/Yard_V2/SM_TKT_Yard_Inner.uasset index b2a895bb..61da9b61 100644 Binary files a/Content/Taktika/Assets/Exterior/Yard_V2/SM_TKT_Yard_Inner.uasset and b/Content/Taktika/Assets/Exterior/Yard_V2/SM_TKT_Yard_Inner.uasset differ diff --git a/Source/FORTIS_Taktika/Private/ResComFloorManager.cpp b/Source/FORTIS_Taktika/Private/ResComFloorManager.cpp index 41fb0ef0..c705eb1b 100644 --- a/Source/FORTIS_Taktika/Private/ResComFloorManager.cpp +++ b/Source/FORTIS_Taktika/Private/ResComFloorManager.cpp @@ -45,6 +45,19 @@ void AResComFloorManager::AddLevelToPack(FApartmentLocation loc, FFloorLevelStre } } +bool AResComFloorManager::GetPack(FApartmentLocation loc, FFloorPack* pack) +{ + for (int i = 0; i < packs.Num(); ++i) + { + if (packs[i].location == loc) + { + pack = &(packs[i]); + return true; + } + } + return false; +} + bool AResComFloorManager::GetPack(FApartmentLocation loc, FFloorPack& pack) const { for (auto& packCurr : packs) @@ -58,45 +71,22 @@ bool AResComFloorManager::GetPack(FApartmentLocation loc, FFloorPack& pack) cons return false; } -bool AResComFloorManager::LoadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded) +//bool AResComFloorManager::LoadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded) +bool AResComFloorManager::LoadPack(FApartmentLocation loc, const FOnLoaded& delegateOnLoaded) { - FFloorPack pack; + FFloorPack* pack = nullptr; if (!GetPack(loc, pack)) return false; + + OnLoaded = delegateOnLoaded; + //OnPreview = delegatePreview; + //OnShouldBeVisible = delegateShouldBeVisible; + //OnShouldBeLoaded = delegateShouldBeLoaded; - OnPreview = delegatePreview; - OnShouldBeVisible = delegateShouldBeVisible; - OnShouldBeLoaded = delegateShouldBeLoaded; - - FLatentActionInfo latentInfo; - latentInfo.CallbackTarget = this; - latentInfo.UUID = 0; - latentInfo.Linkage = 0; - - - /*latentInfo.ExecutionFunction = "OnLevelPreview"; - for (auto& level : pack.levelsPreview) - { - ++queueElem.visibleCnt; - ++latentInfo.UUID; - UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo); - } - - latentInfo.ExecutionFunction = "OnLevelVisible"; - for (auto& level : pack.levelsShouldBeVisible) - { - ++queueElem.previewCnt; - ++latentInfo.UUID; - UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo); - } - - latentInfo.ExecutionFunction = "OnLevelLoaded"; - for (auto& level : pack.levelsShouldBeLoaded) - { - queueElem.loadedCnt; - ++latentInfo.UUID; - UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo); - }*/ + FVector Location(0.0f, 0.0f, 0.0f); + FRotator Rotation(0.0f, 0.0f, 0.0f); + FActorSpawnParameters SpawnInfo; + GetWorld()->SpawnActor(Location, Rotation, SpawnInfo); return true; } diff --git a/Source/FORTIS_Taktika/Private/ResComLevelPackLoader.cpp b/Source/FORTIS_Taktika/Private/ResComLevelPackLoader.cpp new file mode 100644 index 00000000..324cf0f4 --- /dev/null +++ b/Source/FORTIS_Taktika/Private/ResComLevelPackLoader.cpp @@ -0,0 +1,64 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "ResComLevelPackLoader.h" + +// Sets default values +AResComLevelPackLoader::AResComLevelPackLoader() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + PrimaryActorTick.TickInterval = 0.5f; + +} + +// Called when the game starts or when spawned +void AResComLevelPackLoader::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void AResComLevelPackLoader::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + + if (packLoading->IsLoaded()) + { + Destroy(); + } +} + +void AResComLevelPackLoader::LoadPack(FFloorPack* pack) +{ + FLatentActionInfo latentInfo; + latentInfo.CallbackTarget = this; + latentInfo.UUID = 0; + latentInfo.Linkage = 0; + + latentInfo.ExecutionFunction = "OnLevelPreview"; + for (auto& level : pack.levelsPreview) + { + ++queueElem.visibleCnt; + ++latentInfo.UUID; + UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo); + } + + latentInfo.ExecutionFunction = "OnLevelVisible"; + for (auto& level : pack.levelsShouldBeVisible) + { + ++queueElem.previewCnt; + ++latentInfo.UUID; + UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo); + } + + latentInfo.ExecutionFunction = "OnLevelLoaded"; + for (auto& level : pack.levelsShouldBeLoaded) + { + queueElem.loadedCnt; + ++latentInfo.UUID; + UGameplayStatics::LoadStreamLevel(this, *level, true, true, latentInfo); + } + return true; +} \ No newline at end of file diff --git a/Source/FORTIS_Taktika/Public/ResComFloorManager.h b/Source/FORTIS_Taktika/Public/ResComFloorManager.h index daf468ca..36b4b8a3 100644 --- a/Source/FORTIS_Taktika/Public/ResComFloorManager.h +++ b/Source/FORTIS_Taktika/Public/ResComFloorManager.h @@ -1,6 +1,7 @@ // Fill out your copyright notice in the Description page of Project Settings. #pragma once +#include "ResComLevelPackLoader.h" #include "Engine/LevelStreaming.h" #include "Kismet/GameplayStatics.h" #include "ResComApartmentManager.h" @@ -13,6 +14,7 @@ DECLARE_DYNAMIC_DELEGATE(FOnPreview); DECLARE_DYNAMIC_DELEGATE(FOnShouldBeVisible); DECLARE_DYNAMIC_DELEGATE(FOnShouldBeLoaded); +DECLARE_DYNAMIC_DELEGATE(FOnLoaded); UENUM(BlueprintType) enum Enum_LevelType @@ -47,6 +49,23 @@ struct FFloorPack UPROPERTY(EditAnywhere, BlueprintReadWrite) TArray levels; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + bool loaded = false; + + bool IsLoaded() + { + loaded = false; + for (auto& level : levels) + { + if (!IsValid(level.level)) + return loaded; + if (!(level.level->IsLevelVisible())) + return loaded; + } + loaded = true; + return loaded; + } }; UCLASS() @@ -63,6 +82,7 @@ private: void OnLevelVisible(); UFUNCTION() void OnLevelLoaded(); + bool GetPack(FApartmentLocation loc, FFloorPack* pack); public: // Sets default values for this actor's properties AResComFloorManager(); @@ -78,6 +98,8 @@ protected: FOnShouldBeVisible OnShouldBeVisible; UPROPERTY() FOnShouldBeLoaded OnShouldBeLoaded; + UPROPERTY() + FOnLoaded OnLoaded; UFUNCTION(BlueprintCallable, Category = "Pack") void AddLevelToPack(FApartmentLocation loc, FFloorLevelStreaming level); @@ -93,7 +115,8 @@ public: virtual void Tick(float DeltaTime) override; UFUNCTION(BlueprintCallable, Category="Pack") - bool LoadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded); + //bool LoadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded); + bool LoadPack(FApartmentLocation loc, const FOnLoaded& delegateOnLoaded); UFUNCTION(BlueprintCallable, Category = "Pack") bool UnloadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded); diff --git a/Source/FORTIS_Taktika/Public/ResComLevelPackLoader.h b/Source/FORTIS_Taktika/Public/ResComLevelPackLoader.h new file mode 100644 index 00000000..c88fc492 --- /dev/null +++ b/Source/FORTIS_Taktika/Public/ResComLevelPackLoader.h @@ -0,0 +1,30 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "ResComFloorManager.h" +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "ResComLevelPackLoader.generated.h" + +UCLASS() +class FORTIS_TAKTIKA_API AResComLevelPackLoader : public AActor +{ + GENERATED_BODY() +private: + FFloorPack* packLoading; +public: + // Sets default values for this actor's properties + AResComLevelPackLoader(); + AResComLevelPackLoader(FFloorPack* pack) : packLoading(pack){} + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + void LoadPack(FFloorPack* pack); + +};