// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Core/Types/String.h"
#include "Engine/Core/Types/Guid.h"
#include "Engine/Core/Types/Version.h"
#include "Engine/Core/Math/Ray.h"
#include "Engine/Core/Collections/Array.h"
#include "Engine/Core/Collections/HashSet.h"
///
/// Contains information about Flax project.
///
class FLAXENGINE_API ProjectInfo
{
public:
///
/// The loaded projects cache.
///
static Array ProjectsCache;
public:
///
/// The project reference.
///
struct Reference
{
///
/// The referenced project name.
///
String Name;
///
/// The referenced project.
///
ProjectInfo* Project;
};
public:
///
/// The project name.
///
String Name;
///
/// The absolute path to the project file.
///
String ProjectPath;
///
/// The project root folder path.
///
String ProjectFolderPath;
///
/// The project version.
///
::Version Version;
///
/// The project publisher company.
///
String Company;
///
/// The project copyright note.
///
String Copyright;
///
/// The name of the build target to use for the game building (final, cooked game code).
///
String GameTarget;
///
/// The name of the build target to use for the game in editor building (editor game code).
///
String EditorTarget;
///
/// The project references.
///
Array References;
///
/// The default scene asset identifier to open on project startup.
///
Guid DefaultScene;
///
/// The default scene spawn point (position and view direction).
///
Ray DefaultSceneSpawn;
///
/// The minimum version supported by this project.
///
::Version MinEngineVersion;
///
/// The user-friendly nickname of the engine installation to use when opening the project. Can be used to open game project with a custom engine distributed for team members. This value must be the same in engine and game projects to be paired.
///
String EngineNickname;
public:
ProjectInfo()
{
Version = ::Version(1, 0);
DefaultSceneSpawn = Ray(Vector3::Zero, Vector3::Forward);
}
///
/// Saves the project file (*.flaxproj).
///
/// True if cannot save it, otherwise false.
bool SaveProject();
///
/// Loads the project file (*.flaxproj).
///
/// The absolute path to the file with a project.
/// True if cannot load it, otherwise false.
bool LoadProject(const String& projectPath);
///
/// Loads the old project file (Project.xml).
/// [Deprecated: 16.04.2020, expires 16.04.2021]
///
/// The absolute path to the file with a project.
/// True if cannot load it, otherwise false.
bool LoadOldProject(const String& projectPath);
///
/// Gets all projects including this project, it's references and their references (any deep level of references).
///
/// The result list of projects (this and all references).
void GetAllProjects(HashSet& result)
{
result.Add(this);
for (auto& reference : References)
if (reference.Project)
reference.Project->GetAllProjects(result);
}
///
/// Loads the project from the specified file.
///
/// The path.
/// The loaded project.
static ProjectInfo* Load(const String& path);
};