UiDocument is an asset now

This commit is contained in:
MihailRis
2024-02-09 09:59:36 +03:00
parent 241d15e349
commit 07adbd04ea
21 changed files with 402 additions and 304 deletions
+7 -8
View File
@@ -5,6 +5,7 @@
#include "InventoryView.h"
#include "../logic/scripting/scripting.h"
#include "../files/files.h"
#include "../frontend/gui/gui_xml.h"
UiDocument::UiDocument(
std::string namesp,
@@ -27,16 +28,14 @@ void UiDocument::collect(uinodes_map& map, std::shared_ptr<gui::UINode> node) {
}
}
std::unique_ptr<UiDocument> UiDocument::readInventory(
std::string namesp,
fs::path file,
LevelFrontend* frontend,
InventoryInteraction& interaction
) {
std::unique_ptr<UiDocument> UiDocument::read(std::string namesp, fs::path file) {
const std::string text = files::read_string(file);
auto xmldoc = xml::parse(file.u8string(), text);
auto env = scripting::create_environment();
auto view = InventoryView::readXML(
frontend, interaction, text, file.u8string(), *env
gui::UiXmlReader reader(*env);
InventoryView::createReaders(reader);
auto view = reader.readXML(
file.u8string(), xmldoc->getRoot()
);
uidocscript script {};
auto scriptFile = fs::path(file.u8string()+".lua");