mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 03:59:26 +02:00
clean up, fixed color bar
This commit is contained in:
@@ -13,7 +13,7 @@ shar-stat.charge = Charge: {0}%
|
|||||||
shar-stat.itemAmmo = Ammo: {0} / {1}
|
shar-stat.itemAmmo = Ammo: {0} / {1}
|
||||||
shar-stat.liquidAmmo = Liquid: {0}
|
shar-stat.liquidAmmo = Liquid: {0}
|
||||||
shar-stat.power = Power: {0} / {1}
|
shar-stat.power = Power: {0} / {1}
|
||||||
shar-stat.progress = Construct: {0}%
|
shar-stat.progress = Progress: {0}%
|
||||||
shar-stat-waveAmount = [lightgray]Amount:[] {0}
|
shar-stat-waveAmount = [lightgray]Amount:[] {0}
|
||||||
shar-stat-waveShield = [lightgray]Shield:[] {0}
|
shar-stat-waveShield = [lightgray]Shield:[] {0}
|
||||||
shar-stat.waveStatus = [lightgray]Status:[]
|
shar-stat.waveStatus = [lightgray]Status:[]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ shar-stat.charge = 충전: {0}%
|
|||||||
shar-stat.itemAmmo = 탄약 : {0} / {1}
|
shar-stat.itemAmmo = 탄약 : {0} / {1}
|
||||||
shar-stat.liquidAmmo = 액체: {0}
|
shar-stat.liquidAmmo = 액체: {0}
|
||||||
shar-stat.power = 전력: {0} / {1}
|
shar-stat.power = 전력: {0} / {1}
|
||||||
shar-stat.progress = 건설: {0}%
|
shar-stat.progress = 진행도: {0}%
|
||||||
shar-stat-waveAmount = [lightgray]유닛 수:[] {0}
|
shar-stat-waveAmount = [lightgray]유닛 수:[] {0}
|
||||||
shar-stat-waveShield = [lightgray]방어막:[] {0}
|
shar-stat-waveShield = [lightgray]방어막:[] {0}
|
||||||
shar-stat.waveStatus = [lightgray]상태이상:[]
|
shar-stat.waveStatus = [lightgray]상태이상:[]
|
||||||
|
|||||||
@@ -10,13 +10,17 @@ import arc.util.Time;
|
|||||||
import mindustry.ai.types.FormationAI;
|
import mindustry.ai.types.FormationAI;
|
||||||
import mindustry.core.UI;
|
import mindustry.core.UI;
|
||||||
import mindustry.ctype.UnlockableContent;
|
import mindustry.ctype.UnlockableContent;
|
||||||
|
import mindustry.entities.Units;
|
||||||
import mindustry.entities.abilities.ForceFieldAbility;
|
import mindustry.entities.abilities.ForceFieldAbility;
|
||||||
import mindustry.entities.abilities.ShieldRegenFieldAbility;
|
import mindustry.entities.abilities.ShieldRegenFieldAbility;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.Pal;
|
import mindustry.graphics.Pal;
|
||||||
|
import mindustry.ui.Fonts;
|
||||||
import mindustry.world.blocks.ConstructBlock;
|
import mindustry.world.blocks.ConstructBlock;
|
||||||
import mindustry.world.blocks.defense.turrets.*;
|
import mindustry.world.blocks.defense.turrets.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
|
import mindustry.world.blocks.units.Reconstructor;
|
||||||
|
import mindustry.world.blocks.units.UnitFactory;
|
||||||
import mindustry.world.consumers.ConsumePower;
|
import mindustry.world.consumers.ConsumePower;
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +81,18 @@ public class BarInfo {
|
|||||||
colors.set(1, Pal.darkerMetal);
|
colors.set(1, Pal.darkerMetal);
|
||||||
numbers.set(1, construct.progress);
|
numbers.set(1, construct.progress);
|
||||||
}
|
}
|
||||||
|
else if(target instanceof UnitFactory.UnitFactoryBuild){
|
||||||
|
UnitFactory.UnitFactoryBuild factory = (UnitFactory.UnitFactoryBuild) target;
|
||||||
|
strings.set(1, Core.bundle.format("shar-stat.progress", Strings.fixed(factory.fraction() * 100f, 1)));
|
||||||
|
colors.set(1, Pal.darkerMetal);
|
||||||
|
numbers.set(1, factory.fraction());
|
||||||
|
}
|
||||||
|
else if(target instanceof Reconstructor.ReconstructorBuild){
|
||||||
|
Reconstructor.ReconstructorBuild reconstruct = (Reconstructor.ReconstructorBuild) target;
|
||||||
|
strings.set(1, Core.bundle.format("shar-stat.progress", Strings.fixed(reconstruct.fraction() * 100, 1)));
|
||||||
|
colors.set(1, Pal.darkerMetal);
|
||||||
|
numbers.set(1, reconstruct.fraction());
|
||||||
|
}
|
||||||
|
|
||||||
if(target instanceof ItemTurret.ItemTurretBuild) {
|
if(target instanceof ItemTurret.ItemTurretBuild) {
|
||||||
ItemTurret.ItemTurretBuild turretBuild = (ItemTurret.ItemTurretBuild) target;
|
ItemTurret.ItemTurretBuild turretBuild = (ItemTurret.ItemTurretBuild) target;
|
||||||
@@ -123,7 +138,7 @@ public class BarInfo {
|
|||||||
}
|
}
|
||||||
else if(target instanceof Unit && ((Unit)target).type() != null) {
|
else if(target instanceof Unit && ((Unit)target).type() != null) {
|
||||||
strings.set(2, bundle.format("shar-stat.itemCapacity", UI.formatAmount(((Unit)target).stack().amount), UI.formatAmount(((Unit)target).type().itemCapacity)));
|
strings.set(2, bundle.format("shar-stat.itemCapacity", UI.formatAmount(((Unit)target).stack().amount), UI.formatAmount(((Unit)target).type().itemCapacity)));
|
||||||
colors.set(2, ((Unit)target).stack().item.color.cpy().lerp(Color.white, 0.15f));
|
if(((Unit)target).stack().amount > 0 && ((Unit)target).stack().item != null) colors.set(2, ((Unit)target).stack().item.color.cpy().lerp(Color.white, 0.15f));
|
||||||
numbers.set(2, ((Unit)target).stack().amount / (((Unit)target).type().itemCapacity * 1f));
|
numbers.set(2, ((Unit)target).stack().amount / (((Unit)target).type().itemCapacity * 1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +157,13 @@ public class BarInfo {
|
|||||||
colors.set(3, Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target) / (((Unit)target).type().commandLimit * 1f))), 1f)));
|
colors.set(3, Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target) / (((Unit)target).type().commandLimit * 1f))), 1f)));
|
||||||
numbers.set(3, Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target) / (((Unit)target).type().commandLimit * 1f));
|
numbers.set(3, Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == target) / (((Unit)target).type().commandLimit * 1f));
|
||||||
}
|
}
|
||||||
|
else if(target instanceof UnitFactory.UnitFactoryBuild){
|
||||||
|
UnitFactory.UnitFactoryBuild factory = (UnitFactory.UnitFactoryBuild) target;
|
||||||
|
strings.set(3, factory.unit() == null ? "[lightgray]" + Iconc.cancel :
|
||||||
|
Core.bundle.format("bar.unitcap", Fonts.getUnicodeStr(factory.unit().name), factory.team.data().countType(factory.unit()), Units.getCap(factory.team)));
|
||||||
|
colors.set(3, Pal.power);
|
||||||
|
numbers.set(3, factory.unit() == null ? 0f : (float)factory.team.data().countType(factory.unit()) / Units.getCap(factory.team));
|
||||||
|
}
|
||||||
|
|
||||||
if(target instanceof Unit && target instanceof Payloadc && ((Unit) target).type != null){
|
if(target instanceof Unit && target instanceof Payloadc && ((Unit) target).type != null){
|
||||||
strings.set(4, Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)target).payloadUsed())), Mathf.round(Mathf.sqrt(((Unit)target).type().payloadCapacity))));
|
strings.set(4, Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)target).payloadUsed())), Mathf.round(Mathf.sqrt(((Unit)target).type().payloadCapacity))));
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.input.KeyCode;
|
import arc.input.KeyCode;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.Geometry;
|
import arc.math.geom.Geometry;
|
||||||
import arc.math.geom.Vec2;
|
|
||||||
import arc.scene.*;
|
import arc.scene.*;
|
||||||
import arc.scene.event.HandCursorListener;
|
import arc.scene.event.HandCursorListener;
|
||||||
import arc.scene.style.*;
|
import arc.scene.style.*;
|
||||||
@@ -18,7 +17,6 @@ import arc.struct.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.Predict;
|
|
||||||
import mindustry.entities.Units;
|
import mindustry.entities.Units;
|
||||||
import mindustry.entities.units.*;
|
import mindustry.entities.units.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
@@ -52,8 +50,6 @@ public class HudUi {
|
|||||||
float tileScrollPos;
|
float tileScrollPos;
|
||||||
float itemScrollPos;
|
float itemScrollPos;
|
||||||
|
|
||||||
Color lastItemColor = Pal.items;
|
|
||||||
Color lastAmmoColor = Pal.ammo;
|
|
||||||
Teamc lockedTarget;
|
Teamc lockedTarget;
|
||||||
ImageButton lockButton;
|
ImageButton lockButton;
|
||||||
boolean locked = false;
|
boolean locked = false;
|
||||||
@@ -69,7 +65,7 @@ public class HudUi {
|
|||||||
Seq<String> strings = new Seq<>(new String[]{"","","","","",""});
|
Seq<String> strings = new Seq<>(new String[]{"","","","","",""});
|
||||||
Seq<Float> numbers = new Seq<>(new Float[]{0f,0f,0f,0f,0f,0f});
|
Seq<Float> numbers = new Seq<>(new Float[]{0f,0f,0f,0f,0f,0f});
|
||||||
Seq<Color> colors = new Seq<>(new Color[]{Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear});
|
Seq<Color> colors = new Seq<>(new Color[]{Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear});
|
||||||
|
Seq<Color> lastColors = new Seq<>(new Color[]{Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear});
|
||||||
CoresItemsDisplay coreItems = new CoresItemsDisplay(Team.baseTeams);
|
CoresItemsDisplay coreItems = new CoresItemsDisplay(Team.baseTeams);
|
||||||
|
|
||||||
|
|
||||||
@@ -229,23 +225,40 @@ public class HudUi {
|
|||||||
|
|
||||||
public void addBars(){
|
public void addBars(){
|
||||||
bars.clear();
|
bars.clear();
|
||||||
bars.add(new SBar(
|
lastColors.set(2, colors.get(2));
|
||||||
() -> strings.get(0),
|
{
|
||||||
() -> colors.get(0),
|
int i = 0;
|
||||||
() -> numbers.get(0)
|
bars.add(new SBar(
|
||||||
));
|
() -> strings.get(i),
|
||||||
bars.add(new SBar(
|
() -> {
|
||||||
() -> strings.get(1),
|
if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i));
|
||||||
() -> colors.get(1),
|
return lastColors.get(i);
|
||||||
() -> numbers.get(1)
|
},
|
||||||
));
|
() -> numbers.get(i)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
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)
|
||||||
|
));
|
||||||
|
}
|
||||||
bars.add(new Stack(){{
|
bars.add(new Stack(){{
|
||||||
add(new Table(t -> {
|
add(new Table(t -> {
|
||||||
t.top().defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f));
|
t.top().defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f));
|
||||||
|
int i = 2;
|
||||||
t.add(new SBar(
|
t.add(new SBar(
|
||||||
() -> strings.get(2),
|
() -> strings.get(i),
|
||||||
() -> lastItemColor = colors.get(2),
|
() -> {
|
||||||
() -> numbers.get(2)
|
if(colors.get(i) != Color.clear) lastColors.set(i, colors.get(i));
|
||||||
|
return lastColors.get(i);
|
||||||
|
},
|
||||||
|
() -> numbers.get(i)
|
||||||
)).growX().left();
|
)).growX().left();
|
||||||
}));
|
}));
|
||||||
add(new Table(){{
|
add(new Table(){{
|
||||||
@@ -316,26 +329,44 @@ public class HudUi {
|
|||||||
}));
|
}));
|
||||||
}});
|
}});
|
||||||
|
|
||||||
bars.add(new SBar(
|
|
||||||
() -> strings.get(3),
|
|
||||||
() -> colors.get(3),
|
|
||||||
() -> numbers.get(3)
|
|
||||||
));
|
|
||||||
|
|
||||||
bars.add(new SBar(
|
{
|
||||||
() -> strings.get(4),
|
int i = 3;
|
||||||
() -> colors.get(4),
|
bars.add(new SBar(
|
||||||
() -> numbers.get(4)
|
() -> strings.get(i),
|
||||||
));
|
() -> {
|
||||||
|
if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i));
|
||||||
|
return lastColors.get(i);
|
||||||
|
},
|
||||||
|
() -> numbers.get(i)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 4;
|
||||||
|
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)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
bars.add(new Stack(){{
|
bars.add(new Stack(){{
|
||||||
add(new Table(t -> {
|
add(new Table(t -> {
|
||||||
t.top().defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f));
|
t.top().defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f));
|
||||||
|
|
||||||
|
int i = 5;
|
||||||
t.add(new SBar(
|
t.add(new SBar(
|
||||||
() -> strings.get(5),
|
() -> strings.get(i),
|
||||||
() -> lastAmmoColor = colors.get(5),
|
() -> {
|
||||||
() -> numbers.get(5)
|
if (colors.get(i) != Color.clear) lastColors.set(i, colors.get(i));
|
||||||
|
return lastColors.get(i);
|
||||||
|
},
|
||||||
|
() -> numbers.get(i)
|
||||||
)).growX().left();
|
)).growX().left();
|
||||||
}));
|
}));
|
||||||
add(new Table(t -> {
|
add(new Table(t -> {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package UnitInfo.core;
|
|||||||
import UnitInfo.ui.FreeBar;
|
import UnitInfo.ui.FreeBar;
|
||||||
import arc.Core;
|
import arc.Core;
|
||||||
import arc.Events;
|
import arc.Events;
|
||||||
import arc.files.Fi;
|
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
import arc.graphics.g2d.Draw;
|
import arc.graphics.g2d.Draw;
|
||||||
import arc.graphics.g2d.Fill;
|
import arc.graphics.g2d.Fill;
|
||||||
|
|||||||
Reference in New Issue
Block a user