Add turn and hotkey delay

This commit is contained in:
Kamil Chojnowski
2017-11-16 18:58:58 +01:00
parent 2095951e07
commit d889b5aaf2
4 changed files with 78 additions and 10 deletions

View File

@@ -38,11 +38,51 @@ Panel
id: displayText
!text: tr('Display text messages')
Label
id: turnDelayLabel
!text: tr('Turn delay: %sms', 30)
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 12
@onSetup: |
local value = modules.client_options.getOption('turnDelay')
self:setText(tr('Turn delay: %dms', value))
OptionScrollbar
id: turnDelay
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 3
minimum: 30
maximum: 250
Label
id: hotkeyDelayLabel
!text: tr('Hotkey delay: %dms', 30)
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 12
@onSetup: |
local value = modules.client_options.getOption('hotkeyDelay')
self:setText(tr('Hotkey delay: %dms', value))
OptionScrollbar
id: hotkeyDelay
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 3
minimum: 30
maximum: 250
Button
id: changeLocale
!text: tr('Change language')
@onClick: modules.client_locales.createWindow()
anchors.top: prev.bottom
anchors.left: prev.left
margin-top: 5
margin-top: 12
width: 120

View File

@@ -26,7 +26,9 @@ local defaultOptions = {
displayNames = true,
displayHealth = true,
displayText = true,
dontStretchShrink = false
dontStretchShrink = false,
turnDelay = 50,
hotkeyDelay = 50,
}
local optionsWindow
@@ -228,6 +230,10 @@ function setOption(key, value, force)
addEvent(function()
modules.game_interface.updateStretchShrink()
end)
elseif key == 'turnDelay' then
generalPanel:getChildById('turnDelayLabel'):setText(tr('Turn delay: %sms', value))
elseif key == 'hotkeyDelay' then
generalPanel:getChildById('hotkeyDelayLabel'):setText(tr('Hotkey delay: %sms', value))
end
-- change value for keybind updates