From cbc7003f8f5eccd81a9310892c995a34daa58776 Mon Sep 17 00:00:00 2001 From: Sharlotte Date: Fri, 16 Jul 2021 14:28:11 +0900 Subject: [PATCH] h --- README.md | 4 +-- assets/bundles/bundle_ko.properties | 2 +- src/UnitInfo/core/HudUi.java | 11 +++++--- src/UnitInfo/core/Main.java | 42 ++++++++++++++--------------- src/UnitInfo/ui/SBar.java | 18 +------------ 5 files changed, 31 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index db67d8c..f4cda44 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,8 @@ displays on left side, you can change status display by button. ### Unit Status shows unit name, armor, health, shield, items, commanded units, weapons, ammo and payload amount as possible as. -- [ ] shrink size +- [x] shrink size - [x] remove command part - - [ ] add scroll on weapon part ### Wave Status shows unit amount for each waves. modifiable showed max wave on graphic setting. @@ -41,7 +40,6 @@ shows every blocks' status(even enemy), some info bars. (suggestion by @nichrosi ### rendered unit info shows every units' hp, ammo, shield by bar under each unit. -- [ ] show more detail info as number ## Setting can toggle display on/off ingame, set some ui opacity etc. diff --git a/assets/bundles/bundle_ko.properties b/assets/bundles/bundle_ko.properties index e2ed4d8..263c8f3 100644 --- a/assets/bundles/bundle_ko.properties +++ b/assets/bundles/bundle_ko.properties @@ -10,7 +10,7 @@ shar-stat.charge = 충전: {0}% shar-stat.itemAmmo = 탄약 : {0} / {1} shar-stat.liquidAmmo = 액체: {0} shar-stat.power = 전력: {0} / {1} -shar-stat-waveAmount = [lightgray]수량:[] {0} +shar-stat-waveAmount = [lightgray]유닛 수:[] {0} shar-stat-waveShield = [lightgray]방어막:[] {0} shar-stat.waveStatus = [lightgray]상태이상:[] shar-stat.waveItem = [lightgray]아이템:[] diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index c9c67db..e3101b1 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -8,6 +8,7 @@ import arc.graphics.g2d.*; import arc.input.KeyCode; import arc.math.*; import arc.scene.*; +import arc.scene.event.ClickListener; import arc.scene.event.HandCursorListener; import arc.scene.style.*; import arc.scene.ui.*; @@ -28,7 +29,9 @@ import mindustry.type.*; import mindustry.ui.*; import mindustry.world.*; import mindustry.world.blocks.defense.turrets.*; +import mindustry.world.blocks.power.*; import mindustry.world.blocks.storage.*; +import mindustry.world.consumers.*; import static arc.Core.*; import static mindustry.Vars.*; @@ -70,7 +73,7 @@ public class HudUi { public @Nullable Tile getTile(){ return Vars.world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY()); - } + }; public void setEvent(){ Events.run(EventType.Trigger.draw, () -> { @@ -80,7 +83,7 @@ public class HudUi { for(int i = 0; i < 4; i++){ float rot = i * 90f + 45f + (-Time.time) % 360f; float length = unit.hitSize * 1.5f + 2.5f; - Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("selectopacity") / 100f)); + Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)).a(settings.getInt("uiopacity") / 100f)); Draw.rect("select-arrow", unit.x + Angles.trnsx(rot, length), unit.y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f); Draw.reset(); } @@ -411,7 +414,9 @@ public class HudUi { t.left(); t.add(new Image(){{ - update(() -> setDrawable(getUnit().stack.item == null || getUnit().stack.amount <= 0 ? Core.atlas.find("clear") : getUnit().stack.item.uiIcon)); + update(() -> { + setDrawable(getUnit().stack.item == null || getUnit().stack.amount <= 0 ? Core.atlas.find("clear") : getUnit().stack.item.uiIcon); + }); } @Override diff --git a/src/UnitInfo/core/Main.java b/src/UnitInfo/core/Main.java index c9ad6e1..ac49a14 100644 --- a/src/UnitInfo/core/Main.java +++ b/src/UnitInfo/core/Main.java @@ -62,51 +62,49 @@ public class Main extends Mod { if(Core.settings.getBool("scan")){ float range = settings.getInt("rangemax") * 8f; - for(Team team : Team.all) { + for(Team team : Team.all) indexer.eachBlock(team, Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, b -> true, b -> new FreeBar().draw(b)); - } - Draw.color(Tmp.c1.set(Pal.accent).a(0.75f + Mathf.absin(3, 0.25f))); - Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, Time.time % 360); - Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 90 + Time.time % 360); - Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 180 + Time.time % 360); - Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 270 + Time.time % 360); + + Draw.color(Tmp.c1.set(Pal.accent).a(0.75f + Mathf.absin(3, 0.25f))); + Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, Time.time % 360); + Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 90 + Time.time % 360); + Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 180 + Time.time % 360); + Lines.swirl(Core.input.mouseWorldX(), Core.input.mouseWorldY(), range, 0.15f, 270 + Time.time % 360); Draw.reset(); } - if(!mobile && !Vars.state.isPaused() && settings.getBool("gaycursor")){ + if(!mobile && !Vars.state.isPaused() && settings.getBool("gaycursor")) Fx.mine.at(Core.input.mouseWorldX(), Core.input.mouseWorldY(), Tmp.c2.set(Color.red).shiftHue(Time.time * 1.5f)); - } + Groups.unit.each(unit -> { Draw.color(); Tmp.c1.set(Color.white).lerp(Pal.heal, Mathf.clamp(unit.healTime - unit.hitTime)); Draw.mixcol(Tmp.c1, Math.max(unit.hitTime, Mathf.clamp(unit.healTime))); - - if(unit.drownTime > 0 && unit.floorOn().isDeep()){ + if(unit.drownTime > 0 && unit.floorOn().isDeep()) Draw.mixcol(unit.floorOn().mapColor, unit.drownTime * 0.8f); - } + //draw back items if(unit.item() != null && unit.itemTime > 0.01f){ float size = (itemSize + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime; Draw.mixcol(Pal.accent, Mathf.absin(Time.time, 5f, 0.1f)); Draw.rect(unit.item().fullIcon, - unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY), - unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY), - size, size, unit.rotation); + unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY), + unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY), + size, size, unit.rotation); Draw.mixcol(); Lines.stroke(1f, Pal.accent); Lines.circle( - unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY), - unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY), - (3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime); + unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY), + unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY), + (3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime); if(!renderer.pixelator.enabled()){ Fonts.outline.draw(unit.stack.amount + "", - unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY), - unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY) - 3, - Pal.accent, 0.25f * unit.itemTime / Scl.scl(1f), false, Align.center - ); + unit.x + Angles.trnsx(unit.rotation + 180f, unit.type.itemOffsetY), + unit.y + Angles.trnsy(unit.rotation + 180f, unit.type.itemOffsetY) - 3, + Pal.accent, 0.25f * unit.itemTime / Scl.scl(1f), false, Align.center); } Draw.reset(); diff --git a/src/UnitInfo/ui/SBar.java b/src/UnitInfo/ui/SBar.java index dced214..5c4a3f2 100644 --- a/src/UnitInfo/ui/SBar.java +++ b/src/UnitInfo/ui/SBar.java @@ -67,23 +67,6 @@ public class SBar extends Element{ }); } - public void reset(float value){ - this.value = lastValue = blink = value; - } - - public void set(Prov name, Floatp fraction, Color color){ - this.fraction = fraction; - this.lastValue = fraction.get(); - this.blinkColor.set(color); - setColor(color); - update(() -> this.name = name.get()); - } - - public SBar blink(Color color){ - blinkColor.set(color); - return this; - } - public Drawable drawable(String name, int left, int right, int top, int bottom){ Drawable out; @@ -165,5 +148,6 @@ public class SBar extends Element{ font.getData().setScale(Scl.scl()); Pools.free(lay); + Draw.reset(); } }