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