Fixes for last commits

This commit is contained in:
Eduardo Bart
2012-07-15 11:28:15 -03:00
parent 7a08fed689
commit f47a947bf3
9 changed files with 22 additions and 40 deletions

View File

@@ -108,7 +108,7 @@ function GameInterface.terminate()
end
function GameInterface.show()
g_app.onClose = GameInterface.tryExit
connect(g_app, { onClose = GameInterface.tryExit })
logoutButton:show()
Background.hide()
gameRootPanel:show()
@@ -117,6 +117,7 @@ function GameInterface.show()
end
function GameInterface.hide()
disconnect(g_app, { onClose = GameInterface.tryExit })
if logoutWindow then
logoutWindow:destroy()
logoutWindow = nil
@@ -125,14 +126,13 @@ function GameInterface.hide()
exitWindow:destroy()
exitWindow = nil
end
if countWindow then
if countWindow then
countWindow:destroy()
countWindow = nil
end
gameRootPanel:hide()
logoutButton:hide()
Background.show()
g_app.onClose = nil
end
function GameInterface.exit()
@@ -154,7 +154,6 @@ function GameInterface.tryExit()
local exitFunc = function()
GameInterface.exit()
exitButton:getParent():destroy()
end
local logoutFunc = function()
GameInterface.logout()
@@ -168,7 +167,7 @@ function GameInterface.tryExit()
exitWindow.onEscape = cancelFunc
exitWindow.onEnter = logoutFunc
exitButton.onClick = exitFunc
logButton.onClick = logoutFunc
cancelButton.onClick = cancelFunc
@@ -202,7 +201,7 @@ function GameInterface.tryLogout()
logoutWindow.onEnter = logoutFunc
logoutWindow.onEscape = cancelFunc
yesButton.onClick = logoutFunc
noButton.onClick = cancelFunc
end
@@ -503,7 +502,7 @@ function GameInterface.moveStackableItem(item, toPos)
countWindow.onEnter = moveFunc
countWindow.onEscape = cancelFunc
okButton.onClick = moveFunc
cancelButton.onClick = cancelFunc
end

View File

@@ -1,30 +1,15 @@
PlayerMount = {}
-- private variables
-- private functions
-- public functions
function PlayerMount.init()
g_ui.importStyle('playermount.otui')
connect(g_game, { onDeath = PlayerMount.dismount,
onGameEnd = PlayerMount.dismount })
g_keyboard.bindKeyDown('Ctrl+R', PlayerMount.toggleMount, gameRootPanel)
end
function PlayerMount.terminate()
disconnect(g_game, { onDeath = PlayerMount.dismount,
onGameEnd = PlayerMount.dismount })
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel)
g_keyboard.unbindKeyDown('Ctrl+R', PlayerMount.toggleMount, gameRootPanel)
PlayerMount.reset()
PlayerMount = nil
end
-- hooked events
function PlayerMount.toggleMount()
if g_game.isMounted() then
g_game.mount(false)
@@ -35,4 +20,4 @@ end
function PlayerMount.dismount()
g_game.mount(false)
end
end

View File

@@ -2,10 +2,7 @@ Module
name: game_playermount
description: Manage player mounts
author: BeniS
website: www.otclient.info
dependencies:
- client_entergame
website: www.otclient.infox
@onLoad: |
dofile 'playermount'