ffffffuuuuuuuuuu

This commit is contained in:
Dron
2023-06-19 17:13:11 +05:00
commit 3fffad5317
89 changed files with 4872 additions and 0 deletions
@@ -0,0 +1,172 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CPPFunctionLibrary.h"
#include <chrono>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <vector>
#include <memory>
#include <stdexcept>
#include <string>
#include <array>
void UCPPFunctionLibrary::CreateTxt(FString Path, FString FileName, FString text)
{
if (Path == "") {
Path = FPaths::ProjectSavedDir();
}
FString fullpath(Path + FileName);
FFileHelper::SaveStringToFile(text, *fullpath, FFileHelper::EEncodingOptions::ForceUTF8);
}
bool UCPPFunctionLibrary::AppendStringToFile(FString DirPath, FString FileName, FString Data)
{
// get file path
FString FilePath;
if (!DirPath.Len())
{
// default documents directory path + FileName
FilePath = FPlatformProcess::UserDir() + FileName;
}
else
{
FilePath = DirPath + FileName;
}
UE_LOG(LogTemp, Log, TEXT("File path: %s"), *FilePath);
// check file existence and write data to a file
FString OldData;
bool append_result;
if (FPaths::FileExists(FilePath))
{
UE_LOG(LogTemp, Log, TEXT("File exists: true"));
FFileHelper::LoadFileToString(OldData, *FilePath);
OldData += Data;
append_result = FFileHelper::SaveStringToFile(Data, *FilePath, FFileHelper::EEncodingOptions::ForceUTF8, &IFileManager::Get(), FILEWRITE_Append);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("File exists: false"));
append_result = FFileHelper::SaveStringToFile(Data, *FilePath, FFileHelper::EEncodingOptions::ForceUTF8);
}
// return append result
if (append_result)
{
UE_LOG(LogTemp, Log, TEXT("Append: complete"));
return true;
}
else
{
UE_LOG(LogTemp, Error, TEXT("Append: not complete"));
return false;
}
}
void UCPPFunctionLibrary::RunSystemCommand(FString Command)
{
system(TCHAR_TO_ANSI(*Command));
}
void UCPPFunctionLibrary::GetExcelData(FString Command)
{
}
void UCPPFunctionLibrary::GetContentHTTP(FString Verb, FString Payload, FString Url)
{
/*TSharedPtr<IHttpRequest, ESPMode::ThreadSafe> Request = FHttpModule::Get().CreateRequest();
Request->SetURL(Url);
if (Payload.Len() > 0)
{
Request->SetContentAsString(Payload);
}
Request->SetVerb(Verb);
Request->ProcessRequest();*/
}
int32 UCPPFunctionLibrary::GetUnixTimestamp()
{
return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
void UCPPFunctionLibrary::CreateProc(FString PathToExec, TArray<FString> Args, bool Detach, bool Hidden, int32 Priority, FString OptionalWorkDir)
{
FString StrArgs("");
/*if (Args.Num())
for (auto arg : Args)
StrArgs += " " + arg;*/
if (Args.Num() > 1)
{
StrArgs = Args[0];
for (int32 v = 1; v < Args.Num(); v++)
{
StrArgs += " " + Args[v];
}
}
else if (Args.Num() > 0)
{
StrArgs = Args[0];
}
FProcHandle PHandle = FPlatformProcess::CreateProc(
*PathToExec,
*StrArgs,
Detach,
Hidden,
Hidden,
nullptr,
Priority,
(OptionalWorkDir != "") ? *OptionalWorkDir : nullptr,
nullptr
);
if (PHandle.IsValid())
{
UE_LOG(LogTemp, Warning, TEXT("ProcInfo: Valid"))
}
else
{
UE_LOG(LogTemp, Warning, TEXT("ProcInfo: NotValid"))
}
}
FString UCPPFunctionLibrary::GetDataFromFile(FString FileName)
{
FString FileData("");
if (FPaths::FileExists(FileName))
FFileHelper::LoadFileToString(FileData, *FileName);
return FileData;
}
TArray<FString> UCPPFunctionLibrary::GetHardDisksSerialNumbers()
{
TArray<FString> lines;
std::string executeCommand = "wmic path win32_physicalmedia get SerialNumber";
std::array<char, 128> buffer;
std::string result;
std::unique_ptr<FILE, decltype(&_pclose)> pipe(_popen(executeCommand.c_str(), "r"), _pclose);
if (!pipe) {
throw std::runtime_error("popen() failed!");
}
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
result += buffer.data();
}
std::cout << result << std::endl;
std::istringstream istream(result);
std::string line;
int lineNum = 0;
while (std::getline(istream, line))
{
if (!lineNum)
{
++lineNum;
continue;
}
lines.Push(line.c_str());
}
return lines;
}
@@ -0,0 +1,50 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
//#include "HttpModule.h"
#include <string>
#include <functional>
#include "CoreMinimal.h"
#include "Misc/FileHelper.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CPPFunctionLibrary.generated.h"
/**
*
*/
UCLASS()
class FORTIS_TAKTIKA_API UCPPFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "TextMaker")
static void CreateTxt(FString Path, FString FileName, FString text);
UFUNCTION(BlueprintCallable, Category = "File")
static bool AppendStringToFile(FString DirPath, FString FileName, FString Data);
UFUNCTION(BlueprintCallable, Category = "File")
static FString GetDataFromFile(FString FileName);
UFUNCTION(BlueprintCallable, Category = "System")
static void RunSystemCommand(FString Command);
UFUNCTION(BlueprintCallable, Category = "System")
static void GetExcelData(FString Command);
UFUNCTION(BlueprintCallable, Category = "HTTP")
static void GetContentHTTP(FString Verb, FString Payload, FString Url);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Time")
static int32 GetUnixTimestamp();
UFUNCTION(BlueprintCallable, Category = "System")
static void CreateProc(FString PathToExec, TArray<FString> Args, bool Detach = false, bool Hidden = true, int32 Priority = 0, FString OptionalWorkDir = "");
UFUNCTION(BlueprintCallable, Category = "System")
static TArray<FString> GetHardDisksSerialNumbers();
};
@@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class FORTIS_Taktika : ModuleRules
{
public FORTIS_Taktika(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Http", "Json", "JsonUtilities" });
PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
+6
View File
@@ -0,0 +1,6 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "FORTIS_Taktika.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, FORTIS_Taktika, "FORTIS_Taktika" );
+6
View File
@@ -0,0 +1,6 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
@@ -0,0 +1,66 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "BuildingProcedural.h"
// Sets default values
ABuildingProcedural::ABuildingProcedural()
{
// 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;
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
}
// Called when the game starts or when spawned
void ABuildingProcedural::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ABuildingProcedural::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ABuildingProcedural::ShowCurrentIndex(int32 Index, TArray<UProceduralMeshComponent*> ProceduralMeshes)
{
int32 i;
for (i = 0; i < ProceduralMeshes.Num(); ++i)
{
if (i <= Index)
{
ProceduralMeshes[i]->SetHiddenInGame(false);
}
}
for (i = 0; i < ProceduralMeshes.Num(); ++i)
{
if (i >= Index)
{
ProceduralMeshes[i]->SetHiddenInGame(true);
}
}
}
void ABuildingProcedural::ResetMeshSections(TArray<UProceduralMeshComponent*> ProceduralMeshes)
{
//ProceduralMeshes[i]->GetProcMeshSection(0);
for (auto& ProcMesh : ProceduralMeshes)
{
for (int i = 0; i < ProcMesh->GetNumSections(); ++i)
{
ProcMesh->GetProcMeshSection(i)->Reset();
//ProcMesh->GetProcMeshSection(i)->
//ProcMesh->SetProcMeshSection
//ProcMesh->SetProcMeshSection();
//FProcMeshSection ProcMeshSection;
//StaticMesh
}
}
}
@@ -0,0 +1,66 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CppAnimation.h"
CppAnimation::CppAnimation()
{
}
CppAnimation::~CppAnimation()
{
}
CppAnimation::CppAnimation(UUserWidget* owner, UWidgetAnimation* animation, TArray<FCppStruct_AnimModeDirection>* modes, TEnumAsByte<Enum_AnimMode>* lastMode, int32* priority)
: WidgetOwner(owner),
WidgetAnimation(animation),
AnimModes(*modes),
lastMode(*lastMode),
priorityIndex(*priority)
{
}
void CppAnimation::PlayAnimationMode(TEnumAsByte<Enum_AnimMode>* mode, int32* priority)
{
if (!CanMode(mode))
return;
if (!CanPlayAnimation(mode))
return;
if (priorityIndex > *priority)
return;
lastMode = *mode;
WidgetOwner->PlayAnimation(WidgetAnimation, 0.0f, 1, GetDirection(mode), 1.0f, false);
}
TEnumAsByte<EUMGSequencePlayMode::Type> CppAnimation::GetDirection(TEnumAsByte<Enum_AnimMode>* mode)
{
for (auto anim : AnimModes)
{
if (anim.mode == *mode)
return anim.direction;
}
return EUMGSequencePlayMode::Type::Forward;
}
bool CppAnimation::CanMode(TEnumAsByte<Enum_AnimMode>* mode)
{
bool canMode = false;
for (int32 i = 0; i < AnimModes.Num(); ++i)
{
if (AnimModes[i].mode == *mode)
{
canMode = true;
}
}
return canMode;
}
bool CppAnimation::CanPlayAnimation(TEnumAsByte<Enum_AnimMode>* mode)
{
if (!CanMode(mode))
return false;
return lastMode != *mode;
}
@@ -0,0 +1,50 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CppBaseWidget.h"
void UCppBaseWidget::NativeConstruct()
{
Super::NativeConstruct();
}
void UCppBaseWidget::NativeTick(const FGeometry& MyGeometry, float DeltaTime)
{
Super::NativeTick(MyGeometry, DeltaTime);
}
bool UCppBaseWidget::CanTick(float interval)
{
if ((GetWorld()->GetTimeSeconds() - timeLastTick) > interval)
{
timeLastTick = GetWorld()->GetTimeSeconds();
return true;
}
return false;
}
void UCppBaseWidget::PlayAnimationMode(TEnumAsByte<Enum_AnimMode> mode, int32 priorityIndex)
{
CppAnimation* animation = GetAnimationWithMode(&mode);
if (!animation)
return;
animation->PlayAnimationMode(&mode, &priorityIndex);
}
CppAnimation* UCppBaseWidget::GetAnimationWithMode(TEnumAsByte<Enum_AnimMode>* mode)
{
for (int32 i = 0; i < Animations.Num(); ++i)
{
if (Animations[i].CanMode(mode))
return &Animations[i];
}
return nullptr;
}
void UCppBaseWidget::AddAnimation(UUserWidget* owner, UWidgetAnimation* animation, TArray<FCppStruct_AnimModeDirection> modes, TEnumAsByte<Enum_AnimMode> modeAtCreation, int32 priorityIndex)
{
Animations.Add(CppAnimation(owner, animation, &modes, &modeAtCreation, &priorityIndex));
}
@@ -0,0 +1,12 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CppEnums.h"
CppEnums::CppEnums()
{
}
CppEnums::~CppEnums()
{
}
@@ -0,0 +1,5 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CppStruct_AnimModeDirection.h"
@@ -0,0 +1,12 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CppStructures.h"
CppStructures::CppStructures()
{
}
CppStructures::~CppStructures()
{
}
@@ -0,0 +1,40 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "LevelManager.h"
// Sets default values
ALevelManager::ALevelManager()
{
// 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;
}
// Called when the game starts or when spawned
void ALevelManager::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ALevelManager::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
bool ALevelManager::LoadLevel(FString LevelName, bool bVisible, bool bLoad)
{
ULevelStreaming* Level = UGameplayStatics::GetStreamingLevel(GetWorld(), *LevelName);
if (!Level)
return false;
Level->SetShouldBeLoaded(bLoad);
Level->SetShouldBeVisible(bVisible);
while (Level->IsLevelVisible() ^ bVisible && Level->IsLevelLoaded() ^ bLoad)
{
}
return true;
}
@@ -0,0 +1,70 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComApartmentManager.h"
// Sets default values
UResComApartmentManager::UResComApartmentManager()
{
}
void UResComApartmentManager::Push(FApartment apartment)
{
apartments.Push(apartment);
}
void UResComApartmentManager::ClearFavorites()
{
for (auto& ap : apartments)
ap.favorite = false;
}
bool UResComApartmentManager::IsValid(FApartment apartment) const
{
return !(apartment.id == FApartment().id);
}
FApartment& UResComApartmentManager::GetByID(int32 id)
{
for (auto& ap : apartments)
{
if (ap.id == id)
return ap;
}
return notValid;
}
FApartment& UResComApartmentManager::GetByLoc(FApartmentLocation loc)
{
for (auto& ap : apartments)
{
if (ap.loc == loc)
return ap;
}
return notValid;
}
TArray<FApartment> UResComApartmentManager::GetFavorites()
{
TArray<FApartment> favorites;
for (auto& ap : apartments)
if (ap.favorite)
favorites.Push(ap);
return favorites;
}
void UResComApartmentManager::SortByLoc()
{
apartments.Sort([](const FApartment& apa1, const FApartment& apa2)
{
return apa1.loc.AsNum() > apa2.loc.AsNum();
});
}
void UResComApartmentManager::SortByID()
{
apartments.Sort([](const FApartment& apa1, const FApartment& apa2)
{
return apa1.id > apa2.id;
});
}
@@ -0,0 +1,174 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComFloorManager.h"
// Sets default values
AResComFloorManager::AResComFloorManager()
{
// 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;
}
// Called when the game starts or when spawned
void AResComFloorManager::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AResComFloorManager::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AResComFloorManager::AddPack(const FFloorPack& pack)
{
packs.Add(pack);
}
void AResComFloorManager::AddLevelToPack(FApartmentLocation loc, FFloorLevelStreaming level)
{
FFloorPack pack;
if (GetPack(loc, pack))
{
UE_LOG(LogTemp, Warning, TEXT("COUNT: %d"), pack.levels.Num());
pack.levels.Add(level);
}
else
{
pack.location = loc;
pack.levels.Add(level);
AddPack(pack);
}
}
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)
{
if (packCurr.location == loc)
{
pack = packCurr;
return true;
}
}
return false;
}
//bool AResComFloorManager::LoadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded)
bool AResComFloorManager::LoadPack(FApartmentLocation loc, const FOnLoaded& delegateOnLoaded)
{
FFloorPack* pack = nullptr;
if (!GetPack(loc, pack))
return false;
OnLoaded = delegateOnLoaded;
//OnPreview = delegatePreview;
//OnShouldBeVisible = delegateShouldBeVisible;
//OnShouldBeLoaded = delegateShouldBeLoaded;
FVector Location(0.0f, 0.0f, 0.0f);
FRotator Rotation(0.0f, 0.0f, 0.0f);
FActorSpawnParameters SpawnInfo;
GetWorld()->SpawnActor<AResComLevelPackLoader>(Location, Rotation, SpawnInfo);
return true;
}
bool AResComFloorManager::UnloadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded)
{
FFloorPack pack;
if (!GetPack(loc, pack))
return false;
FLatentActionInfo info;
//for (auto& level : pack.levelsPreview)
//{
// UGameplayStatics::UnloadStreamLevel(this,* level, info, false);
// //Streamlevel
//}
//for (auto& level : pack.levelsShouldBeVisible)
//{
// UGameplayStatics::UnloadStreamLevel(this, *level, info, false);
//}
//for (auto& level : pack.levelsShouldBeLoaded)
//{
// UGameplayStatics::UnloadStreamLevel(this, *level, info, false);
//}
OnPreview = delegatePreview;
OnShouldBeVisible = delegateShouldBeVisible;
OnShouldBeLoaded = delegateShouldBeLoaded;
return true;
}
void AResComFloorManager::OnLevelPreview()
{
OnPreview.Execute();
}
void AResComFloorManager::OnLevelVisible()
{
OnShouldBeVisible.Execute();
}
void AResComFloorManager::OnLevelLoaded()
{
OnShouldBeLoaded.Execute();
}
TArray<ULevelStreaming*> AResComFloorManager::GetStreamingLevels(const UObject* WorldContextObject)
{
TArray<ULevelStreaming*> levels;
UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
for (ULevelStreaming* LevelStreaming : World->GetStreamingLevels())
{
levels.Push(LevelStreaming);
}
return levels;
}
//ULevelStreaming* UGameplayStatics::GetStreamingLevel(const UObject* WorldContextObject, FName InPackageName)
//{
// if (InPackageName != NAME_None)
// {
// if (UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull))
// {
// FString SearchPackageName = FStreamLevelAction::MakeSafeLevelName(InPackageName, World);
// if (FPackageName::IsShortPackageName(SearchPackageName))
// {
// // Make sure MyMap1 and Map1 names do not resolve to a same streaming level
// SearchPackageName = TEXT("/") + SearchPackageName;
// }
//
// for (ULevelStreaming* LevelStreaming : World->GetStreamingLevels())
// {
// // We check only suffix of package name, to handle situations when packages were saved for play into a temporary folder
// // Like Saved/Autosaves/PackageName
// if (LevelStreaming && LevelStreaming->GetWorldAssetPackageName().EndsWith(SearchPackageName, ESearchCase::IgnoreCase))
// {
// return LevelStreaming;
// }
// }
// }
// }
//
// return NULL;
//}
@@ -0,0 +1,123 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComGameInstance.h"
UResComGameInstance::UResComGameInstance()
{
}
void UResComGameInstance::Init()
{
Super::Init();
apartmentManager = NewObject<UResComApartmentManager>(this);
statisticsManager = NewObject<UResComStatistics>(this);
}
//void UResComGameInstance::SetApartmentManager(UResComApartmentManager* manager)
//{
// apartmentManager = manager;
//}
UResComApartmentManager* UResComGameInstance::GetApartmentManager() const
{
return apartmentManager;
}
UResComStatistics* UResComGameInstance::GetStatisticsManager() const
{
return statisticsManager;
}
//void UResComGameInstance::HttpGet(FString UrlAddress, const FHttpDelegate& Callback)
//{
// /*TSharedRef<IHttpRequest, ESPMode::ThreadSafe> HttpRequest = FHttpModule::Get().CreateRequest();
// HttpRequest->SetHeader("Content-Type", "application/json");
// HttpRequest->SetURL(UrlAddress);
// HttpRequest->SetVerb("GET");
// HttpRequest->OnProcessRequestComplete().BindUObject(this, &ThisClass::OnHttpRequestComplete);
// HttpRequest->ProcessRequest();*/
//
// if (UrlAddress.IsEmpty())
// return;
//
// const TSharedRef<IHttpRequest, ESPMode::ThreadSafe> HttpRequest{ FHttpModule::Get().CreateRequest() };
//
//
// HttpRequest->SetVerb("GET");
// HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/x-www-form-urlencoded"));
// HttpRequest->SetURL(UrlAddress);
// HttpRequest->SetTimeout(2.0f);
//
// HttpRequest->OnProcessRequestComplete().BindUObject(this, &UCppGameInstance::OnHttpRequestComplete);
// //HttpRequest->OnRequestProgress().BindUObject(this, &URuntimeFilesDownloaderLibrary::OnProgress_Internal);
//
// /** Process the request */
// HttpRequest->ProcessRequest();
//
// //HttpDownloadRequest = &HttpRequest.Get();
//}
//
//void UResComGameInstance::OnHttpRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
//{
// if (bWasSuccessful && Response->GetContentType() == "application/json")
// {
//
// HttpData = Response->GetContentAsString();
// UE_LOG(LogTemp, Warning, TEXT("HttpInfo: Success"));
//
// }
// else
// {
// if (Response->GetResponseCode() == 200)
// HttpData = HttpData = Response->GetContentAsString();
// UE_LOG(LogTemp, Error, TEXT("HttpInfo: string %s"), *HttpData);
// UE_LOG(LogTemp, Error, TEXT("HttpInfo: eror code %s"), *(FString::FromInt(Response->GetResponseCode())));
// if (bWasSuccessful)
// {
// UE_LOG(LogTemp, Error, TEXT("HttpInfo: ErrorA"));
// }
// else
// UE_LOG(LogTemp, Error, TEXT("HttpInfo: ErrorB"));
// // Handle error here
// }
//}
//
//FString UResComGameInstance::GetHttpData()
//{
// return HttpData;
//}
@@ -0,0 +1,14 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComHUD.h"
void AResComHUD::SetUIStateManager(AResComUIStateManager* manager)
{
UIStateManager = manager;
}
AResComUIStateManager* AResComHUD::GetUIManager() const
{
return UIStateManager;
}
@@ -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;*/
//}
@@ -0,0 +1,56 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComPlayerController.h"
void AResComPlayerController::SetPlayerStateManager(AResComPlayerStateManager* manager)
{
playerStateManager = manager;
}
AResComPlayerStateManager* AResComPlayerController::GetPlayerStateManager() const
{
return playerStateManager;
}
void AResComPlayerController::SetFloorManager(AResComFloorManager* manager)
{
floorManager = manager;
}
AResComFloorManager* AResComPlayerController::GetFloorManager() const
{
return floorManager;
}
//void AResComPoint::BeginPlay()
//{
// Super::BeginPlay();
//
// // spectrator window
// /*SlateWin = SNew(SWindow)
// .AutoCenter(EAutoCenter::None)
// .Title(FText::FromString(TEXT("Control Window")))
// .IsInitiallyMaximized(false)
// .ScreenPosition(FVector2D(0, 0))
// .ClientSize(FVector2D(500, 800))
// .CreateTitleBar(true)
// .SizingRule(ESizingRule::UserSized)
// .SupportsMaximize(false)
// .SupportsMinimize(true)
// .HasCloseButton(true);
//
// TSharedRef<SWindow> SlateWinRef = SlateWin.ToSharedRef();
//
// FSlateApplication& SlateApp = FSlateApplication::Get();
//
// SlateApp.AddWindow(SlateWinRef, true);
//
// SlateWinRef->SetContent(SNew(SControlWidget));*/
//}
void AResComPlayerController::freeMemory()
{
GEngine->ForceGarbageCollection();
//GetWorld()->ForceGarbageCollection(true);
}
@@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComPlayerStateManager.h"
void AResComPlayerStateManager::SetState(const TEnumAsByte<Enum_PlayerState> newState)
{
if (stateManager.SetState(newState))
OnState(newState);
}
void AResComPlayerStateManager::ClearAllStatesBesideLast()
{
stateManager.ClearAllStatesBesideLast();
}
void AResComPlayerStateManager::SetPreviousState()
{
if (stateManager.SetPrevState())
OnState(stateManager.GetState());
}
const FString AResComPlayerStateManager::GetStateHistoryAsString() const
{
FString string;
FString arrow("->");
auto history = stateManager.GetHistory();
for (auto item : history)
string += arrow + (*UEnum::GetDisplayValueAsText(item).ToString());
return string;
}
const TEnumAsByte<Enum_PlayerState> AResComPlayerStateManager::GetState() const
{
return stateManager.GetState();
}
@@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComPoint.h"
// Sets default values
AResComPoint::AResComPoint()
{
// 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;
}
// Called when the game starts or when spawned
void AResComPoint::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AResComPoint::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
@@ -0,0 +1,11 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComState.h"
//UResComState* UResComState::Make(int32 index)
//{
// UResComState* newObject = NewObject<UResComState>(UResComState::StaticClass());
// newObject->state = index;
// return newObject;
//}
@@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComStateManager.h"
@@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComStatistics.h"
void UResComStatistics::NewState(FString state)
{
if (prevState.duration != 0.0f)
{
prevState.duration = GetWorld()->GetTimeSeconds() - prevState.duration;
stateHistory.Add(prevState);
}
prevState.state = state;
prevState.duration = GetWorld()->GetTimeSeconds();
}
FString UResComStatistics::GetStateHistoryString()
{
FString strTmp("");
for (auto& state : stateHistory)
{
strTmp += "->" + state.state;
}
return strTmp;
}
void UResComStatistics::StartVR()
{
timeLastStartVR = GetWorld()->GetTimeSeconds();
}
void UResComStatistics::EndVR()
{
timeVR += GetWorld()->GetTimeSeconds() - timeLastStartVR;
}
@@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComUIStateManager.h"
void AResComUIStateManager::SetState(const TEnumAsByte<Enum_UIState> newState)
{
if (stateManager.SetState(newState))
OnState(newState);
}
void AResComUIStateManager::ClearAllStatesBesideLast()
{
stateManager.ClearAllStatesBesideLast();
}
void AResComUIStateManager::SetPreviousState()
{
if (stateManager.SetPrevState())
OnState(stateManager.GetState());
}
const FString AResComUIStateManager::GetStateHistoryAsString() const
{
FString string;
FString arrow("->");
auto history = stateManager.GetHistory();
for (auto item : history)
string += arrow + (*UEnum::GetDisplayValueAsText(item).ToString());
return string;
}
const TEnumAsByte<Enum_UIState> AResComUIStateManager::GetState() const
{
return stateManager.GetState();
}
@@ -0,0 +1,12 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComUserManager.h"
UResComUserManager::UResComUserManager()
{
}
UResComUserManager::~UResComUserManager()
{
}
@@ -0,0 +1,86 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "ResComUserStoreLocalData.h"
#include "../CPPFunctionLibrary.h"
UResComUserStoreLocalData::UResComUserStoreLocalData()
{
}
UResComUserStoreLocalData::~UResComUserStoreLocalData()
{
}
void UResComUserStoreLocalData::SetWorkingDirectory(FString path)
{
WorkingDirectoryPath = path;
}
FStruct_User UResComUserStoreLocalData::GetEmptyUser()
{
return FStruct_User();
}
FStruct_User UResComUserStoreLocalData::GetUser(FString phone)
{
FString FileData;
if (!FPaths::FileExists(WorkingDirectoryPath))
return GetEmptyUser();
FFileHelper::LoadFileToString(WorkingDirectoryPath, *FileData);
if (!FileData.Len())
return GetEmptyUser();
if (!FileData.Contains(phone))
return GetEmptyUser();
int32 startIndex = FileData.Find(phone);
int32 endIndex = FileData.Find(FString("\n"), ESearchCase::IgnoreCase, ESearchDir::FromStart, startIndex);
return GetUserFromString(FileData.Mid(startIndex, endIndex - startIndex));
}
void UResComUserStoreLocalData::AddUser(FString Phone, FString Name, FString Email, TArray<FString> FavoriteIDs)
{
}
FStruct_User UResComUserStoreLocalData::GetUserFromString(FString string)
{
int32 commaNum = 0;
FStruct_User user;
FString flatIndex;
for (int i = 0; i < string.Len(); ++i)
{
if (string[i] == ',')
{
if (commaNum > 2)
{
user.favoriteFlatsIndices.Add(FCString::Atoi(*flatIndex));
flatIndex.Empty();
}
++commaNum;
}
if (string[i] != ',')
switch (commaNum)
{
case 0:
user.phone += string[i];
break;
case 1:
user.name += string[i];
break;
case 2:
user.email += string[i];
break;
default:
flatIndex += string[i];
break;
}
}
return user;
}
@@ -0,0 +1,32 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
//#include "ProceduralMeshComponent.h" // Path not working
#include "ProceduralMeshComponent.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "BuildingProcedural.generated.h"
UCLASS()
class FORTIS_TAKTIKA_API ABuildingProcedural : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABuildingProcedural();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintCallable)
void ShowCurrentIndex(int32 Index, TArray<UProceduralMeshComponent*> ProceduralMeshes);
UFUNCTION(BlueprintCallable)
void ResetMeshSections(TArray<UProceduralMeshComponent*> ProceduralMeshes);
void SetMeshSection();
};
@@ -0,0 +1,30 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CppStruct_AnimModeDirection.h"
#include "Blueprint/UserWidget.h"
#include "Animation/WidgetAnimation.h"
#include "CoreMinimal.h"
/**
*
*/
class FORTIS_TAKTIKA_API CppAnimation
{
private:
UUserWidget* WidgetOwner;
UWidgetAnimation* WidgetAnimation;
TArray<FCppStruct_AnimModeDirection> AnimModes;
TEnumAsByte<Enum_AnimMode> lastMode;
int32 priorityIndex;
protected:
TEnumAsByte<EUMGSequencePlayMode::Type> GetDirection(TEnumAsByte<Enum_AnimMode>* mode);
bool CanPlayAnimation(TEnumAsByte<Enum_AnimMode>* mode);
public:
CppAnimation();
~CppAnimation();
CppAnimation(UUserWidget* owner, UWidgetAnimation* animation, TArray<FCppStruct_AnimModeDirection>* modes, TEnumAsByte<Enum_AnimMode>* lastMode, int32* priority);
void PlayAnimationMode(TEnumAsByte<Enum_AnimMode>* mode, int32* priority);
bool CanMode(TEnumAsByte<Enum_AnimMode>* mode);
};
@@ -0,0 +1,38 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CppStruct_AnimModeDirection.h"
#include "CppAnimation.h"
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "CppBaseWidget.generated.h"
/**
*
*/
UCLASS()
class FORTIS_TAKTIKA_API UCppBaseWidget : public UUserWidget
{
GENERATED_BODY()
private:
float timeLastTick;
TArray<CppAnimation> Animations;
CppAnimation* GetAnimationWithMode(TEnumAsByte<Enum_AnimMode>* mode);
protected:
UPROPERTY(BlueprintReadWrite, Category = Properties)
bool bVisible;
UFUNCTION(BLueprintCallable, Category = Tick)
bool CanTick(float interval);
UFUNCTION(BlueprintCallable, Category = Animation)
void PlayAnimationMode(TEnumAsByte<Enum_AnimMode> mode, int32 priorityIndex);
UFUNCTION(BlueprintCallable, Category = Animation)
void AddAnimation(UUserWidget* owner, UWidgetAnimation* animation, TArray<FCppStruct_AnimModeDirection> modes, TEnumAsByte<Enum_AnimMode> modeAtCreation, int32 priorityIndex);
public:
virtual void NativeConstruct() override;
virtual void NativeTick(const FGeometry& MyGeometry, float DeltaTime) override;
};
+23
View File
@@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
/**
*
*/
class FORTIS_TAKTIKA_API CppEnums
{
public:
CppEnums();
~CppEnums();
};
UENUM(BlueprintType)
enum Enum_AnimMode
{
show UMETA(DisplayName = "show"),
hide UMETA(DisplayName = "hide"),
roll UMETA(DisplayName = "roll"),
};
@@ -0,0 +1,25 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Blueprint/UserWidget.h"
#include "CppEnums.h"
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CppStruct_AnimModeDirection.generated.h"
/**
*
*/
USTRUCT(BlueprintType)
struct FCppStruct_AnimModeDirection
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TEnumAsByte<Enum_AnimMode> mode;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TEnumAsByte<EUMGSequencePlayMode::Type> direction;
};
@@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CppEnums.h"
#include "Blueprint/UserWidget.h"
#include "CoreMinimal.h"
/**
*
*/
class FORTIS_TAKTIKA_API CppStructures
{
public:
CppStructures();
~CppStructures();
};
@@ -0,0 +1,29 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Kismet/GameplayStatics.h"
#include "Engine/LevelStreaming.h"
#include "LevelManager.generated.h"
UCLASS()
class FORTIS_TAKTIKA_API ALevelManager : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ALevelManager();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintCallable, Category="Loading")
bool LoadLevel(FString LevelName, bool bVisible, bool bLoad);
};
@@ -0,0 +1,209 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "ResComPoint.h"
#include "Engine/Texture2DDynamic.h"
#include "CoreMinimal.h"
//#include "GameFramework/Actor.h"
#include "ResComApartmentManager.generated.h"
USTRUCT(BlueprintType)
struct FApartmentLocation
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 locHouse = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 locEntrance = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 locFloor = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 locApartment = 0;
bool operator==(FApartmentLocation& loc) const
{
return (loc.locHouse == locHouse) && (loc.locFloor == locFloor) && (loc.locEntrance == locEntrance) && (loc.locApartment == locApartment);
}
int32 AsNum() const
{
return (locHouse * 10000 + locEntrance * 1000 + locFloor * 100 + locApartment);
}
};
USTRUCT(BlueprintType)
struct FApartmentQuantities
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 rooms = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 toilets = 0;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 bedrooms = 0;
};
UENUM(BlueprintType)
enum RoomType
{
room UMETA(DisplayName = "room"),
bedroom UMETA(DisplayName = "bedroom"),
toilet UMETA(DisplayName = "toilet"),
bathroom UMETA(DisplayName = "bathroom"),
wardrobe UMETA(DisplayName = "wardrobe"),
hallway UMETA(DisplayName = "hallway"),
balcony UMETA(DisplayName = "balcony"),
kitchen UMETA(DisplayName = "kitchen"),
livingRoom UMETA(DisplayName = "livingRoom"),
kitchen_livingRoom UMETA(DisplayName = "kitchen_livingRoom"),
};
UENUM(BlueprintType)
enum ApartmentType
{
default UMETA(DisplayName = "default"),
studio UMETA(DisplayName = "studio"),
duplex UMETA(DisplayName = "duplex"),
};
USTRUCT(BlueprintType)
struct FRoomArea
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TEnumAsByte<RoomType> type = RoomType::room;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float meters = 0.0f;
};
USTRUCT(BlueprintType)
struct FApartmentAreas
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float full = 0.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FRoomArea> rooms;
};
USTRUCT(BlueprintType)
struct FApartmentCosts
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float full = 0.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float month = 0.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float meter = 0.0f;
};
USTRUCT(BlueprintType)
struct FApartmentReferences
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<UTexture2DDynamic*> textures;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
AResComPoint* point = nullptr;
};
USTRUCT(BlueprintType)
struct FApartment
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 id = -1;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString nameRC;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FApartmentLocation loc;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool favorite = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TEnumAsByte<ApartmentType> type;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FApartmentReferences references;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FApartmentQuantities quantities;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FApartmentAreas areas;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FApartmentCosts costs;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FString> properties;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString description;
};
UCLASS(BlueprintType)
class FORTIS_TAKTIKA_API UResComApartmentManager : public UObject
{
GENERATED_BODY()
private:
TArray<FApartment> apartments;
FApartment notValid;
public:
UResComApartmentManager();
// valid
UFUNCTION(BlueprintCallable = "valid")
bool IsValid(FApartment apartment) const;
//modify
UFUNCTION(BlueprintCallable = "modify")
void Push(FApartment apartment);
UFUNCTION(BlueprintCallable = "modify")
void ClearFavorites();
// get
UFUNCTION(BlueprintCallable, Category = "get")
FApartment& GetByID(int32 id);
UFUNCTION(BlueprintCallable, Category = "get")
FApartment& GetByLoc(FApartmentLocation loc);
UFUNCTION(BlueprintCallable, Category = "get")
TArray<FApartment> GetFavorites();
//sort
UFUNCTION(BlueprintCallable, Category = "sort")
void SortByLoc();
UFUNCTION(BlueprintCallable, Category = "sort")
void SortByID();
};
@@ -0,0 +1,123 @@
// 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"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "ResComFloorManager.generated.h"
/*Single-cast delegate declaration. No parameters*/
DECLARE_DYNAMIC_DELEGATE(FOnPreview);
DECLARE_DYNAMIC_DELEGATE(FOnShouldBeVisible);
DECLARE_DYNAMIC_DELEGATE(FOnShouldBeLoaded);
DECLARE_DYNAMIC_DELEGATE(FOnLoaded);
UENUM(BlueprintType)
enum Enum_LevelType
{
preview UMETA(DisplayName = "preview"),
visible UMETA(DisplayName = "visible"),
loaded UMETA(DisplayName = "loaded"),
};
USTRUCT(BlueprintType)
struct FFloorLevelStreaming
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
ULevelStreaming* level = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TEnumAsByte<Enum_LevelType> type;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 depth = 0;
};
USTRUCT(BlueprintType)
struct FFloorPack
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FApartmentLocation location;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FFloorLevelStreaming> 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()
class FORTIS_TAKTIKA_API AResComFloorManager : public AActor
{
GENERATED_BODY()
protected:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FFloorPack> packs;
private:
UFUNCTION()
void OnLevelPreview();
UFUNCTION()
void OnLevelVisible();
UFUNCTION()
void OnLevelLoaded();
bool GetPack(FApartmentLocation loc, FFloorPack* pack);
public:
// Sets default values for this actor's properties
AResComFloorManager();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UFUNCTION(BlueprintCallable, Category = "StreamingLevel")
TArray<ULevelStreaming*> GetStreamingLevels(const UObject* WorldContextObject);
UPROPERTY()
FOnPreview OnPreview;
UPROPERTY()
FOnShouldBeVisible OnShouldBeVisible;
UPROPERTY()
FOnShouldBeLoaded OnShouldBeLoaded;
UPROPERTY()
FOnLoaded OnLoaded;
UFUNCTION(BlueprintCallable, Category = "Pack")
void AddLevelToPack(FApartmentLocation loc, FFloorLevelStreaming level);
UFUNCTION(BlueprintCallable, Category = "Pack")
bool GetPack(FApartmentLocation loc, FFloorPack& pack) const;
UFUNCTION(BlueprintCallable, Category = "Pack")
void AddPack(const FFloorPack& pack);
public:
// Called every frame
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 FOnLoaded& delegateOnLoaded);
UFUNCTION(BlueprintCallable, Category = "Pack")
bool UnloadPack(FApartmentLocation loc, const FOnPreview& delegatePreview, const FOnShouldBeVisible& delegateShouldBeVisible, const FOnShouldBeLoaded& delegateShouldBeLoaded);
};
@@ -0,0 +1,54 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "ResComStatistics.h"
#include "ResComApartmentManager.h"
#include "Engine/LatentActionManager.h"
#include "Interfaces/IHttpRequest.h"
#include "Runtime/Online/HTTP/Public/HttpModule.h"
#include "Interfaces/IHttpResponse.h"
#include "Dom/JsonObject.h"
#include "Http.h"
#include "HttpModule.h"
#include "LatentActions.h"
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "ResComGameInstance.generated.h"
/**
*
*/
DECLARE_DYNAMIC_DELEGATE_OneParam(FHttpDelegate, FString, Content);
UCLASS()
class FORTIS_TAKTIKA_API UResComGameInstance : public UGameInstance
{
GENERATED_BODY()
private:
UResComApartmentManager* apartmentManager;
UResComStatistics* statisticsManager;
//FString HttpData;
//FHttpDelegate& Callback;
protected:
//UFUNCTION(BlueprintCallable, Category = "ApartmentManager")
//void SetApartmentManager(UResComApartmentManager* manager);
public:
UResComGameInstance();
virtual void Init();
UFUNCTION(BlueprintCallable, Category = "ApartmentManager")
UResComApartmentManager* GetApartmentManager() const;
UFUNCTION(BlueprintCallable, Category = "StatisticsManager")
UResComStatistics* GetStatisticsManager() const;
//UFUNCTION(BlueprintCallable)
//void HttpGet(FString UrlAddress, const FHttpDelegate& Callback);
//void OnHttpRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
//UFUNCTION(BlueprintCallable)
//FString GetHttpData();
};
+28
View File
@@ -0,0 +1,28 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "ResComUIStateManager.h"
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "ResComHUD.generated.h"
/**
*
*/
UCLASS()
class FORTIS_TAKTIKA_API AResComHUD : public AHUD
{
GENERATED_BODY()
private:
AResComUIStateManager* UIStateManager;
protected:
UFUNCTION(BlueprintCallable, Category="UIManager")
void SetUIStateManager(AResComUIStateManager* manager);
public:
UFUNCTION(BlueprintCallable, Category = "UIManager")
AResComUIStateManager* GetUIManager() const;
};
@@ -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);
};
@@ -0,0 +1,38 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ResComPlayerStateManager.h"
#include "ResComFloorManager.h"
#include "GameFramework/PlayerController.h"
#include "ResComPlayerController.generated.h"
/**
*
*/
UCLASS()
class FORTIS_TAKTIKA_API AResComPlayerController : public APlayerController
{
GENERATED_BODY()
private:
AResComPlayerStateManager* playerStateManager;
AResComFloorManager* floorManager;
protected:
UFUNCTION(BlueprintCallable, Category = "PlayerManager")
void SetPlayerStateManager(AResComPlayerStateManager* manager);
UFUNCTION(BlueprintCallable, Category = "FloorManager")
void SetFloorManager(AResComFloorManager* manager);
//virtual void BeginPlay() override;
public:
UFUNCTION(BlueprintCallable, Category = "PlayerManager")
AResComPlayerStateManager* GetPlayerStateManager() const;
UFUNCTION(BlueprintCallable, Category = "FloorManager")
AResComFloorManager* GetFloorManager() const;
UFUNCTION(BlueprintCallable, Category = "GarbageCollection")
void freeMemory();
};
@@ -0,0 +1,50 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ResComStateManager.h"
#include "GameFramework/Actor.h"
#include "ResComPlayerStateManager.generated.h"
UENUM(BlueprintType)
enum Enum_PlayerState
{
none UMETA(DisplayName = "none"),
home UMETA(DisplayName = "home"),
infrastructure UMETA(DisplayName = "infrastructure"),
groupOverview UMETA(DisplayName = "groupOverview"),
houseOverview UMETA(DisplayName = "house"),
floorOverview UMETA(DisplayName = "floorOverview"),
flatOverview UMETA(DisplayName = "flatOverview"),
freeWalk UMETA(DisplayName = "freeWalk"),
parking UMETA(DisplayName = "parking")
};
UCLASS()
class FORTIS_TAKTIKA_API AResComPlayerStateManager : public AActor
{
GENERATED_BODY()
private:
ResComStateManager<Enum_PlayerState> stateManager;
public:
UFUNCTION(BlueprintCallable, Category = "State")
void SetState(const TEnumAsByte<Enum_PlayerState> newState);
UFUNCTION(BlueprintCallable, Category = "State")
void ClearAllStatesBesideLast();
UFUNCTION(BlueprintCallable, Category = "State")
void SetPreviousState();
UFUNCTION(BlueprintCallable, Category = "State")
const TEnumAsByte<Enum_PlayerState> GetState() const;
UFUNCTION(BlueprintCallable, Category = "Debug")
const FString GetStateHistoryAsString() const;
// blueprint reaction
UFUNCTION(BlueprintImplementableEvent, Category = "StateReaction")
void OnState(const TEnumAsByte<Enum_PlayerState>& newState);
};
@@ -0,0 +1,26 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "ResComPoint.generated.h"
UCLASS()
class FORTIS_TAKTIKA_API AResComPoint : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AResComPoint();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
@@ -0,0 +1,29 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ResComState.generated.h"
/**
*
*/
UCLASS()
class FORTIS_TAKTIKA_API UResComState : public UObject
{
GENERATED_BODY()
protected:
int32 state;
public:
UResComState() : state(none) {}
UResComState(const int32& type) : state(type) {}
virtual void operator=(const int32& newState) { state = newState; }
const int32& GetInt() const { return state; }
const int32& GetValue() const { return GetInt(); }
bool operator==(const int32& stateIndex) { return this->state == stateIndex; }
bool operator==(const UResComState& stateCompare) { return this->state == stateCompare.state; }
// states
static const int32 none = 0;
static const int32 home = 1;
};
@@ -0,0 +1,56 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
template<typename EnumType>
class ResComStateManager
{
protected:
TArray<EnumType> stateHistory;
EnumType nullobj;
public:
ResComStateManager() : nullobj(EnumType())
{
}
bool SetState(const EnumType& newState)
{
if (GetState() == newState)
return false;
stateHistory.Push(newState);
return true;
}
const EnumType& GetState() const
{
return static_cast<bool>(stateHistory.Num()) ? stateHistory[stateHistory.Num() - 1] : nullobj;
}
bool SetPrevState()
{
if (stateHistory.Num() < 2)
return false;
stateHistory.Pop();
return true;
}
const EnumType& GetPreviousState() const
{
return (stateHistory.Num() > 1) ? stateHistory[stateHistory.Num() - 2] : GetState();
}
void ClearAllStatesBesideLast()
{
auto lastState = GetState();
stateHistory.Empty();
SetState(lastState);
}
const TArray<EnumType>& GetHistory() const
{
return stateHistory;
}
};
@@ -0,0 +1,67 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "ResComStatistics.generated.h"
/**
*
*/
USTRUCT(BlueprintType)
struct FStateAndTime
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString state;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float duration = 0.0f;
FStateAndTime() {};
FStateAndTime(FString s, float t) : state(s), duration(t) {};
};
USTRUCT(BlueprintType)
struct FUserStatistics
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float timeSession = 0.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float timeVR = 0.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FStateAndTime> stateHistory;
};
UCLASS(BlueprintType)
class FORTIS_TAKTIKA_API UResComStatistics : public UObject
{
GENERATED_BODY()
protected:
float timeSession = 0.0f;
float timeVR = 0.0f;
TArray<FStateAndTime> stateHistory;
// start variables
float timeLastStartVR = 0.0f;
FStateAndTime prevState;
public:
UFUNCTION(BlueprintCallable, Category = "states")
void NewState(FString state);
UFUNCTION(BlueprintCallable, Category = "states")
FString GetStateHistoryString();
UFUNCTION(BlueprintCallable, Category = "VR")
void StartVR();
UFUNCTION(BlueprintCallable, Category = "VR")
void EndVR();
};
@@ -0,0 +1,55 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ResComStateManager.h"
#include "ResComUIStateManager.generated.h"
/**
*
*/
UENUM(BlueprintType)
enum Enum_UIState
{
none UMETA(DisplayName = "none"),
home UMETA(DisplayName = "home"),
menu_main UMETA(DisplayName = "menu_main"),
menu_flat UMETA(DisplayName = "menu_flat"),
information UMETA(DisplayName = "information"),
infrastructure UMETA(DisplayName = "infrastructure"),
login UMETA(DisplayName = "login"),
loading UMETA(DisplayName = "loading"),
presentation UMETA(DisplayName = "presentation"),
filter UMETA(DisplayName = "filter"),
elevator UMETA(DisplayName = "elevator"),
walking_menu UMETA(DisplayName = "walking_menu"),
};
UCLASS()
class FORTIS_TAKTIKA_API AResComUIStateManager : public AActor
{
GENERATED_BODY()
private:
ResComStateManager<Enum_UIState> stateManager;
public:
UFUNCTION(BlueprintCallable, Category = "State")
void SetState(const TEnumAsByte<Enum_UIState> newState);
UFUNCTION(BlueprintCallable, Category = "State")
void ClearAllStatesBesideLast();
UFUNCTION(BlueprintCallable, Category = "State")
void SetPreviousState();
UFUNCTION(BlueprintCallable, Category = "State")
const TEnumAsByte<Enum_UIState> GetState() const;
UFUNCTION(BlueprintCallable, Category = "Debug")
const FString GetStateHistoryAsString() const;
// blueprint reaction
UFUNCTION(BlueprintImplementableEvent, Category = "StateReaction")
void OnState(const TEnumAsByte<Enum_UIState>& newState);
};
@@ -0,0 +1,32 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ResComUserManager.generated.h"
/**
*
*/
USTRUCT(BlueprintType)
struct FStruct_User
{
GENERATED_BODY()
UPROPERTY(BlueprintReadWrite)
FString name;
UPROPERTY(BlueprintReadWrite)
FString phone;
UPROPERTY(BlueprintReadWrite)
FString email;
UPROPERTY(BlueprintReadWrite)
TArray<int32> favoriteFlatsIndices;
};
class FORTIS_TAKTIKA_API UResComUserManager
{
public:
UResComUserManager();
~UResComUserManager();
};
@@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "ResComUserManager.h"
/**
*
*/
class FORTIS_TAKTIKA_API UResComUserStoreLocalData
{
private:
FString WorkingDirectoryPath;
public:
UResComUserStoreLocalData();
~UResComUserStoreLocalData();
UFUNCTION(BlueprintCallable)
void SetWorkingDirectory(FString path);
FStruct_User GetEmptyUser();
UFUNCTION(BlueprintCllable)
FStruct_User GetUser(FString phone);
UFUNCTION(BlueprintCallable)
FStruct_User GetUserFromString(FString string);
UFUNCTION(BlueprintCallable)
void AddUser(FString Phone, FString Name, FString Email, TArray<FString> FavoriteIDs);
};
@@ -0,0 +1,15 @@
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Templates/SubclassOf.h"
#include "Layout/ArrangedWidget.h"
#include "WorldCollision.h"
#include "Components/MeshComponent.h"
#include "WidgetComponentCustom.generated.h"
UCLASS()
class FORTIS_TAKTIKA_API UWidgetComponentCustom : public UMeshComponent
{
GENERATED_BODY()
};