mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
process page test
This commit is contained in:
parent
a34fff3515
commit
f8f6ffc0c5
11 changed files with 58 additions and 33 deletions
|
|
@ -240,6 +240,15 @@ void scripting::on_ui_open(
|
|||
});
|
||||
}
|
||||
|
||||
void scripting::on_ui_progress(UiDocument* layout, int workDone, int workTotal) {
|
||||
std::string name = layout->getId() + ".progress";
|
||||
emit_event(name, [=] (lua::LuaState* state) {
|
||||
state->pushinteger(workDone);
|
||||
state->pushinteger(workTotal);
|
||||
return 2;
|
||||
});
|
||||
}
|
||||
|
||||
void scripting::on_ui_close(UiDocument* layout, Inventory* inventory) {
|
||||
std::string name = layout->getId() + ".close";
|
||||
emit_event(name, [inventory] (lua::LuaState* state) {
|
||||
|
|
@ -330,6 +339,7 @@ void scripting::load_layout_script(scriptenv senv, std::string prefix, fs::path
|
|||
state->loadbuffer(env, src, file.u8string());
|
||||
state->callNoThrow(0);
|
||||
script.onopen = register_event(env, "on_open", prefix+".open");
|
||||
script.onprogress = register_event(env, "on_progress", prefix+".progress");
|
||||
script.onclose = register_event(env, "on_close", prefix+".close");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue