Fixes in options, hotkeys and viplist
This commit is contained in:
parent
3ca85cbe87
commit
62921dee9b
|
@ -1,11 +1,3 @@
|
||||||
VolumeScrollbar < HorizontalScrollBar
|
|
||||||
step: 1
|
|
||||||
@onValueChange: modules.client_options.setOption(self:getId(), self:getValue())
|
|
||||||
@onSetup: |
|
|
||||||
UIScrollBar.onSetup(self)
|
|
||||||
local value = modules.client_options.getOption(self:getId())
|
|
||||||
self:setValue(value)
|
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: enableAudio
|
id: enableAudio
|
||||||
|
@ -26,7 +18,7 @@ Panel
|
||||||
local value = modules.client_options.getOption('musicSoundVolume')
|
local value = modules.client_options.getOption('musicSoundVolume')
|
||||||
self:setText(tr('Music volume: %d', value))
|
self:setText(tr('Music volume: %d', value))
|
||||||
|
|
||||||
VolumeScrollbar
|
OptionScrollbar
|
||||||
id: musicSoundVolume
|
id: musicSoundVolume
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
FrameRateScrollbar < HorizontalScrollBar
|
|
||||||
step: 1
|
|
||||||
@onValueChange: modules.client_options.setOption(self:getId(), self:getValue())
|
|
||||||
@onSetup: |
|
|
||||||
UIScrollBar.onSetup(self)
|
|
||||||
local value = modules.client_options.getOption(self:getId())
|
|
||||||
if value == 0 then value = self:getMaximum() end
|
|
||||||
self:setValue(value)
|
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
ButtonBox
|
ButtonBox
|
||||||
id: opengl1
|
id: opengl1
|
||||||
|
@ -65,7 +56,7 @@ Panel
|
||||||
|
|
||||||
self:setText(tr('Game framerate limit: %s', text))
|
self:setText(tr('Game framerate limit: %s', text))
|
||||||
|
|
||||||
FrameRateScrollbar
|
OptionScrollbar
|
||||||
id: backgroundFrameRate
|
id: backgroundFrameRate
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -89,7 +80,7 @@ Panel
|
||||||
|
|
||||||
self:setText(tr('Interface framerate limit: %s', text))
|
self:setText(tr('Interface framerate limit: %s', text))
|
||||||
|
|
||||||
FrameRateScrollbar
|
OptionScrollbar
|
||||||
id: foregroundFrameRate
|
id: foregroundFrameRate
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -108,7 +99,7 @@ Panel
|
||||||
local value = modules.client_options.getOption('ambientLight')
|
local value = modules.client_options.getOption('ambientLight')
|
||||||
self:setText(tr('Ambient light: %s%%', value))
|
self:setText(tr('Ambient light: %s%%', value))
|
||||||
|
|
||||||
FrameRateScrollbar
|
OptionScrollbar
|
||||||
id: ambientLight
|
id: ambientLight
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
@ -175,7 +175,6 @@ function setOption(key, value, force)
|
||||||
if not force and options[key] == value then return end
|
if not force and options[key] == value then return end
|
||||||
local gameMapPanel = modules.game_interface.getMapPanel()
|
local gameMapPanel = modules.game_interface.getMapPanel()
|
||||||
|
|
||||||
local panel = nil
|
|
||||||
if key == 'vsync' then
|
if key == 'vsync' then
|
||||||
g_window.setVerticalSync(value)
|
g_window.setVerticalSync(value)
|
||||||
elseif key == 'showFps' then
|
elseif key == 'showFps' then
|
||||||
|
@ -184,7 +183,6 @@ function setOption(key, value, force)
|
||||||
modules.client_topmenu.setPingVisible(value)
|
modules.client_topmenu.setPingVisible(value)
|
||||||
elseif key == 'fullscreen' then
|
elseif key == 'fullscreen' then
|
||||||
g_window.setFullscreen(value)
|
g_window.setFullscreen(value)
|
||||||
panel = graphicsPanel
|
|
||||||
elseif key == 'enableAudio' then
|
elseif key == 'enableAudio' then
|
||||||
g_sounds.setAudioEnabled(value)
|
g_sounds.setAudioEnabled(value)
|
||||||
if value then
|
if value then
|
||||||
|
@ -192,7 +190,6 @@ function setOption(key, value, force)
|
||||||
else
|
else
|
||||||
audioButton:setIcon('/images/topbuttons/audio_mute')
|
audioButton:setIcon('/images/topbuttons/audio_mute')
|
||||||
end
|
end
|
||||||
panel = audioPanel
|
|
||||||
elseif key == 'enableMusicSound' then
|
elseif key == 'enableMusicSound' then
|
||||||
g_sounds.getChannel(SoundChannels.Music):setEnabled(value)
|
g_sounds.getChannel(SoundChannels.Music):setEnabled(value)
|
||||||
elseif key == 'musicSoundVolume' then
|
elseif key == 'musicSoundVolume' then
|
||||||
|
@ -201,15 +198,15 @@ function setOption(key, value, force)
|
||||||
elseif key == 'showLeftPanel' then
|
elseif key == 'showLeftPanel' then
|
||||||
modules.game_interface.getLeftPanel():setOn(value)
|
modules.game_interface.getLeftPanel():setOn(value)
|
||||||
elseif key == 'backgroundFrameRate' then
|
elseif key == 'backgroundFrameRate' then
|
||||||
local text = value
|
local text, v = value, value
|
||||||
if value <= 0 or value >= 201 then text = 'max' value = 0 end
|
if value <= 0 or value >= 201 then text = 'max' v = 0 end
|
||||||
graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text))
|
graphicsPanel:getChildById('backgroundFrameRateLabel'):setText(tr('Game framerate limit: %s', text))
|
||||||
g_app.setBackgroundPaneMaxFps(value)
|
g_app.setBackgroundPaneMaxFps(v)
|
||||||
elseif key == 'foregroundFrameRate' then
|
elseif key == 'foregroundFrameRate' then
|
||||||
local text = value
|
local text, v = value, value
|
||||||
if value <= 0 or value >= 61 then text = 'max' value = 0 end
|
if value <= 0 or value >= 61 then text = 'max' v = 0 end
|
||||||
graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
|
graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
|
||||||
g_app.setForegroundPaneMaxFps(value)
|
g_app.setForegroundPaneMaxFps(v)
|
||||||
elseif key == 'enableLights' then
|
elseif key == 'enableLights' then
|
||||||
gameMapPanel:setDrawLights(value and options['ambientLight'] < 100)
|
gameMapPanel:setDrawLights(value and options['ambientLight'] < 100)
|
||||||
graphicsPanel:getChildById('ambientLight'):setEnabled(value)
|
graphicsPanel:getChildById('ambientLight'):setEnabled(value)
|
||||||
|
@ -222,20 +219,22 @@ function setOption(key, value, force)
|
||||||
g_graphics.selectPainterEngine(value)
|
g_graphics.selectPainterEngine(value)
|
||||||
elseif key == 'displayNames' then
|
elseif key == 'displayNames' then
|
||||||
gameMapPanel:setDrawNames(value)
|
gameMapPanel:setDrawNames(value)
|
||||||
panel = generalPanel
|
|
||||||
elseif key == 'displayHealth' then
|
elseif key == 'displayHealth' then
|
||||||
gameMapPanel:setDrawHealthBars(value)
|
gameMapPanel:setDrawHealthBars(value)
|
||||||
panel = generalPanel
|
|
||||||
elseif key == 'displayText' then
|
elseif key == 'displayText' then
|
||||||
gameMapPanel:setDrawTexts(value)
|
gameMapPanel:setDrawTexts(value)
|
||||||
panel = generalPanel
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- change value for keybind updates
|
-- change value for keybind updates
|
||||||
if panel then
|
for _,panel in pairs(optionsTabBar:getTabsPanel()) do
|
||||||
local widget = panel:recursiveGetChildById(key)
|
local widget = panel:recursiveGetChildById(key)
|
||||||
if widget and widget:getStyle().__class == 'UICheckBox' then
|
if widget then
|
||||||
widget:setChecked(value)
|
if widget:getStyle().__class == 'UICheckBox' then
|
||||||
|
widget:setChecked(value)
|
||||||
|
elseif widget:getStyle().__class == 'UIScrollBar' then
|
||||||
|
widget:setValue(value)
|
||||||
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
OptionCheckBox < CheckBox
|
OptionCheckBox < CheckBox
|
||||||
@onCheckChange: modules.client_options.setOption(self:getId(), self:isChecked())
|
@onCheckChange: modules.client_options.setOption(self:getId(), self:isChecked())
|
||||||
@onSetup: self:setChecked(modules.client_options.getOption(self:getId()))
|
|
||||||
height: 16
|
height: 16
|
||||||
|
|
||||||
$first:
|
$first:
|
||||||
|
@ -14,6 +13,10 @@ OptionCheckBox < CheckBox
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
margin-top: 2
|
margin-top: 2
|
||||||
|
|
||||||
|
OptionScrollbar < HorizontalScrollBar
|
||||||
|
step: 1
|
||||||
|
@onValueChange: modules.client_options.setOption(self:getId(), self:getValue())
|
||||||
|
|
||||||
MainWindow
|
MainWindow
|
||||||
id: optionsWindow
|
id: optionsWindow
|
||||||
!text: tr('Options')
|
!text: tr('Options')
|
||||||
|
|
|
@ -167,3 +167,17 @@ function table.tostring(t)
|
||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.collect(t, func)
|
||||||
|
local res = {}
|
||||||
|
for k,v in pairs(t) do
|
||||||
|
local a,b = func(k,v)
|
||||||
|
if a and b then
|
||||||
|
res[a] = b
|
||||||
|
elseif a ~= nil then
|
||||||
|
table.insert(res,a)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
@ -144,3 +144,11 @@ end
|
||||||
function UITabBar:getCurrentTab()
|
function UITabBar:getCurrentTab()
|
||||||
return self.currentTab
|
return self.currentTab
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function UITabBar:getTabs()
|
||||||
|
return self.tabs
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:getTabsPanel()
|
||||||
|
return table.collect(self.tabs, function(_,tab) return tab.tabPanel end)
|
||||||
|
end
|
||||||
|
|
|
@ -680,6 +680,10 @@ function sendMessage(message, tab)
|
||||||
elseif tab.npcChat then
|
elseif tab.npcChat then
|
||||||
speaktypedesc = 'privatePlayerToNpc'
|
speaktypedesc = 'privatePlayerToNpc'
|
||||||
elseif tab == violationReportTab then
|
elseif tab == violationReportTab then
|
||||||
|
if violationReportTab.locked then
|
||||||
|
modules.game_textmessage.displayFailureMessage('Wait for a gamemaster reply.')
|
||||||
|
return
|
||||||
|
end
|
||||||
speaktypedesc = 'rvrContinue'
|
speaktypedesc = 'rvrContinue'
|
||||||
tabname = tr('Report Rule') .. '...'
|
tabname = tr('Report Rule') .. '...'
|
||||||
elseif tab.violationChatName then
|
elseif tab.violationChatName then
|
||||||
|
|
|
@ -1129,6 +1129,11 @@ void Game::removeVip(int playerId)
|
||||||
{
|
{
|
||||||
if(!canPerformGameAction())
|
if(!canPerformGameAction())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto it = m_vips.find(playerId);
|
||||||
|
if(it == m_vips.end())
|
||||||
|
return;
|
||||||
|
m_vips.erase(it);
|
||||||
m_protocolGame->sendRemoveVip(playerId);
|
m_protocolGame->sendRemoveVip(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -349,11 +349,13 @@ void UIManager::importStyleFromOTML(const OTMLNodePtr& styleNode)
|
||||||
OTMLNodePtr oldStyle = m_styles[name];
|
OTMLNodePtr oldStyle = m_styles[name];
|
||||||
|
|
||||||
// Warn about redefined styles
|
// Warn about redefined styles
|
||||||
|
/*
|
||||||
if(!g_app.isRunning() && (oldStyle && !oldStyle->valueAt("__unique", false))) {
|
if(!g_app.isRunning() && (oldStyle && !oldStyle->valueAt("__unique", false))) {
|
||||||
auto it = m_styles.find(name);
|
auto it = m_styles.find(name);
|
||||||
if(it != m_styles.end())
|
if(it != m_styles.end())
|
||||||
g_logger.warning(stdext::format("style '%s' is being redefined", name));
|
g_logger.warning(stdext::format("style '%s' is being redefined", name));
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if(!oldStyle || !oldStyle->valueAt("__unique", false) || unique) {
|
if(!oldStyle || !oldStyle->valueAt("__unique", false) || unique) {
|
||||||
OTMLNodePtr originalStyle = getStyle(base);
|
OTMLNodePtr originalStyle = getStyle(base);
|
||||||
|
|
|
@ -41,7 +41,7 @@ UITextEdit::UITextEdit()
|
||||||
m_maxLength = 0;
|
m_maxLength = 0;
|
||||||
m_editable = true;
|
m_editable = true;
|
||||||
m_selectable = true;
|
m_selectable = true;
|
||||||
m_autoScroll = false;
|
m_autoScroll = true;
|
||||||
m_changeCursorImage = true;
|
m_changeCursorImage = true;
|
||||||
m_selectionReference = 0;
|
m_selectionReference = 0;
|
||||||
m_selectionStart = 0;
|
m_selectionStart = 0;
|
||||||
|
|
Loading…
Reference in New Issue