mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
ctrl+g kinda working, but login/logout events still need a remake
This commit is contained in:
@@ -1,13 +1,35 @@
|
||||
function Game.createMainInterface()
|
||||
-- private functions
|
||||
local function onGameKeyPress(self, keyCode, keyChar, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardCtrlModifier then
|
||||
if keyCode == KeyG then
|
||||
CharacterList.show()
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function createMainInterface()
|
||||
gameUi = loadUI('/game/ui/gameinterface.otui', UI.root)
|
||||
gameUi.onKeyPress = onGameKeyPress
|
||||
end
|
||||
|
||||
|
||||
local function destroyMainInterface()
|
||||
if gameUi then
|
||||
gameUi:destroy()
|
||||
gameUi = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Game.onLogin()
|
||||
|
||||
MainMenu.hide()
|
||||
CharacterList.destroyLoadBox()
|
||||
createMainInterface()
|
||||
end
|
||||
|
||||
function Game.onLogout()
|
||||
gameUi:destroy()
|
||||
gameUi = nil
|
||||
mainMenu:show()
|
||||
MainMenu.show()
|
||||
CharacterList.show()
|
||||
destroyMainInterface()
|
||||
end
|
||||
|
@@ -10,6 +10,4 @@ UIWidget
|
||||
anchors.left: gameMap.right
|
||||
anchors.top: parent.top
|
||||
text: Logout
|
||||
onClick: |
|
||||
Game.logout()
|
||||
Game.onLogout()
|
||||
onClick: Game.logout()
|
Reference in New Issue
Block a user