From 0cf937aa012c2e44f0eb2bf13d88f349ba630f93 Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Fri, 28 Oct 2022 00:25:07 +0200 Subject: [PATCH] Update download.lua --- data/cdata/ui_scripts/mods/download.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/data/cdata/ui_scripts/mods/download.lua b/data/cdata/ui_scripts/mods/download.lua index 96105c4d..cac8cff4 100644 --- a/data/cdata/ui_scripts/mods/download.lua +++ b/data/cdata/ui_scripts/mods/download.lua @@ -4,10 +4,22 @@ Engine.GetLuiRoot():registerEventHandler("mod_download_start", function(element, download.abort() end, withcancel = true, - text = "Downloading " .. event.request.name .. "..." + text = "Downloading files..." }) - Engine.GetLuiRoot():registerEventHandler("mod_download_done", function() + local file = "" + + popup:registerEventHandler("mod_download_set_file", function(element, event) + file = event.request.name + popup.text:setText(string.format("Downloading %s...", file)) + end) + + popup:registerEventHandler("mod_download_progress", function(element, event) + print(event.fraction * 100) + popup.text:setText(string.format("Downloading %s (%i%%)...", file, math.floor(event.fraction * 100))) + end) + + popup:registerEventHandler("mod_download_done", function() LUI.FlowManager.RequestLeaveMenu(popup) end) end)