diff --git a/src/core/tour/TourManager.ttslua b/src/core/tour/TourManager.ttslua index 7a63d999..834c3570 100644 --- a/src/core/tour/TourManager.ttslua +++ b/src/core/tour/TourManager.ttslua @@ -179,19 +179,33 @@ do return end tourCardTemplate.attributes.id = internal.getUiId(CARD_ID, playerColor) - tourCardTemplate.attributes.visibility = playerColor tourCardTemplate.children[1].attributes.id = internal.getUiId(NARRATOR_ID, playerColor) tourCardTemplate.children[2].children[1].attributes.id = internal.getUiId(TEXT_ID, playerColor) tourCardTemplate.children[3].attributes.id = internal.getUiId(NEXT_BUTTON_ID, playerColor) - tourCardTemplate.children[4].attributes.id = internal.getUiId(STOP_BUTTON_ID, playerColor) tourCardTemplate.children[3].attributes.onClick = self.getGUID().."/nextCard" + tourCardTemplate.children[4].attributes.id = internal.getUiId(STOP_BUTTON_ID, playerColor) tourCardTemplate.children[4].attributes.onClick = self.getGUID().."/stopTour" + internal.setDeepVisibility(tourCardTemplate, playerColor) local globalXml = Global.UI.getXmlTable() table.insert(globalXml, tourCardTemplate) Global.UI.setXmlTable(globalXml) end + -- Panels don't cause their children to inherit their visibility value, so this recurses down the + -- XML table to set all children to the same visibility. + ---@param xmlUi Table. Lua table describing the XML + ---@param playerColor String. String color of the player to make this visible for + internal.setDeepVisibility = function(xmlUi, playerColor) + xmlUi.attributes.visibility = "" .. playerColor + log(xmlUi.attributes.id) + if xmlUi.children ~= nil then + for _, child in ipairs(xmlUi.children) do + internal.setDeepVisibility(child, playerColor) + end + end + end + internal.getUiId = function(baseId, playerColor) return baseId .. "_" .. playerColor end