mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Are you sure you want to quit?
This commit is contained in:
parent
7ac5502fdf
commit
d28a63f22a
1 changed files with 30 additions and 1 deletions
|
@ -49,7 +49,36 @@ local tabs = {
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
local function main_event_handler(tabview, event)
|
local function main_event_handler(tabview, event)
|
||||||
if event == "MenuQuit" then
|
if event == "MenuQuit" then
|
||||||
|
if not ui.childlist["mainmenu_quit_confirm"] then
|
||||||
|
tabview:hide()
|
||||||
|
local dlg = dialog_create(
|
||||||
|
"mainmenu_quit_confirm",
|
||||||
|
function()
|
||||||
|
return confirmation_formspec(
|
||||||
|
fgettext("Are you sure you want to quit?"),
|
||||||
|
"btn_quit_confirm_yes", fgettext("Quit"),
|
||||||
|
"btn_quit_confirm_cancel", fgettext("Cancel")
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
function(this, fields)
|
||||||
|
if fields.btn_quit_confirm_yes then
|
||||||
|
this:delete()
|
||||||
core.close()
|
core.close()
|
||||||
|
return true
|
||||||
|
elseif fields.btn_quit_confirm_cancel or fields.key_escape or fields.quit then
|
||||||
|
this:delete()
|
||||||
|
if tabview and tabview.show then
|
||||||
|
tabview:show()
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
nil
|
||||||
|
)
|
||||||
|
dlg:set_parent(tabview)
|
||||||
|
dlg:show()
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue