Divergent/mods/UI Rework G.A.M.M.A. Style/gamedata/scripts/modxml_ui_pda_fixes.script

210 lines
5.7 KiB
Plaintext
Raw Normal View History

function on_xml_read()
RegisterScriptCallback("on_xml_read", function(xml_file_name, xml_obj)
-- PDA checkboxes
if xml_file_name == [[ui\pda_relations_f9.xml]]
or xml_file_name == [[ui\pda_relations_f10.xml]]
or xml_file_name == [[ui\pda_relations_f11.xml]]
or xml_file_name == [[ui\pda_relations_f12.xml]]
or xml_file_name == [[ui\pda_relations_f13.xml]]
or xml_file_name == [[ui\pda_relations_f14.xml]]
or xml_file_name == [[ui\pda_contacts.xml]]
or xml_file_name == [[ui\pda_contacts_16.xml]]
or xml_file_name == [[ui\pda_encyclopedia.xml]]
or xml_file_name == [[ui\pda_encyclopedia_16.xml]]
or xml_file_name == [[ui\pda_logs.xml]]
or xml_file_name == [[ui\pda_logs_16.xml]]
or xml_file_name == [[ui\pda_relations.xml]]
or xml_file_name == [[ui\pda_relations_16.xml]]
then
-- auto_check
local res = xml_obj:query("auto_check")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("auto_check > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=-20, y=2})
end
-- show_all
local res = xml_obj:query("show_all")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("show_all > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=-20, y=2})
end
-- image_checkbox
local res = xml_obj:query("image_checkbox")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("image_checkbox > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=-20, y=2})
end
-- message_checkbox
local res = xml_obj:query("message_checkbox")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("message_checkbox > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=-20, y=2})
end
-- filter_news
local res = xml_obj:query("filter_news")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("filter_news > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=-20, y=2})
end
-- filter_talk
local res = xml_obj:query("filter_talk")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("filter_talk > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=-20, y=2})
end
end
-- PDA upper buttons bg
if xml_file_name == [[ui\pda.xml]]
or xml_file_name == [[ui\pda_16.xml]]
then
local res = xml_obj:query("background_static > auto_frameline")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=753})
end
if res[2] then
local el = res[2]
xml_obj:setElementAttr(el, {width=0, height=0})
end
end
-- PDA small buttons bg
if xml_file_name == [[ui\pda_tasks.xml]]
or xml_file_name == [[ui\pda_tasks_16.xml]]
then
local res = xml_obj:query("center_background > auto_static")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=0, height=0, stretch=1})
end
if res[2] then
local el = res[2]
xml_obj:setElementAttr(el, {width=0, height=0})
end
local res = xml_obj:query("center_background > auto_frameline")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=0, y=8, width=764, height=19})
end
local res = xml_obj:query("filter_quest_npcs")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=615})
end
end
-- iTheon PDA taskboard buttons
if xml_file_name == [[ui\pda_taskboard.xml]]
or xml_file_name == [[ui\pda_taskboard_16.xml]]
then
local res = xml_obj:query("btn_accept_task")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("btn_accept_task > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=20, y=1, vert_align="c"})
end
local res = xml_obj:query("btn_next_task")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("btn_next_task > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=20, y=1, vert_align="c"})
end
local res = xml_obj:query("btn_refresh_tasks")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("btn_refresh_tasks > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=20, y=1, vert_align="c"})
end
end
if xml_file_name == [[ui\pda_taskboard.xml]]
or xml_file_name == [[ui\pda_taskboard_16.xml]]
then
local res = xml_obj:query("btn_accept_task")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("btn_accept_task > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=20, y=1, vert_align="c"})
end
local res = xml_obj:query("btn_next_task")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("btn_next_task > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=20, y=1, vert_align="c"})
end
local res = xml_obj:query("btn_refresh_tasks")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {width=15})
end
local res = xml_obj:query("btn_refresh_tasks > text")
if res[1] then
local el = res[1]
xml_obj:setElementAttr(el, {x=20, y=1, vert_align="c"})
end
end
end)
end