Skip to content

Commit

Permalink
Adjusted ProgressBarElement visuals
Browse files Browse the repository at this point in the history
  • Loading branch information
scfmod committed Dec 20, 2023
1 parent 310f177 commit 1412e7d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
21 changes: 14 additions & 7 deletions scripts/gui/InGameMenuConstructionsFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion xml/gui/guiProfiles.template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@
<Profile name="construction_inputListItemProgressBar" extends="theme_progressBar" with="anchorMiddleRight">
<Value name="size" value="384px 8px" />
<Value name="position" value="-20px -12px" />

<Value name="secondaryDisabledColor" value="0.089 0.527 0.309 0.5" />
</Profile>

<!-- Construction status -->
Expand Down Expand Up @@ -623,7 +625,7 @@
<Value name="position" value="-20px -12px" />

<Value name="primaryColor" value="$_rgba(progressColorSecondary)" />
<Value name="primaryDisabledColor" value="$_rgba(progressDisabledColorSecondary)" />
<Value name="primaryDisabledColor" value="0.089 0.527 0.309 0.5" />
</Profile>

<Profile name="constructionInputs_listVerticalSlider" extends="verticalListSliderRightDocked" with="anchorTopRight">
Expand Down
4 changes: 3 additions & 1 deletion xml/gui/guiProfiles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@
<Profile name="construction_inputListItemProgressBar" extends="theme_progressBar" with="anchorMiddleRight">
<Value name="size" value="384px 8px" />
<Value name="position" value="-20px -12px" />

<Value name="secondaryDisabledColor" value="0.089 0.527 0.309 0.5" />
</Profile>

<!-- Construction status -->
Expand Down Expand Up @@ -623,7 +625,7 @@
<Value name="position" value="-20px -12px" />

<Value name="primaryColor" value="0.0227 0.5346 0.8519 1" />
<Value name="primaryDisabledColor" value="0.5 0.5 0.5 0.5" />
<Value name="primaryDisabledColor" value="0.089 0.527 0.309 0.5" />
</Profile>

<Profile name="constructionInputs_listVerticalSlider" extends="verticalListSliderRightDocked" with="anchorTopRight">
Expand Down

0 comments on commit 1412e7d

Please sign in to comment.