mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
BEAWARE all game functionality is disabled with this commit for a while
* rework client modules * hide main window when loading * remake top menu functions * rework modules autoload * improve path resolving for otml and lua * move core_widgets to core_lib * fix tooltip issues * split some styles * add bit32 lua library * fix assert issues * fix compilation on linux 32 systems * rework gcc compile options * renable and fix some warnings * remove unused constants * speedup sprite cache * move UIGame to lua (not funcional yet) * fix a lot of issues in x11 window * fix crash handler * add some warnings do uiwidget and much more...
This commit is contained in:
@@ -52,7 +52,27 @@ local function tryLogin(charInfo, tries)
|
||||
Settings.set('lastUsedCharacter', charInfo.characterName)
|
||||
end
|
||||
|
||||
|
||||
function onGameLoginError(message)
|
||||
CharacterList.destroyLoadBox()
|
||||
local errorBox = displayErrorBox("Login Error", "Login error: " .. message)
|
||||
errorBox.onOk = CharacterList.show
|
||||
end
|
||||
|
||||
function onGameConnectionError(message)
|
||||
CharacterList.destroyLoadBox()
|
||||
local errorBox = displayErrorBox("Login Error", "Connection error: " .. message)
|
||||
errorBox.onOk = CharacterList.show
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function CharacterList.init()
|
||||
connect(g_game, { onLoginError = onGameLoginError })
|
||||
connect(g_game, { onConnectionError = onGameConnectionError })
|
||||
connect(g_game, { onGameStart = CharacterList.destroyLoadBox })
|
||||
connect(g_game, { onGameEnd = CharacterList.show })
|
||||
end
|
||||
|
||||
function CharacterList.terminate()
|
||||
characterList = nil
|
||||
if charactersWindow then
|
||||
@@ -60,6 +80,7 @@ function CharacterList.terminate()
|
||||
charactersWindow = nil
|
||||
end
|
||||
if loadBox then
|
||||
g_game.cancelLogin()
|
||||
loadBox:destroy()
|
||||
loadBox = nil
|
||||
end
|
||||
@@ -118,6 +139,7 @@ end
|
||||
function CharacterList.show()
|
||||
if not loadBox then
|
||||
charactersWindow:show()
|
||||
charactersWindow:raise()
|
||||
charactersWindow:focus()
|
||||
end
|
||||
end
|
||||
|
@@ -59,11 +59,11 @@ end
|
||||
|
||||
-- public functions
|
||||
function EnterGame.init()
|
||||
enterGameButton = TopMenu.addButton('enterGameButton', 'Login (Ctrl + G)', '/core_styles/icons/login.png', EnterGame.openWindow)
|
||||
Keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)
|
||||
motdButton = TopMenu.addButton('motdButton', 'Message of the day', '/core_styles/icons/motd.png', EnterGame.displayMotd)
|
||||
motdButton:hide()
|
||||
enterGame = displayUI('entergame.otui')
|
||||
enterGameButton = TopMenu.addLeftButton('enterGameButton', 'Login (Ctrl + G)', 'login.png', EnterGame.openWindow)
|
||||
motdButton = TopMenu.addLeftButton('motdButton', 'Message of the day', 'motd.png', EnterGame.displayMotd)
|
||||
motdButton:hide()
|
||||
Keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow)
|
||||
|
||||
local account = Settings.get('account')
|
||||
local password = Settings.get('password')
|
||||
@@ -102,6 +102,7 @@ end
|
||||
|
||||
function EnterGame.show()
|
||||
enterGame:show()
|
||||
enterGame:raise()
|
||||
enterGame:focus()
|
||||
end
|
||||
|
||||
|
@@ -3,14 +3,17 @@ Module
|
||||
description: Manages enter game and character list windows
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
autoload: true
|
||||
autoload-antecedence: 150
|
||||
reloadable: true
|
||||
|
||||
onLoad: |
|
||||
dependencies:
|
||||
- client_topmenu
|
||||
|
||||
@onLoad: |
|
||||
dofile 'entergame'
|
||||
dofile 'characterlist'
|
||||
EnterGame.init()
|
||||
CharacterList.init()
|
||||
|
||||
onUnload: |
|
||||
@onUnload: |
|
||||
EnterGame.terminate()
|
||||
CharacterList.terminate()
|
||||
|
@@ -5,7 +5,7 @@ MainWindow
|
||||
@onEnter: EnterGame.doLogin()
|
||||
@onEscape: EnterGame.hide()
|
||||
|
||||
LargerLabel
|
||||
Label
|
||||
text: Account name
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
@@ -17,7 +17,7 @@ MainWindow
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 2
|
||||
|
||||
LargerLabel
|
||||
Label
|
||||
text: Password
|
||||
anchors.left: prev.left
|
||||
anchors.top: prev.bottom
|
||||
@@ -30,7 +30,7 @@ MainWindow
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 2
|
||||
|
||||
LargerLabel
|
||||
Label
|
||||
id: serverLabel
|
||||
width: 140
|
||||
text: Server
|
||||
@@ -46,7 +46,7 @@ MainWindow
|
||||
anchors.top: serverLabel.bottom
|
||||
margin-top: 2
|
||||
|
||||
LargerLabel
|
||||
Label
|
||||
id: portLabel
|
||||
text: Port
|
||||
width: 50
|
||||
|
BIN
modules/client_entergame/login.png
Normal file
BIN
modules/client_entergame/login.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 696 B |
BIN
modules/client_entergame/motd.png
Normal file
BIN
modules/client_entergame/motd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 B |
Reference in New Issue
Block a user