From 1412e7d6883fa68ad0a646050ec4ca940d0803dc Mon Sep 17 00:00:00 2001 From: scfmod Date: Wed, 20 Dec 2023 23:22:40 +0100 Subject: [PATCH] Adjusted ProgressBarElement visuals --- scripts/gui/InGameMenuConstructionsFrame.lua | 21 +++++++++++++------- xml/gui/guiProfiles.template.xml | 4 +++- xml/gui/guiProfiles.xml | 4 +++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/gui/InGameMenuConstructionsFrame.lua b/scripts/gui/InGameMenuConstructionsFrame.lua index a449e9d..d4b30a8 100644 --- a/scripts/gui/InGameMenuConstructionsFrame.lua +++ b/scripts/gui/InGameMenuConstructionsFrame.lua @@ -346,6 +346,9 @@ function InGameMenuConstructionsFrame:populateCellForItemInSection(list, section local activeState = placeable:getActiveState() local fillType = input:getFillType() + local isActive = state == activeState + + cell:setDisabled(not isActive) if fillType ~= nil then cell:getAttribute('icon'):setImageFilename(fillType.hudOverlayFilename) @@ -355,22 +358,26 @@ function InGameMenuConstructionsFrame:populateCellForItemInSection(list, section cell:getAttribute('fillType'):setText(input.fillTypeName) end - if state == activeState then + ---@type ProgressBarElement + local progressBar = cell:getAttribute('progressBar') + + if isActive then cell:getAttribute('fillLevel'):setText(('%s / %s'):format(ConstructionUtils.formatNumber(input.deliveredAmount), ConstructionUtils.formatNumber(input.amount))) - cell:getAttribute('progressBar'):setPrimary(1 / input.amount * input.deliveredAmount) - cell:getAttribute('progressBar'):setSecondary(1 / input.amount * input.processedAmount) - cell:getAttribute('progressBar'):setDisabled(false) + progressBar:setPrimary(1 / input.amount * input.deliveredAmount) + progressBar:setSecondary(1 / input.amount * input.processedAmount) + progressBar:setDisabled(false) else cell:getAttribute('fillLevel'):setText(ConstructionUtils.formatNumber(input.amount)) if state.index < activeState.index then - cell:getAttribute('progressBar'):setSecondary(1) + progressBar:setSecondary(1) else - cell:getAttribute('progressBar'):setSecondary(0) + progressBar:setSecondary(0) end - cell:getAttribute('progressBar'):setDisabled(true) + progressBar:setDisabled(true) + progressBar:setPrimary(0) end end end diff --git a/xml/gui/guiProfiles.template.xml b/xml/gui/guiProfiles.template.xml index 6722e59..eb17fbb 100644 --- a/xml/gui/guiProfiles.template.xml +++ b/xml/gui/guiProfiles.template.xml @@ -423,6 +423,8 @@ + + @@ -623,7 +625,7 @@ - + diff --git a/xml/gui/guiProfiles.xml b/xml/gui/guiProfiles.xml index cc4814d..31ba3af 100644 --- a/xml/gui/guiProfiles.xml +++ b/xml/gui/guiProfiles.xml @@ -423,6 +423,8 @@ + + @@ -623,7 +625,7 @@ - +