Merge pull request #584 from Xertis/patch-12
Qol settings.controls update
This commit is contained in:
commit
1e4a7c8ea8
@ -1,3 +1,12 @@
|
||||
local WARNING_COLORS = {
|
||||
{208, 104, 107, 255},
|
||||
{250, 75, 139, 255},
|
||||
{250, 151, 75, 255},
|
||||
{246, 233, 44, 255},
|
||||
{252, 200, 149, 255}
|
||||
}
|
||||
|
||||
local GENERAL_WARNING_COLOR = {208, 138, 0, 255}
|
||||
|
||||
function refresh_search()
|
||||
local search_text = document.search_textbox.text
|
||||
@ -40,6 +49,49 @@ function change_sensitivity(val)
|
||||
refresh_sensitivity()
|
||||
end
|
||||
|
||||
function refresh_binding_marks()
|
||||
local prev_bindings = {}
|
||||
local conflicts_colors = {}
|
||||
local available_colors = table.copy(WARNING_COLORS)
|
||||
|
||||
local bindings = input.get_bindings()
|
||||
table.sort(bindings, function(a, b) return a > b end)
|
||||
|
||||
for _, bind_name in ipairs(bindings) do
|
||||
local key = input.get_binding_text(bind_name)
|
||||
local prev = prev_bindings[key]
|
||||
if prev then
|
||||
local color = GENERAL_WARNING_COLOR
|
||||
local conflict_color = conflicts_colors[key]
|
||||
local available_colors_len = #available_colors
|
||||
if conflict_color then
|
||||
color = conflict_color
|
||||
elseif available_colors_len > 0 then
|
||||
color = available_colors[available_colors_len]
|
||||
conflicts_colors[key] = color
|
||||
table.remove(available_colors, available_colors_len)
|
||||
end
|
||||
|
||||
local tooltip = gui.str("settings.Conflict", "settings")
|
||||
|
||||
local prev_bindmark = "bindmark_" .. prev
|
||||
local cur_bindmark = "bindmark_" .. bind_name
|
||||
document[prev_bindmark].visible = true
|
||||
document[cur_bindmark].visible = true
|
||||
|
||||
document[prev_bindmark].color = color
|
||||
document[cur_bindmark].color = color
|
||||
|
||||
document["bind_" .. prev].tooltip = tooltip
|
||||
document["bind_" .. bind_name].tooltip = tooltip
|
||||
else
|
||||
document["bindmark_" .. bind_name].visible = false
|
||||
document["bind_" .. bind_name].tooltip = ''
|
||||
prev_bindings[key] = bind_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function on_open()
|
||||
document.sensitivity_track.value = core.get_setting("camera.sensitivity")
|
||||
refresh_sensitivity()
|
||||
@ -52,4 +104,8 @@ function on_open()
|
||||
id=name, name=gui.str(name)
|
||||
}))
|
||||
end
|
||||
|
||||
document.bindings_panel:setInterval(100, function ()
|
||||
refresh_binding_marks()
|
||||
end)
|
||||
end
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<panel size='400,40' padding='4' color='0' orientation='horizontal'>
|
||||
<panel id='bind_%{id}' size='400,40' padding='4' color='0' orientation='horizontal'>
|
||||
<bindbox binding='%{id}'/>
|
||||
<label margin='6'>%{name}</label>
|
||||
<image id="bindmark_%{id}"src='gui/left_half_block' size='4,28' visible="false"/>
|
||||
<label id='bindlabel_%{id}' color="#ffffffff" margin='6'>%{name}</label>
|
||||
</panel>
|
||||
|
||||
@ -47,7 +47,8 @@
|
||||
"gui/info",
|
||||
"gui/world",
|
||||
"gui/hud",
|
||||
"gui/entity"
|
||||
"gui/entity",
|
||||
"gui/half_block"
|
||||
],
|
||||
"fonts": [
|
||||
{
|
||||
|
||||
@ -22,6 +22,7 @@ graphics.dense-render.tooltip=Enables transparency in blocks like leaves
|
||||
|
||||
# settings
|
||||
settings.Controls Search Mode=Search by attached button name
|
||||
settings.Conflict=Possible conflicts found
|
||||
|
||||
# Bindings
|
||||
chunks.reload=Reload Chunks
|
||||
|
||||
@ -100,6 +100,7 @@ settings.Controls Search Mode=Поиск по привязанной кнопк
|
||||
settings.Limit Background FPS=Ограничить фоновую частоту кадров
|
||||
settings.Advanced render=Продвинутый рендер
|
||||
settings.Shadows quality=Качество теней
|
||||
settings.Conflict=Найдены возможные конфликты
|
||||
|
||||
# Управление
|
||||
chunks.reload=Перезагрузить Чанки
|
||||
|
||||
BIN
res/textures/gui/half_block.png
Normal file
BIN
res/textures/gui/half_block.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 531 B |
Loading…
x
Reference in New Issue
Block a user