generated ui nodes indexing
This commit is contained in:
@@ -1,28 +1,27 @@
|
||||
function on_open()
|
||||
new_volume_control("audio.volume-master", "master")
|
||||
new_volume_control("audio.volume-regular", "regular")
|
||||
new_volume_control("audio.volume-ui", "ui")
|
||||
new_volume_control("audio.volume-ambient", "ambient")
|
||||
new_volume_control("audio.volume-music", "music")
|
||||
|
||||
gui.reindex("core:pages/settings-audio")
|
||||
|
||||
on_master_change()
|
||||
on_regular_change()
|
||||
on_ui_change()
|
||||
on_ambient_change()
|
||||
on_music_change()
|
||||
new_volume_control("audio.volume-master", "master", "Master Volume")
|
||||
new_volume_control("audio.volume-regular", "regular", "Regular Sounds")
|
||||
new_volume_control("audio.volume-ui", "ui", "UI Sounds")
|
||||
new_volume_control("audio.volume-ambient", "ambient", "Ambient")
|
||||
new_volume_control("audio.volume-music", "music", "Music")
|
||||
end
|
||||
|
||||
|
||||
function new_volume_control(setting, id, name)
|
||||
-- value text label
|
||||
document.tracks_panel:add("<label id='l_"..id.."'>-</label>")
|
||||
-- value track-bar
|
||||
document.tracks_panel:add(string.format(
|
||||
"<trackbar id='t_%s' min='0' max='1' value='1' step='0.01' track-width='5' "..
|
||||
" consumer='on_%s_change'/>"
|
||||
, id, id))
|
||||
" consumer='function(x) on_volume_change(%q, %q, %q, x) end'/>"
|
||||
, id, setting, id, name))
|
||||
refresh_label(setting, id, name)
|
||||
end
|
||||
|
||||
function refresh_label(setting, id, name)
|
||||
document["l_"..id].text = (
|
||||
gui.str(name, "settings")..": "..
|
||||
core.str_setting(setting)
|
||||
)
|
||||
end
|
||||
|
||||
function on_volume_change(setting, id, name, val)
|
||||
@@ -31,28 +30,5 @@ function on_volume_change(setting, id, name, val)
|
||||
else
|
||||
document["t_"..id].value = core.get_setting(setting, val)
|
||||
end
|
||||
document["l_"..id].text = (
|
||||
gui.str(name, "settings")..": "..
|
||||
core.str_setting(setting)
|
||||
)
|
||||
end
|
||||
|
||||
function on_master_change(val)
|
||||
on_volume_change("audio.volume-master", "master", "Master Volume", val)
|
||||
end
|
||||
|
||||
function on_regular_change(val)
|
||||
on_volume_change("audio.volume-regular", "regular", "Regular Sounds", val)
|
||||
end
|
||||
|
||||
function on_ui_change(val)
|
||||
on_volume_change("audio.volume-ui", "ui", "UI Sounds", val)
|
||||
end
|
||||
|
||||
function on_ambient_change(val)
|
||||
on_volume_change("audio.volume-ambient", "ambient", "Ambient", val)
|
||||
end
|
||||
|
||||
function on_music_change(val)
|
||||
on_volume_change("audio.volume-music", "music", "Music", val)
|
||||
refresh_label(setting, id, name)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user