update icon lol
|
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
|
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 243 B After Width: | Height: | Size: 243 B |
|
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 270 B |
|
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 284 B |
|
Before Width: | Height: | Size: 471 B After Width: | Height: | Size: 471 B |
|
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 385 B |
|
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 426 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 385 B |
BIN
assets/sprites/ui/icons/ammo.png
Normal file
|
After Width: | Height: | Size: 304 B |
BIN
assets/sprites/ui/icons/health.png
Normal file
|
After Width: | Height: | Size: 210 B |
BIN
assets/sprites/ui/icons/item.png
Normal file
|
After Width: | Height: | Size: 295 B |
BIN
assets/sprites/ui/icons/liquid.png
Normal file
|
After Width: | Height: | Size: 308 B |
BIN
assets/sprites/ui/icons/power.png
Normal file
|
After Width: | Height: | Size: 265 B |
BIN
assets/sprites/ui/icons/reload.png
Normal file
|
After Width: | Height: | Size: 330 B |
BIN
assets/sprites/ui/icons/shield.png
Normal file
|
After Width: | Height: | Size: 312 B |
@@ -4,6 +4,7 @@ import UnitInfo.core.*;
|
|||||||
import arc.Core;
|
import arc.Core;
|
||||||
import arc.files.*;
|
import arc.files.*;
|
||||||
import arc.graphics.g2d.TextureRegion;
|
import arc.graphics.g2d.TextureRegion;
|
||||||
|
import arc.math.geom.Rect;
|
||||||
import arc.scene.ui.TextButton;
|
import arc.scene.ui.TextButton;
|
||||||
import arc.scene.ui.layout.Scl;
|
import arc.scene.ui.layout.Scl;
|
||||||
import arc.scene.ui.layout.Table;
|
import arc.scene.ui.layout.Table;
|
||||||
@@ -15,12 +16,11 @@ import static arc.Core.settings;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class SVars {
|
public class SVars {
|
||||||
public static Fi modRoot = modDirectory.child("UnitInfo");
|
|
||||||
public static SettingS settingAdder = new SettingS();
|
public static SettingS settingAdder = new SettingS();
|
||||||
public static HudUi hud = new HudUi();
|
public static HudUi hud = new HudUi();
|
||||||
public static TextureRegion clear = atlas.find("clear");
|
|
||||||
public static TextureRegion error = atlas.find("error");
|
|
||||||
public static float modUiScale = settings.getInt("infoUiScale") / 100f == 0 ? 1 : settings.getInt("infoUiScale") / 100f;
|
public static float modUiScale = settings.getInt("infoUiScale") / 100f == 0 ? 1 : settings.getInt("infoUiScale") / 100f;
|
||||||
public static boolean pathLine = false, unitLine = false, logicLine = false;
|
public static boolean pathLine = false, unitLine = false, logicLine = false;
|
||||||
public static Seq<Tile> pathTiles = new Seq<>();
|
public static Seq<Tile> pathTiles = new Seq<>();
|
||||||
|
public static TextureRegion clear = atlas.find("clear");
|
||||||
|
public static TextureRegion error = atlas.find("error");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,19 @@ public class BarInfo {
|
|||||||
colors.set(1, Pal.shield);
|
colors.set(1, Pal.shield);
|
||||||
numbers.set(1, (max-force.buildup)/max);
|
numbers.set(1, (max-force.buildup)/max);
|
||||||
}
|
}
|
||||||
|
else if(target instanceof MendProjector.MendBuild mend){
|
||||||
|
strings.set(1, bundle.format("shar-stat.progress", floatFormat((float) mend.sense(LAccess.progress) * 100f)));
|
||||||
|
colors.set(1, Pal.heal);
|
||||||
|
numbers.set(1, (float) mend.sense(LAccess.progress));
|
||||||
|
}
|
||||||
|
else if(target instanceof OverdriveProjector.OverdriveBuild over){
|
||||||
|
Field ohno = OverdriveProjector.OverdriveBuild.class.getDeclaredField("charge");
|
||||||
|
ohno.setAccessible(true);
|
||||||
|
float charge = (float) ohno.get(over);
|
||||||
|
strings.set(1, bundle.format("shar-stat.progress", floatFormat(Mathf.clamp(charge/((OverdriveProjector)over.block).reload) * 100f)));
|
||||||
|
colors.set(1, Color.valueOf("feb380"));
|
||||||
|
numbers.set(1, Mathf.clamp(charge/((OverdriveProjector)over.block).reload));
|
||||||
|
}
|
||||||
else if(target instanceof ConstructBlock.ConstructBuild build){
|
else if(target instanceof ConstructBlock.ConstructBuild build){
|
||||||
strings.set(1, bundle.format("shar-stat.progress", floatFormat(build.progress * 100)));
|
strings.set(1, bundle.format("shar-stat.progress", floatFormat(build.progress * 100)));
|
||||||
colors.set(1, Pal.darkerMetal);
|
colors.set(1, Pal.darkerMetal);
|
||||||
@@ -107,19 +120,6 @@ public class BarInfo {
|
|||||||
colors.set(1, Pal.darkerMetal);
|
colors.set(1, Pal.darkerMetal);
|
||||||
numbers.set(1, reconstruct.fraction());
|
numbers.set(1, reconstruct.fraction());
|
||||||
}
|
}
|
||||||
else if(target instanceof MendProjector.MendBuild mend){
|
|
||||||
strings.set(1, bundle.format("shar-stat.progress", floatFormat((float) mend.sense(LAccess.progress) * 100f)));
|
|
||||||
colors.set(1, Pal.heal);
|
|
||||||
numbers.set(1, (float) mend.sense(LAccess.progress));
|
|
||||||
}
|
|
||||||
else if(target instanceof OverdriveProjector.OverdriveBuild over){
|
|
||||||
Field ohno = OverdriveProjector.OverdriveBuild.class.getDeclaredField("charge");
|
|
||||||
ohno.setAccessible(true);
|
|
||||||
float charge = (float) ohno.get(over);
|
|
||||||
strings.set(1, bundle.format("shar-stat.progress", floatFormat(Mathf.clamp(charge/((OverdriveProjector)over.block).reload) * 100f)));
|
|
||||||
colors.set(1, Color.valueOf("feb380"));
|
|
||||||
numbers.set(1, Mathf.clamp(charge/((OverdriveProjector)over.block).reload));
|
|
||||||
}
|
|
||||||
else if(target instanceof Drill.DrillBuild drill){
|
else if(target instanceof Drill.DrillBuild drill){
|
||||||
strings.set(1, bundle.format("shar-stat.progress", floatFormat((float) drill.sense(LAccess.progress) * 100f)));
|
strings.set(1, bundle.format("shar-stat.progress", floatFormat((float) drill.sense(LAccess.progress) * 100f)));
|
||||||
colors.set(1, drill.dominantItem == null ? Pal.items : drill.dominantItem.color);
|
colors.set(1, drill.dominantItem == null ? Pal.items : drill.dominantItem.color);
|
||||||
@@ -135,12 +135,12 @@ public class BarInfo {
|
|||||||
numbers.set(1, (float) crafter.sense(LAccess.progress));
|
numbers.set(1, (float) crafter.sense(LAccess.progress));
|
||||||
}
|
}
|
||||||
else if(target instanceof PowerNode.PowerNodeBuild node){
|
else if(target instanceof PowerNode.PowerNodeBuild node){
|
||||||
strings.set(1, bundle.format("bar.powerstored", floatFormat(node.power.graph.getLastPowerStored()), floatFormat(node.power.graph.getLastCapacity())));
|
strings.set(1, bundle.format("bar.power", floatFormat(node.power.graph.getLastPowerStored()), floatFormat(node.power.graph.getLastCapacity())));
|
||||||
colors.set(1, Pal.powerBar);
|
colors.set(1, Pal.powerBar);
|
||||||
numbers.set(1, node.power.graph.getLastPowerStored() / node.power.graph.getLastCapacity());
|
numbers.set(1, node.power.graph.getLastPowerStored() / node.power.graph.getLastCapacity());
|
||||||
}
|
}
|
||||||
else if(target instanceof PowerGenerator.GeneratorBuild generator){
|
else if(target instanceof PowerGenerator.GeneratorBuild generator){
|
||||||
strings.set(1, bundle.format("bar.poweroutput", floatFormat(generator.getPowerProduction() * generator.timeScale() * 60f)));
|
strings.set(1, bundle.format("bar.power", floatFormat(generator.getPowerProduction() * generator.timeScale() * 60f)));
|
||||||
colors.set(1, Pal.powerBar);
|
colors.set(1, Pal.powerBar);
|
||||||
numbers.set(1, generator.productionEfficiency);
|
numbers.set(1, generator.productionEfficiency);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package UnitInfo.core;
|
package UnitInfo.core;
|
||||||
|
|
||||||
|
import UnitInfo.SVars;
|
||||||
import UnitInfo.ui.*;
|
import UnitInfo.ui.*;
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
@@ -30,11 +31,22 @@ import mindustry.type.ammo.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
|
import mindustry.world.blocks.defense.ForceProjector;
|
||||||
|
import mindustry.world.blocks.defense.MendProjector;
|
||||||
|
import mindustry.world.blocks.defense.OverdriveProjector;
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
import mindustry.world.blocks.defense.turrets.*;
|
||||||
import mindustry.world.blocks.distribution.MassDriver;
|
import mindustry.world.blocks.distribution.MassDriver;
|
||||||
import mindustry.world.blocks.payloads.Payload;
|
import mindustry.world.blocks.payloads.Payload;
|
||||||
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
import mindustry.world.blocks.payloads.PayloadMassDriver;
|
||||||
|
import mindustry.world.blocks.power.PowerGenerator;
|
||||||
import mindustry.world.blocks.power.PowerNode;
|
import mindustry.world.blocks.power.PowerNode;
|
||||||
|
import mindustry.world.blocks.power.ThermalGenerator;
|
||||||
|
import mindustry.world.blocks.production.AttributeCrafter;
|
||||||
|
import mindustry.world.blocks.production.Drill;
|
||||||
|
import mindustry.world.blocks.production.GenericCrafter;
|
||||||
|
import mindustry.world.blocks.production.SolidPump;
|
||||||
|
import mindustry.world.blocks.units.Reconstructor;
|
||||||
|
import mindustry.world.blocks.units.UnitFactory;
|
||||||
|
|
||||||
import static UnitInfo.SVars.*;
|
import static UnitInfo.SVars.*;
|
||||||
import static arc.Core.*;
|
import static arc.Core.*;
|
||||||
@@ -76,6 +88,8 @@ public class HudUi {
|
|||||||
public Seq<PayloadMassDriver.PayloadDriverBuild> linkedPayloadMasses = new Seq<>();
|
public Seq<PayloadMassDriver.PayloadDriverBuild> linkedPayloadMasses = new Seq<>();
|
||||||
public Seq<Building> linkedNodes = new Seq<>();
|
public Seq<Building> linkedNodes = new Seq<>();
|
||||||
|
|
||||||
|
public final Rect scissor = new Rect();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Teamc> T getTarget(){
|
public <T extends Teamc> T getTarget(){
|
||||||
if(locked && lockedTarget != null) {
|
if(locked && lockedTarget != null) {
|
||||||
@@ -506,35 +520,79 @@ public class HudUi {
|
|||||||
ui.hudGroup.addChild(mainTable);
|
ui.hudGroup.addChild(mainTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBars(){
|
public TextureRegion getRegions(int i){
|
||||||
bars.clear();
|
Teamc target = getTarget();
|
||||||
lastColors.set(2, colors.get(2));
|
|
||||||
{
|
TextureRegion region = clear;
|
||||||
int i = 0;
|
if(i == 0){
|
||||||
bars.add(new SBar(
|
if(target instanceof Healthc) region = SIcons.health;
|
||||||
() -> strings.get(i),
|
} else if(i == 1){
|
||||||
() -> {
|
if(target instanceof Turret.TurretBuild ||
|
||||||
if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i));
|
target instanceof MassDriver.MassDriverBuild){
|
||||||
return lastColors.get(i);
|
region = SIcons.reload;
|
||||||
},
|
} else if((target instanceof Unit unit && unit.type != null) ||
|
||||||
() -> numbers.get(i)
|
target instanceof ForceProjector.ForceBuild){
|
||||||
));
|
region = SIcons.shield;
|
||||||
|
} else if(target instanceof MendProjector.MendBuild ||
|
||||||
|
target instanceof OverdriveProjector.OverdriveBuild ||
|
||||||
|
target instanceof ConstructBlock.ConstructBuild ||
|
||||||
|
target instanceof UnitFactory.UnitFactoryBuild ||
|
||||||
|
target instanceof Reconstructor.ReconstructorBuild ||
|
||||||
|
target instanceof Drill.DrillBuild ||
|
||||||
|
target instanceof GenericCrafter.GenericCrafterBuild){
|
||||||
|
//region = SIcons.progress;
|
||||||
|
} else if(target instanceof PowerNode.PowerNodeBuild ||
|
||||||
|
target instanceof PowerGenerator.GeneratorBuild){
|
||||||
|
region = SIcons.power;
|
||||||
}
|
}
|
||||||
{
|
} else if(i == 2){
|
||||||
int i = 1;
|
if(target instanceof ItemTurret.ItemTurretBuild){
|
||||||
bars.add(new SBar(
|
region = SIcons.ammo;
|
||||||
() -> strings.get(i),
|
} else if(target instanceof LiquidTurret.LiquidTurretBuild){
|
||||||
() -> {
|
region = SIcons.liquid;
|
||||||
if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i));
|
} else if(target instanceof PowerTurret.PowerTurretBuild ||
|
||||||
return lastColors.get(i);
|
target instanceof PowerNode.PowerNodeBuild){
|
||||||
},
|
region = SIcons.power;
|
||||||
() -> numbers.get(i)
|
} else if((target instanceof Building b && b.block.hasItems) ||
|
||||||
));
|
(target instanceof Unit unit && unit.type != null)){
|
||||||
|
region = SIcons.item;
|
||||||
}
|
}
|
||||||
bars.add(new Stack(){{
|
} else if(i == 3){
|
||||||
|
if(target instanceof Unit unit && unit.type != null ||
|
||||||
|
target instanceof UnitFactory.UnitFactoryBuild ||
|
||||||
|
target instanceof Reconstructor.ReconstructorBuild){
|
||||||
|
region = Icon.units.getRegion();
|
||||||
|
} else if(target instanceof AttributeCrafter.AttributeCrafterBuild ||
|
||||||
|
target instanceof SolidPump.SolidPumpBuild ||
|
||||||
|
target instanceof ThermalGenerator.ThermalGeneratorBuild){
|
||||||
|
//region = SIcons.attr;
|
||||||
|
} else if(target instanceof PowerNode.PowerNodeBuild){
|
||||||
|
region = SIcons.power;
|
||||||
|
} else if(target instanceof OverdriveProjector.OverdriveBuild){
|
||||||
|
//region = SIcons.boost;
|
||||||
|
}
|
||||||
|
} else if(i == 4){
|
||||||
|
if(target instanceof Unit unit && target instanceof Payloadc && unit.type != null){
|
||||||
|
|
||||||
|
} else if(target instanceof PowerNode.PowerNodeBuild){
|
||||||
|
region = SIcons.power;
|
||||||
|
} else if(target instanceof Building b && b.block.hasLiquids){
|
||||||
|
region = SIcons.liquid;
|
||||||
|
}
|
||||||
|
} else if(i == 5){
|
||||||
|
if(target instanceof Unit unit && state.rules.unitAmmo && unit.type != null){
|
||||||
|
region = SIcons.ammo;
|
||||||
|
}else if(target instanceof PowerNode.PowerNodeBuild ||
|
||||||
|
(target instanceof Building b && b.block.consumes.hasPower())){
|
||||||
|
region = SIcons.power;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
public Element addBar(int i){
|
||||||
|
return new Stack(){{
|
||||||
add(new Table(t -> {
|
add(new Table(t -> {
|
||||||
t.top().defaults().width(Scl.scl(modUiScale) * 23 * 8f).height(Scl.scl(modUiScale) * 4f * 8f);
|
|
||||||
int i = 2;
|
|
||||||
t.add(new SBar(
|
t.add(new SBar(
|
||||||
() -> BarInfo.strings.get(i),
|
() -> BarInfo.strings.get(i),
|
||||||
() -> {
|
() -> {
|
||||||
@@ -542,127 +600,51 @@ public class HudUi {
|
|||||||
return lastColors.get(i);
|
return lastColors.get(i);
|
||||||
},
|
},
|
||||||
() -> BarInfo.numbers.get(i)
|
() -> BarInfo.numbers.get(i)
|
||||||
)).growX().left();
|
)).width(Scl.scl(modUiScale) * 24 * 8f).height(Scl.scl(modUiScale) * 4 * 8f).growX().left();
|
||||||
}));
|
}));
|
||||||
add(new Table(){{
|
add(new Table(t -> {
|
||||||
left();
|
t.right();
|
||||||
update(() -> {
|
t.add(new Image(){
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
Element image = new Element();
|
|
||||||
if(getTarget() instanceof ItemTurret.ItemTurretBuild turret){
|
|
||||||
if(turret.hasAmmo()) image = new Image(((ItemTurret)turret.block).ammoTypes.findKey(turret.peekAmmo(), true).uiIcon);
|
|
||||||
else {MultiReqImage itemReq = new MultiReqImage();
|
|
||||||
for(Item item : ((ItemTurret) turret.block).ammoTypes.keys())
|
|
||||||
itemReq.add(new ReqImage(item.uiIcon, turret::hasAmmo));
|
|
||||||
image = itemReq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(getTarget() instanceof LiquidTurret.LiquidTurretBuild turret){
|
|
||||||
MultiReqImage liquidReq = new MultiReqImage();
|
|
||||||
for(Liquid liquid : ((LiquidTurret) turret.block).ammoTypes.keys())
|
|
||||||
liquidReq.add(new ReqImage(liquid.uiIcon, turret::hasAmmo));
|
|
||||||
image = liquidReq;
|
|
||||||
|
|
||||||
if(((LiquidTurret.LiquidTurretBuild) getTarget()).hasAmmo())
|
|
||||||
image = new Image(turret.liquids.current().uiIcon).setScaling(Scaling.fit);
|
|
||||||
}
|
|
||||||
else if(getTarget() instanceof PowerTurret.PowerTurretBuild){
|
|
||||||
image = new Image(Icon.power.getRegion()){
|
|
||||||
@Override
|
@Override
|
||||||
public void draw() {
|
public void draw() {
|
||||||
Building entity = getTarget();
|
validate();
|
||||||
float max = entity.block.consumes.getPower().usage;
|
|
||||||
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
|
|
||||||
|
|
||||||
super.draw();
|
float x = this.x;
|
||||||
Lines.stroke(Scl.scl(modUiScale) * 2f, Pal.removeBack);
|
float y = this.y;
|
||||||
Draw.alpha(1 - v/max);
|
float scaleX = this.scaleX;
|
||||||
Lines.line(x, y - 2f + height, x + width, y - 2f);
|
float scaleY = this.scaleY;
|
||||||
Draw.color(Pal.remove);
|
Draw.color(Color.white);
|
||||||
Draw.alpha(1 - v/max);
|
Draw.alpha(parentAlpha * color.a);
|
||||||
Lines.line(x, y + height, x + width, y);
|
|
||||||
|
TextureRegionDrawable region = new TextureRegionDrawable(getRegions(i));
|
||||||
|
float rotation = getRotation();
|
||||||
|
if(scaleX != 1 || scaleY != 1 || rotation != 0){
|
||||||
|
region.draw(x + imageX, y + imageY, originX - imageX, originY - imageY,
|
||||||
|
imageWidth, imageHeight, scaleX, scaleY, rotation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
region.draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
|
||||||
|
|
||||||
|
Draw.color(colors.get(i));
|
||||||
|
if(ScissorStack.push(scissor.set(x, y, imageWidth * scaleX, imageHeight * scaleY * numbers.get(i)))){
|
||||||
|
region.draw(x, y, imageWidth * scaleX, imageHeight * scaleY);
|
||||||
|
ScissorStack.pop();
|
||||||
|
}
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
};
|
}).size(iconMed * Scl.scl(modUiScale)).padRight(Scl.scl(modUiScale) * 8f);
|
||||||
}
|
|
||||||
clearChildren();
|
|
||||||
add(image).size(iconSmall * Scl.scl(modUiScale)).padBottom(2 * 8f).padRight(3 * 8f);
|
|
||||||
});
|
|
||||||
pack();
|
|
||||||
}});
|
|
||||||
add(new Table(t -> {
|
|
||||||
t.left();
|
|
||||||
t.add(new Image(){{
|
|
||||||
update(() -> {
|
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
if(getTarget() instanceof Unit u && u.stack.item != null && u.stack.amount > 0)
|
|
||||||
setDrawable(u.stack.item.uiIcon);
|
|
||||||
else setDrawable(clear);
|
|
||||||
});
|
|
||||||
visibility = () -> getTarget() instanceof Unit;
|
|
||||||
}}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 30f).padBottom(Scl.scl(modUiScale) * 4 * 8f).padRight(Scl.scl(modUiScale) * 6 * 8f);
|
|
||||||
t.pack();
|
|
||||||
}));
|
}));
|
||||||
}});
|
}};
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
public void addBars(){
|
||||||
|
bars.clear();
|
||||||
|
|
||||||
|
bars.add(addBar(0));
|
||||||
{
|
bars.add(addBar(1));
|
||||||
int i = 4;
|
bars.add(addBar(2));
|
||||||
bars.add(new SBar(
|
bars.add(addBar(3));
|
||||||
() -> strings.get(i),
|
bars.add(addBar(4));
|
||||||
() -> {
|
bars.add(addBar(5));
|
||||||
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(modUiScale) * 23 * 8f).height(Scl.scl(modUiScale) * 4 * 8f);
|
|
||||||
|
|
||||||
int i = 5;
|
|
||||||
t.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)
|
|
||||||
)).growX().left();
|
|
||||||
}));
|
|
||||||
add(new Table(t -> {
|
|
||||||
t.left();
|
|
||||||
t.add(new Image(){{
|
|
||||||
update(() -> {
|
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
TextureRegion region = clear;
|
|
||||||
|
|
||||||
if(Vars.state.rules.unitAmmo && getTarget() instanceof Unit u && u.type != null){
|
|
||||||
UnitType type = u.type;
|
|
||||||
if(type.ammoType instanceof ItemAmmoType ammo) region = ammo.item.uiIcon;
|
|
||||||
else if(type.ammoType instanceof PowerAmmoType) region = Icon.powerSmall.getRegion();
|
|
||||||
}
|
|
||||||
setDrawable(region);
|
|
||||||
});
|
|
||||||
}}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 30f).padBottom(Scl.scl(modUiScale) * 4 * 8f).padRight(Scl.scl(modUiScale) * 6 * 8f);
|
|
||||||
t.pack();
|
|
||||||
}));
|
|
||||||
}});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWeaponTable(Table table){
|
public void addWeaponTable(Table table){
|
||||||
@@ -775,7 +757,7 @@ public class HudUi {
|
|||||||
for(StatusEffect effect : content.statusEffects()){
|
for(StatusEffect effect : content.statusEffects()){
|
||||||
if(applied.get(effect.id) && !effect.isHidden()){
|
if(applied.get(effect.id) && !effect.isHidden()){
|
||||||
t.image(effect.uiIcon).size(iconSmall).get().addListener(new Tooltip(l -> l.label(() ->
|
t.image(effect.uiIcon).size(iconSmall).get().addListener(new Tooltip(l -> l.label(() ->
|
||||||
effect.localizedName + " [lightgray]" + UI.formatTime(st.getDuration(effect))).style(Styles.outlineLabel)){{allowMobile = true;}});
|
effect.localizedName + " [lightgray]" + UI.formatTime(st.getDuration(effect))).style(Styles.outlineLabel)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statuses.set(applied);
|
statuses.set(applied);
|
||||||
@@ -894,7 +876,7 @@ public class HudUi {
|
|||||||
});
|
});
|
||||||
t.row();
|
t.row();
|
||||||
t.table(tt -> {
|
t.table(tt -> {
|
||||||
tt.defaults().height(Scl.scl(modUiScale) * 4f * 8f).pad(0,4,0,4).top();
|
tt.defaults().width(Scl.scl(modUiScale) * 30f * 8f).height(Scl.scl(modUiScale) * 4f * 8f).pad(0,4,0,4).top();
|
||||||
for(Element bar : bars){
|
for(Element bar : bars){
|
||||||
bar.setScale(Scl.scl(modUiScale));
|
bar.setScale(Scl.scl(modUiScale));
|
||||||
tt.add(bar).growX().left();
|
tt.add(bar).growX().left();
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import UnitInfo.ui.*;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.input.KeyCode;
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.scene.ui.layout.*;
|
import arc.scene.ui.layout.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
@@ -12,10 +11,7 @@ import mindustry.*;
|
|||||||
import mindustry.ai.Pathfinder;
|
import mindustry.ai.Pathfinder;
|
||||||
import mindustry.ai.types.*;
|
import mindustry.ai.types.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.core.Logic;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.entities.units.AIController;
|
|
||||||
import mindustry.entities.units.UnitCommand;
|
|
||||||
import mindustry.entities.units.UnitController;
|
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class SettingS {
|
|||||||
t.add(new Label(title + ": ")).left().padRight(5)
|
t.add(new Label(title + ": ")).left().padRight(5)
|
||||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||||
|
|
||||||
t.field(value[0] + str[0], s -> {
|
t.field((integer ? String.valueOf(value[0]).split("[.]")[0] : value[0]) + str[0], s -> {
|
||||||
value[0] = Strings.parseFloat(s);
|
value[0] = Strings.parseFloat(s);
|
||||||
str[0] = h.get(s);
|
str[0] = h.get(s);
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ public class CoresItemsDisplay {
|
|||||||
t.clear();
|
t.clear();
|
||||||
|
|
||||||
t.update(() -> {
|
t.update(() -> {
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
core = team.core();
|
core = team.core();
|
||||||
heat += Time.delta;
|
heat += Time.delta;
|
||||||
|
|
||||||
@@ -109,7 +108,6 @@ public class CoresItemsDisplay {
|
|||||||
HandCursorListener listener1 = new HandCursorListener();
|
HandCursorListener listener1 = new HandCursorListener();
|
||||||
image.addListener(listener1);
|
image.addListener(listener1);
|
||||||
image.update(() -> {
|
image.update(() -> {
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta));
|
image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -136,7 +134,6 @@ public class CoresItemsDisplay {
|
|||||||
});
|
});
|
||||||
t.row();
|
t.row();
|
||||||
t.table().update(itemTable -> {
|
t.table().update(itemTable -> {
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
itemTable.clear();
|
itemTable.clear();
|
||||||
final int[] i = {0};
|
final int[] i = {0};
|
||||||
for(Item item : content.items()){
|
for(Item item : content.items()){
|
||||||
@@ -165,7 +162,6 @@ public class CoresItemsDisplay {
|
|||||||
});
|
});
|
||||||
t.row();
|
t.row();
|
||||||
t.table().update(unitTable -> {
|
t.table().update(unitTable -> {
|
||||||
if(!Core.settings.getBool("infoui")) return;
|
|
||||||
unitTable.clear();
|
unitTable.clear();
|
||||||
final int[] i = {0};
|
final int[] i = {0};
|
||||||
for(UnitType unit : content.units()){
|
for(UnitType unit : content.units()){
|
||||||
|
|||||||
14
src/UnitInfo/ui/SIcons.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package UnitInfo.ui;
|
||||||
|
|
||||||
|
import arc.Core;
|
||||||
|
import arc.graphics.g2d.TextureRegion;
|
||||||
|
|
||||||
|
public class SIcons {
|
||||||
|
public static TextureRegion health = Core.atlas.find("unitinfo-health");
|
||||||
|
public static TextureRegion shield = Core.atlas.find("unitinfo-shield");
|
||||||
|
public static TextureRegion item = Core.atlas.find("unitinfo-item");
|
||||||
|
public static TextureRegion liquid = Core.atlas.find("unitinfo-liquid");
|
||||||
|
public static TextureRegion power = Core.atlas.find("unitinfo-power");
|
||||||
|
public static TextureRegion ammo = Core.atlas.find("unitinfo-ammo");
|
||||||
|
public static TextureRegion reload = Core.atlas.find("unitinfo-reload");
|
||||||
|
}
|
||||||