diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index 26b1878..ddce691 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -13,7 +13,7 @@ shar-stat.charge = Charge: {0}% shar-stat.itemAmmo = Ammo: {0} / {1} shar-stat.liquidAmmo = Liquid: {0} shar-stat.power = Power: {0} / {1} -shar-stat.progress = Construct: {0}% +shar-stat.progress = Progress: {0}% shar-stat-waveAmount = [lightgray]Amount:[] {0} shar-stat-waveShield = [lightgray]Shield:[] {0} shar-stat.waveStatus = [lightgray]Status:[] diff --git a/assets/bundles/bundle_ko.properties b/assets/bundles/bundle_ko.properties index 5966247..704a465 100644 --- a/assets/bundles/bundle_ko.properties +++ b/assets/bundles/bundle_ko.properties @@ -13,7 +13,7 @@ shar-stat.charge = 충전: {0}% shar-stat.itemAmmo = 탄약 : {0} / {1} shar-stat.liquidAmmo = 액체: {0} shar-stat.power = 전력: {0} / {1} -shar-stat.progress = 건설: {0}% +shar-stat.progress = 진행도: {0}% shar-stat-waveAmount = [lightgray]유닛 수:[] {0} shar-stat-waveShield = [lightgray]방어막:[] {0} shar-stat.waveStatus = [lightgray]상태이상:[] diff --git a/src/UnitInfo/core/BarInfo.java b/src/UnitInfo/core/BarInfo.java index 0a80abc..c6a394f 100644 --- a/src/UnitInfo/core/BarInfo.java +++ b/src/UnitInfo/core/BarInfo.java @@ -10,13 +10,17 @@ import arc.util.Time; import mindustry.ai.types.FormationAI; import mindustry.core.UI; import mindustry.ctype.UnlockableContent; +import mindustry.entities.Units; import mindustry.entities.abilities.ForceFieldAbility; import mindustry.entities.abilities.ShieldRegenFieldAbility; import mindustry.gen.*; import mindustry.graphics.Pal; +import mindustry.ui.Fonts; import mindustry.world.blocks.ConstructBlock; import mindustry.world.blocks.defense.turrets.*; import mindustry.world.blocks.storage.*; +import mindustry.world.blocks.units.Reconstructor; +import mindustry.world.blocks.units.UnitFactory; import mindustry.world.consumers.ConsumePower; @@ -77,7 +81,18 @@ public class BarInfo { colors.set(1, Pal.darkerMetal); numbers.set(1, construct.progress); } - + else if(target instanceof UnitFactory.UnitFactoryBuild){ + UnitFactory.UnitFactoryBuild factory = (UnitFactory.UnitFactoryBuild) target; + strings.set(1, Core.bundle.format("shar-stat.progress", Strings.fixed(factory.fraction() * 100f, 1))); + colors.set(1, Pal.darkerMetal); + numbers.set(1, factory.fraction()); + } + else if(target instanceof Reconstructor.ReconstructorBuild){ + Reconstructor.ReconstructorBuild reconstruct = (Reconstructor.ReconstructorBuild) target; + strings.set(1, Core.bundle.format("shar-stat.progress", Strings.fixed(reconstruct.fraction() * 100, 1))); + colors.set(1, Pal.darkerMetal); + numbers.set(1, reconstruct.fraction()); + } if(target instanceof ItemTurret.ItemTurretBuild) { ItemTurret.ItemTurretBuild turretBuild = (ItemTurret.ItemTurretBuild) target; @@ -123,7 +138,7 @@ public class BarInfo { } else if(target instanceof Unit && ((Unit)target).type() != null) { strings.set(2, bundle.format("shar-stat.itemCapacity", UI.formatAmount(((Unit)target).stack().amount), UI.formatAmount(((Unit)target).type().itemCapacity))); - colors.set(2, ((Unit)target).stack().item.color.cpy().lerp(Color.white, 0.15f)); + if(((Unit)target).stack().amount > 0 && ((Unit)target).stack().item != null) colors.set(2, ((Unit)target).stack().item.color.cpy().lerp(Color.white, 0.15f)); numbers.set(2, ((Unit)target).stack().amount / (((Unit)target).type().itemCapacity * 1f)); } @@ -142,7 +157,13 @@ public class BarInfo { colors.set(3, Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target) / (((Unit)target).type().commandLimit * 1f))), 1f))); numbers.set(3, Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target) / (((Unit)target).type().commandLimit * 1f)); } - + else if(target instanceof UnitFactory.UnitFactoryBuild){ + UnitFactory.UnitFactoryBuild factory = (UnitFactory.UnitFactoryBuild) target; + strings.set(3, factory.unit() == null ? "[lightgray]" + Iconc.cancel : + Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(factory.unit().name), factory.team.data().countType(factory.unit()), Units.getCap(factory.team))); + colors.set(3, Pal.power); + numbers.set(3, factory.unit() == null ? 0f : (float)factory.team.data().countType(factory.unit()) / Units.getCap(factory.team)); + } if(target instanceof Unit && target instanceof Payloadc && ((Unit) target).type != null){ strings.set(4, Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)target).payloadUsed())), Mathf.round(Mathf.sqrt(((Unit)target).type().payloadCapacity)))); diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index d5a15a5..152cb85 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -7,7 +7,6 @@ import arc.graphics.g2d.*; import arc.input.KeyCode; import arc.math.*; import arc.math.geom.Geometry; -import arc.math.geom.Vec2; import arc.scene.*; import arc.scene.event.HandCursorListener; import arc.scene.style.*; @@ -18,7 +17,6 @@ import arc.struct.*; import arc.util.*; import mindustry.*; import mindustry.content.*; -import mindustry.entities.Predict; import mindustry.entities.Units; import mindustry.entities.units.*; import mindustry.game.*; @@ -52,8 +50,6 @@ public class HudUi { float tileScrollPos; float itemScrollPos; - Color lastItemColor = Pal.items; - Color lastAmmoColor = Pal.ammo; Teamc lockedTarget; ImageButton lockButton; boolean locked = false; @@ -69,7 +65,7 @@ public class HudUi { Seq strings = new Seq<>(new String[]{"","","","","",""}); Seq numbers = new Seq<>(new Float[]{0f,0f,0f,0f,0f,0f}); Seq colors = new Seq<>(new Color[]{Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear}); - + Seq lastColors = new Seq<>(new Color[]{Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear}); CoresItemsDisplay coreItems = new CoresItemsDisplay(Team.baseTeams); @@ -229,23 +225,40 @@ public class HudUi { public void addBars(){ bars.clear(); - bars.add(new SBar( - () -> strings.get(0), - () -> colors.get(0), - () -> numbers.get(0) - )); - bars.add(new SBar( - () -> strings.get(1), - () -> colors.get(1), - () -> numbers.get(1) - )); + lastColors.set(2, colors.get(2)); + { + int i = 0; + bars.add(new SBar( + () -> strings.get(i), + () -> { + if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i)); + return lastColors.get(i); + }, + () -> numbers.get(i) + )); + } + { + int i = 1; + bars.add(new SBar( + () -> strings.get(i), + () -> { + if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i)); + return lastColors.get(i); + }, + () -> numbers.get(i) + )); + } bars.add(new Stack(){{ add(new Table(t -> { t.top().defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f)); + int i = 2; t.add(new SBar( - () -> strings.get(2), - () -> lastItemColor = colors.get(2), - () -> numbers.get(2) + () -> strings.get(i), + () -> { + if(colors.get(i) != Color.clear) lastColors.set(i, colors.get(i)); + return lastColors.get(i); + }, + () -> numbers.get(i) )).growX().left(); })); add(new Table(){{ @@ -316,26 +329,44 @@ public class HudUi { })); }}); - bars.add(new SBar( - () -> strings.get(3), - () -> colors.get(3), - () -> numbers.get(3) - )); - bars.add(new SBar( - () -> strings.get(4), - () -> colors.get(4), - () -> numbers.get(4) - )); + { + int i = 3; + bars.add(new SBar( + () -> strings.get(i), + () -> { + if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i)); + return lastColors.get(i); + }, + () -> numbers.get(i) + )); + } + + + { + int i = 4; + bars.add(new SBar( + () -> strings.get(i), + () -> { + if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i)); + return lastColors.get(i); + }, + () -> numbers.get(i) + )); + } bars.add(new Stack(){{ add(new Table(t -> { t.top().defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f)); + int i = 5; t.add(new SBar( - () -> strings.get(5), - () -> lastAmmoColor = colors.get(5), - () -> numbers.get(5) + () -> strings.get(i), + () -> { + if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i)); + return lastColors.get(i); + }, + () -> numbers.get(i) )).growX().left(); })); add(new Table(t -> { diff --git a/src/UnitInfo/core/Main.java b/src/UnitInfo/core/Main.java index 3a749b0..2bb144c 100644 --- a/src/UnitInfo/core/Main.java +++ b/src/UnitInfo/core/Main.java @@ -3,7 +3,6 @@ package UnitInfo.core; import UnitInfo.ui.FreeBar; import arc.Core; import arc.Events; -import arc.files.Fi; import arc.graphics.Color; import arc.graphics.g2d.Draw; import arc.graphics.g2d.Fill;