From c5e87b1e46e4857bbae3685eb4ffe34c95f77d30 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sat, 14 Oct 2023 23:37:50 +0200 Subject: [PATCH] added highlight effect --- src/core/Global.ttslua | 23 +++++++++++++++++------ xml/Global/DownloadWindow.xml | 10 +++++++++- xml/Global/OptionPanel.xml | 3 ++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 8245b33f..2c686d50 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -627,7 +627,17 @@ end -- forwards the requested content type to the update function ---@param player LuaPlayer Player that triggered this ---@param contentToShow String Name of the content type to show -function onClick_tab(player, contentToShow) +---@param id String Id of the clicked tab +function onClick_tab(player, contentToShow, id) + -- sets highlight to clicked tab + local idTable = {"tab1", "tab2","tab3","tab4","tab5"} + for _, listId in ipairs(idTable) do + if listId == id then + UI.setClass(listId, 'downloadTab activeTab') + else + UI.setClass(listId, 'downloadTab') + end + end update_list(contentToShow) end @@ -705,11 +715,12 @@ function onMouseEnter_item(player, param) local item = library[contentToShow][index] -- error handling - if not item.name - or not item.author - or not item.description - or not item.boxsize - or not item.boxart then + if not item + or not item.name or item.name == "" + or not item.author or item.author == "" + or not item.description or item.description == "" + or not item.boxsize or item.boxsize == "" + or not item.boxart or item.boxart == "" then return end diff --git a/xml/Global/DownloadWindow.xml b/xml/Global/DownloadWindow.xml index 98becdaf..46568c50 100644 --- a/xml/Global/DownloadWindow.xml +++ b/xml/Global/DownloadWindow.xml @@ -10,6 +10,9 @@ color="grey"/> diff --git a/xml/Global/OptionPanel.xml b/xml/Global/OptionPanel.xml index 7534c85e..c108e75f 100644 --- a/xml/Global/OptionPanel.xml +++ b/xml/Global/OptionPanel.xml @@ -80,7 +80,8 @@ + offsetXY="-50 80" + raycastTarget="true">