From 5884cfdea096bcbd242de1fdc2463817009f154a Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Thu, 10 Oct 2024 17:01:51 +0200 Subject: [PATCH] added WIP code --- src/core/Global.ttslua | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index e0786095..1f31bea9 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -959,6 +959,22 @@ end -- Content Importing and XML functions --------------------------------------------------------- +function onSearchValueChanged(a, b, c) + log(a) + log(b) + log(c) + + -- TODO: some kind of wait + updateDownloadItemList(true) +end + +function onAuthorFilterChanged(a, b, c) + log(a) + log(b) + log(c) + updateDownloadItemList(true) +end + -- forwards the requested content type to the update function and sets highlight to clicked tab ---@param tabId string Id of the clicked tab function onClick_tab(_, _, tabId) @@ -1334,7 +1350,8 @@ function formatLibrary(jsonResponse) end -- updates the window content to the requested content -function updateDownloadItemList() +---@param skipAuthorUpdate? boolean If true, skips the update for the author dropdown +function updateDownloadItemList(skipAuthorUpdate) if not library then return end -- addition of list items according to library file @@ -1343,6 +1360,9 @@ function updateDownloadItemList() contentList.children = {} for i, v in ipairs(library[contentToShow]) do + -- TODO: filter here + + -- TODO: store authors here table.insert(contentList.children, { tag = "Panel", @@ -1360,6 +1380,14 @@ function updateDownloadItemList() end contentList.attributes.height = #contentList.children * 27 + + -- TODO: maybe update authors + if not skipAuthorUpdate then + local authorDropdown = getXmlTableElementById(globalXml, 'authorDropdown') + + + end + updateGlobalXml(globalXml) -- select the first item @@ -2136,8 +2164,8 @@ function TokenManager.spawnMultipleTokens(card, tokenType, tokenCount, shiftDown local matColor = playermatApi.getMatColorByPosition(card.getPosition()) local activeInvestigatorData = playermatApi.getActiveInvestigatorData(matColor) callbackName = "updateUniversalActionAbilityToken" - callbackParams = { class = activeInvestigatorData.class, symbol = subType or activeInvestigatorData.class} - + callbackParams = { class = activeInvestigatorData.class, symbol = subType or activeInvestigatorData.class } + if temporary then callbackParams.addTag = "Temporary" end