From 259db4a1b332999417eb6f921d9eb288034b0326 Mon Sep 17 00:00:00 2001 From: sharlotte Date: Sun, 12 Sep 2021 13:51:26 +0900 Subject: [PATCH] h --- assets/bundles/bundle.properties | 4 ++-- assets/bundles/bundle_ko.properties | 4 ++-- src/UnitInfo/core/HudUi.java | 2 +- src/UnitInfo/core/OverDrawer.java | 31 ++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index 730f947..0b238ae 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -51,8 +51,8 @@ setting.baropacity.name = Health Bar Opacity setting.baropacity.description = set opacity of unit bar. setting.uiopacity.name = UI Background Opacity setting.uiopacity.description = set opacity of ui background. -setting.softRangeOpacity.name = Soft Range Opacity -setting.softRangeOpacity.description = set opacity of soft range. +setting.softRangeOpacity.name = Range Opacity +setting.softRangeOpacity.description = set opacity of range circle. setting.pathlinelimit.name = PathLines limit setting.pathlinelimit.description = many lines may cause significant device lag.\nIt must be adjusted to the device environment. diff --git a/assets/bundles/bundle_ko.properties b/assets/bundles/bundle_ko.properties index dff0215..c3b20fd 100644 --- a/assets/bundles/bundle_ko.properties +++ b/assets/bundles/bundle_ko.properties @@ -50,8 +50,8 @@ setting.baropacity.name = 유닛 바 투명도 setting.baropacity.description = 유닛 바의 투명도를 조절합니다. setting.uiopacity.name = UI 배경 투명도 setting.uiopacity.description = UI 배경 투명도를 조절합니다. -setting.softRangeOpacity.name = 부드러운 사거리 투명도 -setting.softRangeOpacity.description = 부드러운 사거리 투명도를 조절합니다. +setting.softRangeOpacity.name = 포탑 사거리 투명도 +setting.softRangeOpacity.description = 포탑 사거리의 투명도를 조절합니다. setting.pathlinelimit.name = 단계 경로선 제한 setting.pathlinelimit.description = 다수의 선들은 기기 부하를 크게 일으킵니다.\n기기 환경에 맞추어 조절해야 합니다. diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index 25c5a4d..dd6a9ee 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -620,7 +620,7 @@ public class HudUi { if(getTarget() instanceof ConstructBlock.ConstructBuild cb) name = cb.current.localizedName; else name = b.block.localizedName; } - return "[accent]" + (name.length() > 10 ? name.substring(0, 10) + "..." : name) + "[]"; + return "[accent]" + (name.length() > 13 ? name.substring(0, 13) + "..." : name) + "[]"; }); label.setFontScale(Scl.scl(modUiScale) * 0.75f); diff --git a/src/UnitInfo/core/OverDrawer.java b/src/UnitInfo/core/OverDrawer.java index e17958f..18e2583 100644 --- a/src/UnitInfo/core/OverDrawer.java +++ b/src/UnitInfo/core/OverDrawer.java @@ -22,15 +22,19 @@ import mindustry.logic.LUnitControl; import mindustry.ui.Fonts; import mindustry.world.Block; import mindustry.world.Tile; +import mindustry.world.blocks.defense.ForceProjector; import mindustry.world.blocks.defense.turrets.*; import mindustry.world.blocks.distribution.MassDriver; import mindustry.world.blocks.payloads.PayloadMassDriver; import mindustry.world.blocks.power.PowerNode; import mindustry.world.blocks.storage.CoreBlock; import mindustry.world.blocks.units.CommandCenter; +import mindustry.world.blocks.units.Reconstructor; +import mindustry.world.blocks.units.UnitFactory; import java.util.Objects; +import static UnitInfo.SUtils.floatFormat; import static UnitInfo.SVars.*; import static arc.Core.*; import static mindustry.Vars.*; @@ -126,7 +130,32 @@ public class OverDrawer { if(Core.settings.getBool("unithealthui")) { Groups.unit.each(FreeBar::draw); indexer.eachBlock(null, camera.position.x, camera.position.y, 400, b -> true, b -> { - Fonts.outline.draw((int)b.health + " / " + (int)b.maxHealth, + + if(b instanceof ForceProjector.ForceBuild force) { + ForceProjector forceBlock = (ForceProjector) force.block; + float max = forceBlock.shieldHealth + forceBlock.phaseShieldBoost * force.phaseHeat; + + Fonts.outline.draw((int)b.health + " / " + (int)b.maxHealth, + b.x, b.y - b.block.size * 8 * 0.25f - 2, + Tmp.c1.set(Pal.items).lerp(Pal.health, 1-b.healthf()), (b.block.size == 1 ? 0.3f : 0.25f) * 0.25f * b.block.size, false, Align.center); + Fonts.outline.draw((int)(max-force.buildup) + " / " + (int)max, + b.x, b.y - b.block.size * 8 * 0.25f + 2, + Tmp.c1.set(Pal.shield).lerp(Pal.gray, 1-((max-force.buildup) / max)), (b.block.size == 1 ? 0.3f : 0.25f) * 0.25f * b.block.size, false, Align.center); + } + else if(b instanceof ReloadTurret.ReloadTurretBuild || b instanceof UnitFactory.UnitFactoryBuild || b instanceof Reconstructor.ReconstructorBuild) { + float progress = 0f; + if(b instanceof ReloadTurret.ReloadTurretBuild turret) progress = turret.reload / ((ReloadTurret)turret.block).reloadTime * 100; + if(b instanceof UnitFactory.UnitFactoryBuild factory) progress = factory.fraction() * 100; + if(b instanceof Reconstructor.ReconstructorBuild reconstructor) progress = reconstructor.fraction() * 100; + + Fonts.outline.draw((int)b.health + " / " + (int)b.maxHealth, + b.x, b.y - b.block.size * 8 * 0.25f - 2, + Tmp.c1.set(Pal.items).lerp(Pal.health, 1-b.healthf()), (b.block.size == 1 ? 0.3f : 0.25f) * 0.25f * b.block.size, false, Align.center); + Fonts.outline.draw((int)progress + "%", + b.x, b.y - b.block.size * 8 * 0.25f + 2, + Tmp.c1.set(Color.lightGray).lerp(Pal.accent, progress/100), (b.block.size == 1 ? 0.3f : 0.25f) * 0.25f * b.block.size, false, Align.center); + } + else Fonts.outline.draw((int)b.health + " / " + (int)b.maxHealth, b.x, b.y - b.block.size * 8 * 0.25f, Tmp.c1.set(Pal.items).lerp(Pal.health, 1-b.healthf()), (b.block.size == 1 ? 0.3f : 0.25f) * 0.25f * b.block.size, false, Align.center); });