2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2015-12-13 13:01:32 -08:00
|
|
|
|
2017-12-29 00:08:12 -08:00
|
|
|
#include "hecl/Database.hpp"
|
|
|
|
#include "athena/DNAYaml.hpp"
|
2016-03-25 17:51:59 -07:00
|
|
|
#include "ProjectResourceFactoryMP1.hpp"
|
2016-02-15 21:50:41 -08:00
|
|
|
#include "Runtime/CSimplePool.hpp"
|
2016-04-03 19:32:57 -07:00
|
|
|
#include "hecl/Runtime.hpp"
|
2016-04-15 13:42:40 -07:00
|
|
|
#include "MP1/MP1.hpp"
|
2015-12-13 13:01:32 -08:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
namespace urde {
|
2016-01-03 21:31:02 -08:00
|
|
|
class ViewManager;
|
2015-12-13 13:01:32 -08:00
|
|
|
|
2016-03-04 15:04:53 -08:00
|
|
|
using ConfigReader = athena::io::YAMLDocReader;
|
|
|
|
using ConfigWriter = athena::io::YAMLDocWriter;
|
2016-01-04 16:01:02 -08:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class ProjectResourcePool : public CSimplePool {
|
|
|
|
class ProjectManager& m_parent;
|
|
|
|
|
2016-04-04 18:51:25 -07:00
|
|
|
public:
|
2018-12-07 21:30:43 -08:00
|
|
|
ProjectResourcePool(IFactory& factory, ProjectManager& parent) : CSimplePool(factory), m_parent(parent) {}
|
|
|
|
CToken GetObj(std::string_view);
|
|
|
|
CToken GetObj(std::string_view, const CVParamTransfer&);
|
2016-04-04 18:51:25 -07:00
|
|
|
};
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class ProjectManager {
|
|
|
|
ViewManager& m_vm;
|
|
|
|
std::unique_ptr<hecl::Database::Project> m_proj;
|
|
|
|
static bool m_registeredSpecs;
|
|
|
|
hecl::ClientProcess m_clientProc;
|
|
|
|
ProjectResourceFactoryMP1 m_factoryMP1;
|
|
|
|
ProjectResourcePool m_objStore;
|
2019-06-11 19:05:17 -07:00
|
|
|
std::optional<MP1::CMain> m_mainMP1;
|
2018-12-07 21:30:43 -08:00
|
|
|
bool m_precooking = false;
|
2016-02-15 21:50:41 -08:00
|
|
|
|
2015-12-13 13:01:32 -08:00
|
|
|
public:
|
2018-12-07 21:30:43 -08:00
|
|
|
static ProjectManager* g_SharedManager;
|
|
|
|
ProjectManager(ViewManager& vm);
|
|
|
|
operator bool() const { return m_proj.operator bool(); }
|
|
|
|
|
|
|
|
hecl::Database::Project* project() { return m_proj.get(); }
|
|
|
|
ProjectResourcePool& objectStore() { return m_objStore; }
|
|
|
|
ProjectResourceFactoryMP1& resourceFactoryMP1() { return m_factoryMP1; }
|
|
|
|
MP1::CMain* gameMain() { return m_mainMP1 ? &*m_mainMP1 : nullptr; }
|
|
|
|
SObjectTag TagFromPath(hecl::SystemStringView path) const {
|
|
|
|
return m_factoryMP1.ProjectResourceFactoryBase::TagFromPath(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool newProject(hecl::SystemStringView path);
|
|
|
|
bool openProject(hecl::SystemStringView path);
|
|
|
|
bool extractGame(hecl::SystemStringView path);
|
|
|
|
bool saveProject();
|
|
|
|
|
|
|
|
void mainUpdate();
|
|
|
|
void mainDraw();
|
|
|
|
void shutdown();
|
2015-12-13 13:01:32 -08:00
|
|
|
};
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
} // namespace urde
|