|
@@ -1,5 +1,11 @@
|
1
|
1
|
deathWindow = nil
|
2
|
2
|
|
|
3
|
+local deathTexts = {
|
|
4
|
+ regular = {text = 'Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back\ninto this world in exchange for a small sacrifice\n\nSimply click on Ok to resume your journeys!', height = 140, width = 0},
|
|
5
|
+ unfair = {text = 'Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back\ninto this world in exchange for a small sacrifice\n\nThis death penalty has been reduced by %i%%\nbecause it was an unfair fight.\n\nSimply click on Ok to resume your journeys!', height = 185, width = 0},
|
|
6
|
+ blessed = {text = 'Alas! Brave adventurer, you have met a sad fate.\nBut do not despair, for the gods will bring you back into this world\n\nThis death penalty has been reduced by 100%\nbecause you are blessed with the Adventurer\'s Blessing\n\nSimply click on Ok to resume your journeys!', height = 170, width = 90}
|
|
7
|
+}
|
|
8
|
+
|
3
|
9
|
function init()
|
4
|
10
|
g_ui.importStyle('deathwindow')
|
5
|
11
|
|
|
@@ -21,9 +27,9 @@ function reset()
|
21
|
27
|
end
|
22
|
28
|
end
|
23
|
29
|
|
24
|
|
-function display()
|
|
30
|
+function display(deathType, penalty)
|
25
|
31
|
displayDeadMessage()
|
26
|
|
- openWindow()
|
|
32
|
+ openWindow(deathType, penalty)
|
27
|
33
|
end
|
28
|
34
|
|
29
|
35
|
function displayDeadMessage()
|
|
@@ -33,12 +39,31 @@ function displayDeadMessage()
|
33
|
39
|
modules.game_textmessage.displayGameMessage(tr('You are dead.'))
|
34
|
40
|
end
|
35
|
41
|
|
36
|
|
-function openWindow()
|
|
42
|
+function openWindow(deathType, penalty)
|
37
|
43
|
if deathWindow then
|
38
|
44
|
deathWindow:destroy()
|
39
|
45
|
return
|
40
|
46
|
end
|
|
47
|
+
|
41
|
48
|
deathWindow = g_ui.createWidget('DeathWindow', rootWidget)
|
|
49
|
+
|
|
50
|
+ local textLabel = deathWindow:getChildById('labelText')
|
|
51
|
+ if deathType == DeathType.Regular then
|
|
52
|
+ if penalty == 100 then
|
|
53
|
+ textLabel:setText(deathTexts.regular.text)
|
|
54
|
+ deathWindow:setHeight(deathWindow.baseHeight + deathTexts.regular.height)
|
|
55
|
+ deathWindow:setWidth(deathWindow.baseWidth + deathTexts.regular.width)
|
|
56
|
+ else
|
|
57
|
+ textLabel:setText(string.format(deathTexts.unfair.text, 100 - penalty))
|
|
58
|
+ deathWindow:setHeight(deathWindow.baseHeight + deathTexts.unfair.height)
|
|
59
|
+ deathWindow:setWidth(deathWindow.baseWidth + deathTexts.unfair.width)
|
|
60
|
+ end
|
|
61
|
+ elseif deathType == DeathType.Blessed then
|
|
62
|
+ textLabel:setText(deathTexts.blessed.text)
|
|
63
|
+ deathWindow:setHeight(deathWindow.baseHeight + deathTexts.blessed.height)
|
|
64
|
+ deathWindow:setWidth(deathWindow.baseWidth + deathTexts.blessed.width)
|
|
65
|
+ end
|
|
66
|
+
|
42
|
67
|
local okButton = deathWindow:getChildById('buttonOk')
|
43
|
68
|
local cancelButton = deathWindow:getChildById('buttonCancel')
|
44
|
69
|
|