Changes/Fixes to Character List, Hotkey Manager, Exit Window and Text Message.

*Fixed typo in character list string.
* Hotkey text edit will now focus when you select a list item.
* Fix to the exit window layout.
* Added a death window for player deaths.
master
BeniS 12 years ago
parent 3ebb997c37
commit 810816b4a3

@ -22,7 +22,7 @@ local function tryLogin(charInfo, tries)
if g_game.isOnline() then if g_game.isOnline() then
g_game.safeLogout() g_game.safeLogout()
if tries == 1 then if tries == 1 then
loadBox = displayCancelBox(tr('Please wait'), tr('Loggin out...')) loadBox = displayCancelBox(tr('Please wait'), tr('Logging out...'))
end end
scheduleEvent(function() tryLogin(charInfo, tries+1) end, 250) scheduleEvent(function() tryLogin(charInfo, tries+1) end, 250)
return return

@ -334,6 +334,7 @@ function HotkeysManager.checkSelectedHotkey(focused)
if hotkeyLabelSelectedOnList.itemId == nil then if hotkeyLabelSelectedOnList.itemId == nil then
hotkeyText:enable() hotkeyText:enable()
hotkeyText:focus()
hotKeyTextLabel:enable() hotKeyTextLabel:enable()
hotkeyText:setText(hotkeyLabelSelectedOnList.value) hotkeyText:setText(hotkeyLabelSelectedOnList.value)

@ -4,28 +4,13 @@ ExitWindow < MainWindow
size: 550 135 size: 550 135
Label Label
!text: tr('If you shut down the program, you character might stay in the game.') !text: tr('If you shut down the program, you character might stay in the game.\nClick on "Logout" to ensure that you character leaves the game property.\nClick on "Exit" if you want to exit the program without logging out your character.')
width: 550 width: 550
height: 110
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
margin-left: 10 margin-left: 10
margin-top: 2 margin-top: 2
Label
!text: tr('Click on "Logout" to ensure that you character leaves the game property.')
width: 550
anchors.left: parent.left
anchors.top: prev.bottom
margin-left: 10
margin-top: 2
Label
!text: tr('Click on "Exit" if you want to exit the program without logging out your character.')
width: 550
anchors.left: parent.left
anchors.top: prev.bottom
margin-left: 10
margin-top: 2
Button Button
id: buttonExit id: buttonExit
@ -50,4 +35,3 @@ ExitWindow < MainWindow
anchors.left: prev.right anchors.left: prev.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin-left: 5 margin-left: 5
@onClick: self:getParent():destroy()

@ -127,8 +127,8 @@ function Minimap.compassClick(self, mousePos, mouseButton, elapsed)
local dx = px - self:getWidth()/2 local dx = px - self:getWidth()/2
local dy = -(py - self:getHeight()/2) local dy = -(py - self:getHeight()/2)
local radius = math.sqrt(dx*dx+dy*dy) local radius = math.sqrt(dx*dx+dy*dy)
local movex=0 local movex = 0
local movey=0 local movey = 0
dx = dx/radius dx = dx/radius
dy = dy/radius dy = dy/radius

@ -0,0 +1,29 @@
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

@ -20,6 +20,7 @@ local MessageTypes = {
local centerTextMessagePanel local centerTextMessagePanel
local bottomStatusLabel local bottomStatusLabel
local privateLabel local privateLabel
local deathWindow
-- private functions -- private functions
local function displayMessage(msgtype, msg, time) local function displayMessage(msgtype, msg, time)
@ -57,6 +58,8 @@ end
-- public functions -- public functions
function TextMessage.init() function TextMessage.init()
g_ui.importStyle('deathwindow.otui')
connect(g_game, { onDeath = TextMessage.displayDeadMessage, connect(g_game, { onDeath = TextMessage.displayDeadMessage,
onTextMessage = TextMessage.display, onTextMessage = TextMessage.display,
onGameStart = TextMessage.clearMessages }) onGameStart = TextMessage.clearMessages })
@ -93,6 +96,7 @@ function TextMessage.terminate()
centerTextMessagePanel = nil centerTextMessagePanel = nil
bottomStatusLabel = nil bottomStatusLabel = nil
privateLabel = nil privateLabel = nil
deathWindow = nil
TextMessage = nil TextMessage = nil
end end
@ -127,4 +131,28 @@ function TextMessage.displayDeadMessage()
local advanceLabel = GameInterface.getMapPanel():recursiveGetChildById('centerAdvance') local advanceLabel = GameInterface.getMapPanel():recursiveGetChildById('centerAdvance')
if advanceLabel:isVisible() then return end if advanceLabel:isVisible() then return end
TextMessage.displayEventAdvance(tr('You are dead.')) 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 end

Loading…
Cancel
Save