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.core.UI; import mindustry.ctype.UnlockableContent; 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; Element image; Color lastItemColor = Pal.items; Color lastAmmoColor = Pal.ammo; float heat; float heat2; float a; int uiIndex = 0; //to update wave, core table int maxwave; int coreamount; @SuppressWarnings("unchecked") public T getUnit(){ Seq units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4); if(units.size > 0) return (T) units.peek(); if(getTile() != null && getTile().build != null) return (T) getTile().build; else return (T) player.unit(); } public @Nullable Tile getTile(){ return Vars.world.tileWorld(Core.input.mouseWorldX(), Core.input.mouseWorldY()); } public void setEvent(){ Events.run(EventType.Trigger.draw, () -> { if(getUnit() == null || !Core.settings.getBool("select")) return; Posc entity = getUnit(); for(int i = 0; i < 4; i++){ float rot = i * 90f + 45f + (-Time.time) % 360f; float length = (entity instanceof Unit ? ((Unit)entity).hitSize : entity instanceof Building ? ((Building)entity).block.size * tilesize : 0) * 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", entity.x() + Angles.trnsx(rot, length), entity.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