fix some login phases issues
This commit is contained in:
parent
d2e8e1d774
commit
2304ff3529
|
@ -86,14 +86,17 @@ function CharacterList.create(characters, premDays)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CharacterList.hide()
|
function CharacterList.hide()
|
||||||
charactersWindow:unlock()
|
|
||||||
charactersWindow:hide()
|
charactersWindow:hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CharacterList.close()
|
||||||
|
CharacterList.hide()
|
||||||
|
EnterGame.show()
|
||||||
|
end
|
||||||
|
|
||||||
function CharacterList.show()
|
function CharacterList.show()
|
||||||
if not loadBox then
|
if not loadBox then
|
||||||
charactersWindow:show()
|
charactersWindow:show()
|
||||||
charactersWindow:lock()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
EnterGame = { }
|
EnterGame = { }
|
||||||
|
|
||||||
-- private variables
|
-- private variables
|
||||||
local password
|
|
||||||
local loadBox
|
local loadBox
|
||||||
local enterGameWindow
|
local enterGameWindow
|
||||||
local hideCharlist = false
|
local motdNumber
|
||||||
|
local motdMessage
|
||||||
|
|
||||||
-- private functions
|
-- private functions
|
||||||
local function onError(protocol, error)
|
local function onError(protocol, error)
|
||||||
|
@ -14,32 +14,34 @@ local function onError(protocol, error)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onMotd(protocol, motd)
|
local function onMotd(protocol, motd)
|
||||||
loadBox:destroy()
|
motdNumber = tonumber(string.sub(motd, 0, string.find(motd, "\n")))
|
||||||
local motdNumber = tonumber(string.sub(motd, 0, string.find(motd, "\n")))
|
motdMessage = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd))
|
||||||
local motdMessage = string.sub(motd, string.find(motd, "\n") + 1, string.len(motd))
|
|
||||||
local lastMotdNumber = tonumber(Configs.get("motd"))
|
|
||||||
if motdNumber ~= lastMotdNumber then
|
|
||||||
hideCharlist = true
|
|
||||||
local motdBox = displayInfoBox("Message of the day", motdMessage)
|
|
||||||
motdBox.onOk = function()
|
|
||||||
CharacterList.show()
|
|
||||||
end
|
|
||||||
Configs.set("motd", motdNumber)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function onCharacterList(protocol, characters, premDays)
|
local function onCharacterList(protocol, characters, premDays)
|
||||||
|
loadBox:destroy()
|
||||||
CharacterList.create(characters, premDays)
|
CharacterList.create(characters, premDays)
|
||||||
if hideCharlist then
|
|
||||||
|
local lastMotdNumber = tonumber(Configs.get("motd"))
|
||||||
|
if motdNumber and motdNumber ~= lastMotdNumber then
|
||||||
|
Configs.set("motd", motdNumber)
|
||||||
|
local motdBox = displayInfoBox("Message of the day", motdMessage)
|
||||||
|
motdBox.onOk = CharacterList.show
|
||||||
CharacterList.hide()
|
CharacterList.hide()
|
||||||
hideCharlist = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- public functions
|
-- public functions
|
||||||
function EnterGame.create()
|
function EnterGame.show()
|
||||||
|
if not enterGameWindow then
|
||||||
enterGameWindow = UI.loadAndDisplay('/mainmenu/ui/entergamewindow.otui')
|
enterGameWindow = UI.loadAndDisplay('/mainmenu/ui/entergamewindow.otui')
|
||||||
end
|
end
|
||||||
|
enterGameWindow:show()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EnterGame.hide()
|
||||||
|
enterGameWindow:hide()
|
||||||
|
end
|
||||||
|
|
||||||
function EnterGame.destroy()
|
function EnterGame.destroy()
|
||||||
enterGameWindow:destroy()
|
enterGameWindow:destroy()
|
||||||
|
@ -49,7 +51,7 @@ end
|
||||||
function EnterGame.doLogin()
|
function EnterGame.doLogin()
|
||||||
EnterGame.account = enterGameWindow:getChildById('accountNameLineEdit'):getText()
|
EnterGame.account = enterGameWindow:getChildById('accountNameLineEdit'):getText()
|
||||||
EnterGame.password = enterGameWindow:getChildById('accountPasswordLineEdit'):getText()
|
EnterGame.password = enterGameWindow:getChildById('accountPasswordLineEdit'):getText()
|
||||||
EnterGame.destroy()
|
EnterGame.hide()
|
||||||
|
|
||||||
local protocolLogin = ProtocolLogin.create()
|
local protocolLogin = ProtocolLogin.create()
|
||||||
protocolLogin.onError = onError
|
protocolLogin.onError = onError
|
||||||
|
@ -59,7 +61,7 @@ function EnterGame.doLogin()
|
||||||
loadBox = displayCancelBox('Please wait', 'Connecting to login server...')
|
loadBox = displayCancelBox('Please wait', 'Connecting to login server...')
|
||||||
loadBox.onCancel = function(msgbox)
|
loadBox.onCancel = function(msgbox)
|
||||||
protocolLogin:cancelLogin()
|
protocolLogin:cancelLogin()
|
||||||
EnterGame.create()
|
EnterGame.show()
|
||||||
end
|
end
|
||||||
|
|
||||||
protocolLogin:login(EnterGame.account, EnterGame.password)
|
protocolLogin:login(EnterGame.account, EnterGame.password)
|
||||||
|
|
|
@ -16,7 +16,7 @@ Module
|
||||||
|
|
||||||
if not initialized then
|
if not initialized then
|
||||||
MainMenu.create()
|
MainMenu.create()
|
||||||
EnterGame.create()
|
EnterGame.show()
|
||||||
initialized = true
|
initialized = true
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -17,7 +17,7 @@ MainWindow
|
||||||
title: Charlist
|
title: Charlist
|
||||||
size: 250 250
|
size: 250 250
|
||||||
onEnter: CharacterList.doLogin()
|
onEnter: CharacterList.doLogin()
|
||||||
onEscape: CharacterList.hide()
|
onEscape: CharacterList.close()
|
||||||
|
|
||||||
TextList
|
TextList
|
||||||
id: characterList
|
id: characterList
|
||||||
|
@ -65,9 +65,4 @@ MainWindow
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
margin.bottom: 16
|
margin.bottom: 16
|
||||||
margin.right: 16
|
margin.right: 16
|
||||||
onClick: |
|
onClick: CharacterList.close()
|
||||||
function(self)
|
|
||||||
self:getParent():unlock()
|
|
||||||
self:getParent():hide()
|
|
||||||
EnterGame.create()
|
|
||||||
end
|
|
|
@ -444,7 +444,7 @@ void UIWidget::focusPreviousChild(Fw::FocusReason reason)
|
||||||
{
|
{
|
||||||
UIWidgetPtr toFocus;
|
UIWidgetPtr toFocus;
|
||||||
UIWidgetList rotatedChildren(m_children);
|
UIWidgetList rotatedChildren(m_children);
|
||||||
std::reverse(m_children.begin(), m_children.end());
|
std::reverse(rotatedChildren.begin(), rotatedChildren.end());
|
||||||
|
|
||||||
if(m_focusedChild) {
|
if(m_focusedChild) {
|
||||||
auto focusedIt = std::find(rotatedChildren.begin(), rotatedChildren.end(), m_focusedChild);
|
auto focusedIt = std::find(rotatedChildren.begin(), rotatedChildren.end(), m_focusedChild);
|
||||||
|
|
Loading…
Reference in New Issue