From 28cae22c0b6a4c274b0af4edb9f272bb597d6891 Mon Sep 17 00:00:00 2001 From: Paletz Date: Wed, 15 May 2024 03:25:16 +0200 Subject: [PATCH] Fix display of engineers' reclaim statistics in non-default unitview layouts (#6162) --- changelog/snippets/fix.6162.md | 1 + lua/ui/game/layouts/unitview_left.lua | 30 ++++++++++++++++++-------- lua/ui/game/layouts/unitview_mini.lua | 2 +- lua/ui/game/layouts/unitview_right.lua | 22 +++++++++++++++++++ 4 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 changelog/snippets/fix.6162.md diff --git a/changelog/snippets/fix.6162.md b/changelog/snippets/fix.6162.md new file mode 100644 index 0000000000..b5dc805191 --- /dev/null +++ b/changelog/snippets/fix.6162.md @@ -0,0 +1 @@ +- (#6162) Fix the display of engineers' reclaim statistics in the left and right UI layouts (default is the bottom layout). diff --git a/lua/ui/game/layouts/unitview_left.lua b/lua/ui/game/layouts/unitview_left.lua index d9d924ce32..176455b03e 100644 --- a/lua/ui/game/layouts/unitview_left.lua +++ b/lua/ui/game/layouts/unitview_left.lua @@ -24,6 +24,8 @@ local iconTextures = { UIUtil.UIFile('/game/unit_view_icons/shield.dds'), UIUtil.UIFile('/game/unit_view_icons/fuel.dds'), UIUtil.UIFile('/game/unit_view_icons/build.dds'), + UIUtil.UIFile('/game/unit_view_icons/reclaim_alt_mass.dds'), + UIUtil.UIFile('/game/unit_view_icons/reclaim_alt_energy.dds'), } function SetLayout() @@ -82,17 +84,27 @@ function SetLayout() LayoutHelpers.SetDimensions(controls.vetBar, 56, 3) controls.vetBar:SetTexture(UIUtil.UIFile('/game/unit-build-over-panel/healthbar_bg.dds')) controls.vetBar._bar:SetTexture(UIUtil.UIFile('/game/unit-build-over-panel/fuelbar.dds')) + + LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup, controls.bg, 188, 58) + LayoutHelpers.SetDimensions(controls.ReclaimGroup, 100, 48) + -- LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup.Title, controls.ReclaimGroup, -10, 0) + controls.ReclaimGroup.MassIcon:SetTexture(iconTextures[9]) + controls.ReclaimGroup.EnergyIcon:SetTexture(iconTextures[10]) + LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup.MassIcon, controls.ReclaimGroup, 1, 2) + LayoutHelpers.RightOf(controls.ReclaimGroup.EnergyIcon, controls.ReclaimGroup.MassIcon, 5) - LayoutHelpers.AtLeftTopIn(controls.vetBar, controls.bg, 192, 68) - LayoutHelpers.SetDimensions(controls.vetBar, 56, 3) - controls.vetBar:SetTexture(UIUtil.UIFile('/game/unit-build-over-panel/healthbar_bg.dds')) - controls.vetBar._bar:SetTexture(UIUtil.UIFile('/game/unit-build-over-panel/fuelbar.dds')) + LayoutHelpers.Below(controls.ReclaimGroup.MassText, controls.ReclaimGroup.MassIcon, 2) + LayoutHelpers.AtHorizontalCenterIn(controls.ReclaimGroup.MassText, controls.ReclaimGroup.MassIcon, -2) + + + LayoutHelpers.Below(controls.ReclaimGroup.EnergyText, controls.ReclaimGroup.EnergyIcon, 2) + LayoutHelpers.AtHorizontalCenterIn(controls.ReclaimGroup.EnergyText, controls.ReclaimGroup.EnergyIcon, -2) + + LayoutHelpers.FillParent(controls.ReclaimGroup.Debug, controls.ReclaimGroup) + + controls.ReclaimGroup.Debug:SetSolidColor('00ffffff') + controls.ReclaimGroup.Debug.Depth:Set(-1000000) - LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup, controls.bg, 192, 68) - LayoutHelpers.SetDimensions(controls.ReclaimGroup, 200, 200) - LayoutHelpers.FillParent(controls.ReclaimGroup.MassIcon, controls.ReclaimGroup) - controls.ReclaimGroup.MassIcon:SetSolidColor('ffffffff') - LayoutHelpers.Below(controls.nextVet, controls.vetBar) controls.nextVet:SetDropShadow(true) LayoutHelpers.Above(controls.vetTitle, controls.vetBar) diff --git a/lua/ui/game/layouts/unitview_mini.lua b/lua/ui/game/layouts/unitview_mini.lua index 172fbb8286..4e93694431 100644 --- a/lua/ui/game/layouts/unitview_mini.lua +++ b/lua/ui/game/layouts/unitview_mini.lua @@ -26,6 +26,7 @@ local iconTextures = { UIUtil.UIFile('/game/unit_view_icons/reclaim_alt_mass.dds'), UIUtil.UIFile('/game/unit_view_icons/reclaim_alt_energy.dds'), } + function SetLayout() local controls = import("/lua/ui/game/unitview.lua").controls @@ -146,7 +147,6 @@ function SetLayout() LayoutHelpers.RightOf(controls.ReclaimGroup.EnergyIcon, controls.ReclaimGroup.MassIcon, 5) LayoutHelpers.Below(controls.ReclaimGroup.MassText, controls.ReclaimGroup.MassIcon, 2) - LayoutHelpers.AtHorizontalCenterIn(controls.ReclaimGroup.MassText, controls.ReclaimGroup.MassIcon, -2) diff --git a/lua/ui/game/layouts/unitview_right.lua b/lua/ui/game/layouts/unitview_right.lua index 8eabda629c..605950ceb5 100644 --- a/lua/ui/game/layouts/unitview_right.lua +++ b/lua/ui/game/layouts/unitview_right.lua @@ -23,6 +23,8 @@ local iconTextures = { UIUtil.UIFile('/game/unit_view_icons/shield.dds'), UIUtil.UIFile('/game/unit_view_icons/fuel.dds'), UIUtil.UIFile('/game/unit_view_icons/build.dds'), + UIUtil.UIFile('/game/unit_view_icons/reclaim_alt_mass.dds'), + UIUtil.UIFile('/game/unit_view_icons/reclaim_alt_energy.dds'), } function SetLayout() @@ -76,6 +78,26 @@ function SetLayout() controls.vetBar:SetTexture(UIUtil.UIFile('/game/unit-build-over-panel/healthbar_bg.dds')) controls.vetBar._bar:SetTexture(UIUtil.UIFile('/game/unit-build-over-panel/fuelbar.dds')) + LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup, controls.bg, 188, 58) + LayoutHelpers.SetDimensions(controls.ReclaimGroup, 100, 48) + -- LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup.Title, controls.ReclaimGroup, -10, 0) + controls.ReclaimGroup.MassIcon:SetTexture(iconTextures[9]) + controls.ReclaimGroup.EnergyIcon:SetTexture(iconTextures[10]) + LayoutHelpers.AtLeftTopIn(controls.ReclaimGroup.MassIcon, controls.ReclaimGroup, 1, 2) + LayoutHelpers.RightOf(controls.ReclaimGroup.EnergyIcon, controls.ReclaimGroup.MassIcon, 5) + + LayoutHelpers.Below(controls.ReclaimGroup.MassText, controls.ReclaimGroup.MassIcon, 2) + LayoutHelpers.AtHorizontalCenterIn(controls.ReclaimGroup.MassText, controls.ReclaimGroup.MassIcon, -2) + + + LayoutHelpers.Below(controls.ReclaimGroup.EnergyText, controls.ReclaimGroup.EnergyIcon, 2) + LayoutHelpers.AtHorizontalCenterIn(controls.ReclaimGroup.EnergyText, controls.ReclaimGroup.EnergyIcon, -2) + + LayoutHelpers.FillParent(controls.ReclaimGroup.Debug, controls.ReclaimGroup) + + controls.ReclaimGroup.Debug:SetSolidColor('00ffffff') + controls.ReclaimGroup.Debug.Depth:Set(-1000000) + LayoutHelpers.Below(controls.nextVet, controls.vetBar) controls.nextVet:SetDropShadow(true) LayoutHelpers.Above(controls.vetTitle, controls.vetBar)