Fixed mouse bug, allow locales list
This commit is contained in:
parent
b1bab32618
commit
8f9055f48b
|
@ -17,14 +17,22 @@ end
|
|||
function createWindow()
|
||||
localesWindow = g_ui.displayUI('locales')
|
||||
local localesPanel = localesWindow:getChildById('localesPanel')
|
||||
local layout = localesPanel:getLayout()
|
||||
local spacing = layout:getCellSpacing()
|
||||
local size = layout:getCellSize()
|
||||
|
||||
local count = 0
|
||||
for name,locale in pairs(installedLocales) do
|
||||
local widget = g_ui.createWidget('LocalesButton', localesPanel)
|
||||
widget:setImageSource('/images/flags/' .. name .. '')
|
||||
widget:setText(locale.languageName)
|
||||
widget.onClick = function() selectFirstLocale(name) end
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
count = math.max(1, math.min(count, 3))
|
||||
localesPanel:setWidth(size.width*count + spacing*(count-1))
|
||||
|
||||
addEvent(function() addEvent(function() localesWindow:raise() localesWindow:focus() end) end)
|
||||
end
|
||||
|
||||
|
@ -73,6 +81,7 @@ function terminate()
|
|||
currentLocale = nil
|
||||
|
||||
ProtocolGame.unregisterExtendedOpcode(ExtendedIds.Locale)
|
||||
disconnect(g_app, { onRun = createWindow })
|
||||
disconnect(g_game, { onGameStart = onGameStart })
|
||||
end
|
||||
|
||||
|
@ -101,6 +110,8 @@ function installLocale(locale)
|
|||
error('Unable to install locale.')
|
||||
end
|
||||
|
||||
if _G.allowedLocales and not _G.allowedLocales[locale.name] then return end
|
||||
|
||||
if locale.name ~= defaultLocaleName then
|
||||
local updatesNeeded = 0
|
||||
for _i,k in pairs(neededTranslations) do
|
||||
|
|
|
@ -24,8 +24,6 @@ UIWindow
|
|||
|
||||
Panel
|
||||
id: localesPanel
|
||||
!width: 96*3 + 32*3
|
||||
margin-left: 16
|
||||
margin-top: 50
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: prev.bottom
|
||||
|
|
|
@ -20,8 +20,8 @@ function g_mouse.bindPressMove(widget, callback)
|
|||
connect(widget, { onMouseMove = function(widget, mousePos, mouseMoved)
|
||||
if widget:isPressed() then
|
||||
callback(mousePos, mouseMoved)
|
||||
end
|
||||
return true
|
||||
end
|
||||
end })
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue