|
|
@ -8,7 +8,7 @@ HotkeyColors = {
|
|
|
|
itemUse = '#8888FF',
|
|
|
|
itemUse = '#8888FF',
|
|
|
|
itemUseSelf = '#00FF00',
|
|
|
|
itemUseSelf = '#00FF00',
|
|
|
|
itemUseTarget = '#FF0000',
|
|
|
|
itemUseTarget = '#FF0000',
|
|
|
|
itemUseWith = '#CC0000',
|
|
|
|
itemUseWith = '#F5B325',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
hotkeysManagerLoaded = false
|
|
|
|
hotkeysManagerLoaded = false
|
|
|
@ -59,8 +59,10 @@ function init()
|
|
|
|
itemWidget:setVisible(false)
|
|
|
|
itemWidget:setVisible(false)
|
|
|
|
itemWidget:setFocusable(false)
|
|
|
|
itemWidget:setFocusable(false)
|
|
|
|
|
|
|
|
|
|
|
|
connect(g_game, { onGameStart = onGameStart,
|
|
|
|
connect(g_game, {
|
|
|
|
onGameEnd = hide })
|
|
|
|
onGameStart = onGameStart,
|
|
|
|
|
|
|
|
onGameEnd = hide
|
|
|
|
|
|
|
|
})
|
|
|
|
connect(currentHotkeysList, { onChildFocusChange = function (self, focusedChild) checkSelectedHotkey(focusedChild) end } )
|
|
|
|
connect(currentHotkeysList, { onChildFocusChange = function (self, focusedChild) checkSelectedHotkey(focusedChild) end } )
|
|
|
|
|
|
|
|
|
|
|
|
hotkeysManagerLoaded = true
|
|
|
|
hotkeysManagerLoaded = true
|
|
|
@ -69,8 +71,10 @@ end
|
|
|
|
function terminate()
|
|
|
|
function terminate()
|
|
|
|
hotkeysManagerLoaded = false
|
|
|
|
hotkeysManagerLoaded = false
|
|
|
|
|
|
|
|
|
|
|
|
disconnect(g_game, { onGameStart = onGameStart,
|
|
|
|
disconnect(g_game, {
|
|
|
|
onGameEnd = hide })
|
|
|
|
onGameStart = onGameStart,
|
|
|
|
|
|
|
|
onGameEnd = hide
|
|
|
|
|
|
|
|
})
|
|
|
|
g_keyboard.unbindKeyDown('Ctrl+K')
|
|
|
|
g_keyboard.unbindKeyDown('Ctrl+K')
|
|
|
|
|
|
|
|
|
|
|
|
for keyCombo,v in pairs(hotkeyList) do
|
|
|
|
for keyCombo,v in pairs(hotkeyList) do
|
|
|
@ -84,12 +88,12 @@ function terminate()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function load()
|
|
|
|
function load()
|
|
|
|
local hotkeySettings = g_settings.getNode('HotkeysManager') or {}
|
|
|
|
local hotkeySettings = g_settings.getNode('HotkeysManager')
|
|
|
|
if hotkeySettings ~= nil then
|
|
|
|
local hasCombos = false
|
|
|
|
|
|
|
|
if not table.empty(hotkeySettings) then
|
|
|
|
local playerHotkeySettings = hotkeySettings[g_game.getLocalPlayer():getName()]
|
|
|
|
local playerHotkeySettings = hotkeySettings[g_game.getLocalPlayer():getName()]
|
|
|
|
|
|
|
|
|
|
|
|
local hasCombos = false
|
|
|
|
if not table.empty(playerHotkeySettings) then
|
|
|
|
if playerHotkeySettings ~= nil then
|
|
|
|
|
|
|
|
for k, setting in pairs(playerHotkeySettings) do
|
|
|
|
for k, setting in pairs(playerHotkeySettings) do
|
|
|
|
addKeyCombo(nil, setting.keyCombo, setting)
|
|
|
|
addKeyCombo(nil, setting.keyCombo, setting)
|
|
|
|
hasCombos = true
|
|
|
|
hasCombos = true
|
|
|
@ -99,12 +103,7 @@ function load()
|
|
|
|
|
|
|
|
|
|
|
|
-- add default F keys combos
|
|
|
|
-- add default F keys combos
|
|
|
|
if not hasCombos then
|
|
|
|
if not hasCombos then
|
|
|
|
for i=1,12 do
|
|
|
|
loadDefautComboKeys()
|
|
|
|
addKeyCombo(nil, 'F' .. i)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
for i=1,4 do
|
|
|
|
|
|
|
|
addKeyCombo(nil, 'Shift+F' .. i)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -150,7 +149,7 @@ function ok()
|
|
|
|
hide()
|
|
|
|
hide()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function cancel()
|
|
|
|
function reload()
|
|
|
|
local children = currentHotkeysList:getChildren()
|
|
|
|
local children = currentHotkeysList:getChildren()
|
|
|
|
for i=1,#children do
|
|
|
|
for i=1,#children do
|
|
|
|
hotkeyList[children[i].keyCombo] = nil
|
|
|
|
hotkeyList[children[i].keyCombo] = nil
|
|
|
@ -162,9 +161,18 @@ function cancel()
|
|
|
|
hide()
|
|
|
|
hide()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadDefautComboKeys()
|
|
|
|
|
|
|
|
for i=1,12 do
|
|
|
|
|
|
|
|
addKeyCombo(nil, 'F' .. i)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
for i=1,4 do
|
|
|
|
|
|
|
|
addKeyCombo(nil, 'Shift+F' .. i)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- private functions
|
|
|
|
-- private functions
|
|
|
|
function onGameStart()
|
|
|
|
function onGameStart()
|
|
|
|
load()
|
|
|
|
reload()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function onChooseItemMouseRelease(self, mousePosition, mouseButton)
|
|
|
|
function onChooseItemMouseRelease(self, mousePosition, mouseButton)
|
|
|
|