From 1b251e9542d44f4455fe8c2276b38c79c84504f4 Mon Sep 17 00:00:00 2001 From: way-zer Date: Thu, 18 Apr 2024 23:22:45 +0800 Subject: [PATCH] =?UTF-8?q?fixup!=20C:=20StatExt=20=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E8=83=BD=E5=8A=9B=E6=98=BE=E7=A4=BA=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/mindustry/world/meta/StatValues.java | 27 +++++++++---------- core/src/mindustryX/features/StatExt.java | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/src/mindustry/world/meta/StatValues.java b/core/src/mindustry/world/meta/StatValues.java index 909069a1a413..4b4d36fcdce2 100644 --- a/core/src/mindustry/world/meta/StatValues.java +++ b/core/src/mindustry/world/meta/StatValues.java @@ -413,22 +413,21 @@ public static StatValue weapons(UnitType unit, Seq weapons){ public static StatValue abilities(UnitType unit, Seq abilities){ return table -> { table.row(); - table.table(t -> { - t.background(Styles.grayPanel); - for(Ability a : abilities){ - if(!a.display) continue; - String description = StatExt.description(a, unit); - if(description != null){ - t.table(tt -> { - tt.add(a.localized()).width(100f); - tt.add(description).minWidth(350f).padRight(12f).padBottom(5f); - }); - }else{ - t.add(a.localized()).minWidth(350f).padRight(12f).padBottom(5f); - } + table.table(t -> abilities.each(ability -> { + if(ability.display){ t.row(); + t.table(Styles.grayPanel, a -> { + a.left().top().defaults().left(); + a.add("[accent]" + ability.localized()).minWidth(100).padBottom(4); + var customDescription = StatExt.description(ability, unit); + if(customDescription != null){ + a.add(customDescription).row(); + } + a.defaults().colspan(2); + ability.addStats(a); + }).pad(5).margin(10).growX(); } - }).padLeft(12f); + })); }; } diff --git a/core/src/mindustryX/features/StatExt.java b/core/src/mindustryX/features/StatExt.java index 148c59f53c63..60188fbb5b58 100644 --- a/core/src/mindustryX/features/StatExt.java +++ b/core/src/mindustryX/features/StatExt.java @@ -43,7 +43,7 @@ public class StatExt{ ammoType = new Stat("ammo_type", StatCat.combat), ammoCapacity = new Stat("ammo_capacity", StatCat.combat); - public static String abilityFormat(String format, Object... values){ + private static String abilityFormat(String format, Object... values){ for(int i = 0; i < values.length; i++){ if(values[i] instanceof Number n) values[i] = "[stat]" + Strings.autoFixed(n.floatValue(), 1) + "[]";