/**************************************************************************/ /* template_manager.h */ /**************************************************************************/ /* This file is part of: */ /* AETHEX ENGINE */ /* https://aethex.foundation */ /**************************************************************************/ /* Copyright (c) 2026-present AeThex Labs. */ /**************************************************************************/ #ifndef AETHEX_TEMPLATE_MANAGER_H #define AETHEX_TEMPLATE_MANAGER_H #include "core/io/http_client.h" #include "core/object/object.h" #include "core/object/ref_counted.h" #include "template_data.h" // Manages AeThex project templates - loading, downloading, and instantiation class AeThexTemplateManager : public Object { GDCLASS(AeThexTemplateManager, Object); public: static const String TEMPLATES_API_URL; static const String TEMPLATES_CACHE_PATH; private: static AeThexTemplateManager *singleton; Vector> builtin_templates; Vector> downloaded_templates; Vector> online_templates; HTTPClient *http_client = nullptr; bool is_fetching = false; void _init_builtin_templates(); void _load_downloaded_templates(); void _cache_template(const Ref &p_template); protected: static void _bind_methods(); public: static AeThexTemplateManager *get_singleton(); // Template retrieval Vector> get_all_templates() const; Vector> get_builtin_templates() const { return builtin_templates; } Vector> get_downloaded_templates() const { return downloaded_templates; } Vector> get_online_templates() const { return online_templates; } Ref get_template_by_id(const String &p_id) const; // Filtering Vector> get_templates_by_category(AeThexTemplate::TemplateCategory p_category) const; Vector> get_templates_by_platform(AeThexTemplate::TargetPlatform p_platform) const; Vector> get_templates_by_difficulty(AeThexTemplate::Difficulty p_difficulty) const; Vector> search_templates(const String &p_query) const; // Online operations void fetch_online_templates(); void download_template(const String &p_template_id); bool is_template_downloaded(const String &p_template_id) const; // Project creation Error create_project_from_template(const Ref &p_template, const String &p_project_path, const Dictionary &p_variables); // Variable processing String process_template_string(const String &p_template, const Dictionary &p_variables); AeThexTemplateManager(); ~AeThexTemplateManager(); }; // =========================================================== // Built-in Template Definitions // =========================================================== namespace AeThexBuiltinTemplates { // Create the starter game templates Ref create_empty_project(); Ref create_2d_platformer(); Ref create_3d_fps(); Ref create_rpg_starter(); Ref create_multiplayer_game(); Ref create_roblox_experience(); Ref create_uefn_island(); Ref create_unity_mobile(); Ref create_web_game(); Ref create_crossplatform_game(); } // namespace AeThexBuiltinTemplates #endif // AETHEX_TEMPLATE_MANAGER_H