blob: 28435f1672edf6bf74f14177fcc614fe3e56368e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
local ui = require("ui")
local L = require("lang").get
local dialog = {}
function dialog.show(dg, ...)
dialog.active = dg
if dg.show then
dg:show(...)
end
end
function dialog.refresh()
if dialog.active then
dialog.show(dialog.active)
end
end
local function dialog_loading(game)
return ui.popup_box(L("wait.generic"), L("dialog.cancel"),
function() game.quit() end,
function(self, msg)
if msg then
self.title.text:set(L("wait."..msg))
end
end
)
end
local function dialog_error(game)
local back_menu
return ui.popup_box(L("error.generic"), L("dialog.back"),
function()
dialog.show(back_menu or game.main_menu)
end,
function(self, msg, back)
if msg then
self.title.text:set(L("error."..msg))
back_menu = back
end
end
)
end
function dialog.init(game)
dialog.loading = dialog_loading(game)
dialog.error = dialog_error(game)
end
return dialog
|