missing content report moved to xml
This commit is contained in:
+11
-5
@@ -377,22 +377,28 @@ void Hud::closeInventory() {
|
||||
}
|
||||
|
||||
void Hud::add(HudElement element) {
|
||||
using dynamic::Value;
|
||||
|
||||
gui->add(element.getNode());
|
||||
auto invview = std::dynamic_pointer_cast<InventoryView>(element.getNode());
|
||||
auto document = element.getDocument();
|
||||
if (document) {
|
||||
auto inventory = invview ? invview->getInventory() : nullptr;
|
||||
std::vector<std::unique_ptr<Value>> args;
|
||||
args.push_back(Value::of(inventory ? inventory.get()->getId() : 0));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
args.push_back(Value::of(blockPos[i]));
|
||||
}
|
||||
|
||||
if (invview) {
|
||||
auto inventory = invview->getInventory();
|
||||
scripting::on_ui_open(
|
||||
element.getDocument(),
|
||||
inventory.get(),
|
||||
blockPos
|
||||
std::move(args)
|
||||
);
|
||||
} else {
|
||||
scripting::on_ui_open(
|
||||
element.getDocument(),
|
||||
nullptr,
|
||||
blockPos
|
||||
std::move(args)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "../delegates.h"
|
||||
#include "../engine.h"
|
||||
#include "../data/dynamic.h"
|
||||
#include "../interfaces/Task.h"
|
||||
#include "../files/engine_paths.h"
|
||||
#include "../graphics/ui/elements/Label.hpp"
|
||||
@@ -43,11 +44,23 @@ void menus::create_menus(Engine* engine) {
|
||||
|
||||
auto document = UiDocument::read(scripting::get_root_environment(), fullname, file).release();
|
||||
engine->getAssets()->store(document, fullname);
|
||||
scripting::on_ui_open(document, nullptr, glm::ivec3());
|
||||
scripting::on_ui_open(document, {});
|
||||
return document->getRoot();
|
||||
});
|
||||
}
|
||||
|
||||
void menus::show(Engine* engine, const std::string& name, std::vector<std::unique_ptr<dynamic::Value>> args) {
|
||||
auto menu = engine->getGUI()->getMenu();
|
||||
auto file = engine->getResPaths()->find("layouts/"+name+".xml");
|
||||
auto fullname = "core:layouts/"+name;
|
||||
|
||||
auto document = UiDocument::read(scripting::get_root_environment(), fullname, file).release();
|
||||
engine->getAssets()->store(document, fullname);
|
||||
scripting::on_ui_open(document, std::move(args));
|
||||
menu->addPage(name, document->getRoot());
|
||||
menu->setPage(name);
|
||||
}
|
||||
|
||||
void menus::show_process_panel(Engine* engine, std::shared_ptr<Task> task, std::wstring text) {
|
||||
auto menu = engine->getGUI()->getMenu();
|
||||
auto panel = std::dynamic_pointer_cast<gui::Panel>(guiutil::create(
|
||||
|
||||
@@ -2,15 +2,21 @@
|
||||
#define FRONTEND_MENU_MENU_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class Task;
|
||||
class Engine;
|
||||
|
||||
namespace dynamic {
|
||||
class Value;
|
||||
}
|
||||
|
||||
namespace menus {
|
||||
/// @brief Create development version label at the top-right screen corner
|
||||
void create_version_label(Engine* engine);
|
||||
void create_menus(Engine* engine);
|
||||
void show(Engine* engine, const std::string& name, std::vector<std::unique_ptr<dynamic::Value>> args);
|
||||
void show_process_panel(Engine* engine, std::shared_ptr<Task> task, std::wstring text=L"");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user