Changed/Fixed Text Windows, Text Message, Hotkeys Manager, Game Interface and Quest Log

* Renamed game_textbooks to game_textwindow.
* Fixed text window from opening multiple times, and is destroyed correctly.
* Added new game_playerdeath module (moved death message and window here).
* Hotkey window will hide on game end.
* Logout/Exit/Stackable Items/Questlog/Hotkeys windows will now close on game end.
This commit is contained in:
BeniS
2012-07-14 22:59:32 +12:00
parent e3298d561c
commit 694a69e1bf
12 changed files with 163 additions and 65 deletions

View File

@@ -1,29 +0,0 @@
DeathWindow < MainWindow
id: deathWindow
!text: tr('You are dead')
size: 350 155
Label
!text: tr('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!')
width: 550
height: 140
anchors.left: parent.left
anchors.top: parent.top
margin-left: 10
margin-top: 2
Button
id: buttonOk
!text: tr('Ok')
width: 64
anchors.left: parent.left
anchors.bottom: parent.bottom
margin-left: 160
Button
id: buttonCancel
!text: tr('Cancel')
width: 64
anchors.left: prev.right
anchors.bottom: parent.bottom
margin-left: 5

View File

@@ -20,7 +20,6 @@ local MessageTypes = {
local centerTextMessagePanel
local bottomStatusLabel
local privateLabel
local deathWindow
-- private functions
local function displayMessage(msgtype, msg, time)
@@ -57,11 +56,8 @@ local function createTextMessageLabel(id, parent, class)
end
-- public functions
function TextMessage.init()
g_ui.importStyle('deathwindow.otui')
connect(g_game, { onDeath = TextMessage.displayDeadMessage,
onTextMessage = TextMessage.display,
function TextMessage.init()
connect(g_game, { onTextMessage = TextMessage.display,
onGameStart = TextMessage.clearMessages })
centerTextMessagePanel = g_ui.createWidget('Panel', GameInterface.getMapPanel())
@@ -96,7 +92,6 @@ function TextMessage.terminate()
centerTextMessagePanel = nil
bottomStatusLabel = nil
privateLabel = nil
deathWindow = nil
TextMessage = nil
end
@@ -126,33 +121,3 @@ function TextMessage.display(msgtypedesc, msg)
displayMessage(msgtype, msg)
end
end
function TextMessage.displayDeadMessage()
local advanceLabel = GameInterface.getMapPanel():recursiveGetChildById('centerAdvance')
if advanceLabel:isVisible() then return end
TextMessage.displayEventAdvance(tr('You are dead.'))
if(deathWindow) then
return
end
deathWindow = g_ui.createWidget('DeathWindow', rootWidget)
local okButton = deathWindow:getChildById('buttonOk')
local cancelButton = deathWindow:getChildById('buttonCancel')
local okFunc = function()
CharacterList.doLogin()
okButton:getParent():destroy()
deathWindow = nil
end
local cancelFunc = function()
GameInterface.logout()
cancelButton:getParent():destroy()
deathWindow = nil
end
deathWindow.onEnter = okFunc
deathWindow.onEscape = cancelFunc
okButton.onClick = okFunc
cancelButton.onClick = cancelFunc
end