package UnitInfo.core; import UnitInfo.ui.*; import arc.*; import arc.func.*; import arc.graphics.*; import arc.graphics.g2d.*; import arc.input.KeyCode; import arc.math.*; import arc.scene.*; import arc.scene.event.HandCursorListener; import arc.scene.style.*; import arc.scene.ui.*; import arc.scene.ui.layout.*; import arc.scene.utils.*; import arc.struct.*; import arc.util.*; import mindustry.*; import mindustry.ai.types.*; import mindustry.content.*; import mindustry.entities.abilities.*; import mindustry.entities.units.*; import mindustry.game.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.input.*; import mindustry.type.*; import mindustry.ui.*; import mindustry.world.*; import mindustry.world.blocks.defense.turrets.*; import mindustry.world.blocks.storage.*; import static arc.Core.*; import static mindustry.Vars.*; public class HudUi { Seq bars = new Seq<>(); Table weapon = new Table(); Table mainTable = new Table(); Table baseTable = new Table(); Table unitTable = new Table(); Table waveTable = new Table(); Table coreTable = new Table(); Table tileTable = new Table(); float waveScrollPos; float coreScrollPos; float tileScrollPos; @Nullable UnitType type; @Nullable Unit unit; Element image; Color lastItemColor = Pal.items; float heat; float heat2; float a; int uiIndex = 0; //to update wave, core table int maxwave; int coreamount; public Unit getUnit(){ Seq units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4); if(units.size <= 0) return player.unit(); Unit unit = units.peek(); if(unit == null) return player.unit(); else return unit; } public @Nullable Tile getTile(){ return Vars.world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY()); } public void setEvent(){ Events.run(EventType.Trigger.draw, () -> { if(!Core.settings.getBool("select")) return; Unit unit = getUnit(); 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.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(); } }); } public void addTable(){ mainTable = new Table(table -> { table.left(); Label label = new Label(""); label.setColor(Pal.stat); label.update(() -> { a = Mathf.lerpDelta(a, 0f, 0.025f); label.color.a = a; }); Label.LabelStyle style = new Label.LabelStyle(){{ font = Fonts.outline; fontColor = Color.white; background = Styles.black8; }}; label.setStyle(style); Table labelTable = new Table(t -> t.add(label).scaling(Scaling.fit).left().padRight(40 * 8f)); table.table(t -> { Seq