mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
clean up, power ammo bar
This commit is contained in:
14
README.md
14
README.md
@@ -24,10 +24,6 @@ shows block, tile, overlay tile with its location.
|
||||
### hidden
|
||||
hide.
|
||||
|
||||
## Setting
|
||||
can toggle display on/off ingame, set some ui opacity etc.
|
||||
- [ ] separate setting because it's too many
|
||||
|
||||
## additional things
|
||||
### magic cursor
|
||||
r a i n b o w (can toggle on setting)
|
||||
@@ -35,6 +31,14 @@ r a i n b o w (can toggle on setting)
|
||||
### block scanner
|
||||
scan turret range and hp by circle and bar. (can toggle on setting)
|
||||
- [ ] add filter setting to make scanner can scan not only turrret, wall but also another blocks.
|
||||
### unit hp bar
|
||||
|
||||
### rendered block info
|
||||
- [ ] shows every blocks' status(even enemy), some info bars. (suggestion by @nichrosia)
|
||||
|
||||
### 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.
|
||||
- [ ] separate setting because it's too many
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#UI
|
||||
shar-stat.health = Health: {0}
|
||||
shar-stat.shield = Shield: {0}
|
||||
shar-stat.payloadCapacity = Payloads: {0} / {1}
|
||||
shar-stat.payloadCapacity = Payloads: {0}² / {1}²
|
||||
shar-stat.itemCapacity = Items: {0} / {1}
|
||||
shar-stat.ammos = Ammo: {0} / {1}
|
||||
shar-stat.commandUnits = Commands: {0} / {1}
|
||||
@@ -18,10 +18,9 @@ setting.pastwave.name = Display previous wave
|
||||
setting.emptywave.name = Display empty wave
|
||||
setting.ssim.name = Change Bar style [lightgray](made by ssim)[]
|
||||
setting.select.name = Display select Arrow
|
||||
setting.gaycursor.name = Enable mouse trail effect. only for desktop
|
||||
setting.gaycursor.name = Enable mouse trail effect. [lightgray](only for desktop)[]
|
||||
setting.wavemax.name = Wave Amount to display
|
||||
setting.rangemax.name = Block Scan Range
|
||||
setting.panfix.name = Hold camera position for core camera ui. [lightgray](It shakes a lot when the player moves.)[]
|
||||
setting.scan.name = Display block scanner
|
||||
setting.range.name = Display turret range by block scanner
|
||||
setting.infoui.name = Display info UI
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#UI
|
||||
shar-stat.health = 체력: {0}
|
||||
shar-stat.shield = 방어막: {0}
|
||||
shar-stat.payloadCapacity = 화물: {0} / {1}
|
||||
shar-stat.payloadCapacity = 화물: {0}² / {1}²
|
||||
shar-stat.itemCapacity = 아이템: {0} / {1}
|
||||
shar-stat.ammos = 탄약: {0} / {1}
|
||||
shar-stat.commandUnits = 지휘 유닛: {0} / {1}
|
||||
@@ -18,10 +18,9 @@ setting.pastwave.name = 이전 웨이브 표시
|
||||
setting.emptywave.name = 빈 웨이브 표시
|
||||
setting.ssim.name = 바 스타일 변경 [lightgray](ssim님이 만듬)[]
|
||||
setting.select.name = 선택 화살표 표시
|
||||
setting.gaycursor.name = PC 전용 마우스 꼬리효과
|
||||
setting.gaycursor.name = 마우스 꼬리효과 [lightgray](PC 전용)[]
|
||||
setting.wavemax.name = 표시할 단계 수
|
||||
setting.rangemax.name = 블록 스캔 사거리
|
||||
setting.panfix.name = 코어 UI용 카메라 고정 [lightgray](플레이어가 움직일 때 흔들림이 심합니다.)[]
|
||||
setting.scan.name = 블록 스캐너 표시
|
||||
setting.range.name = 블록 스캐너로 포탑 사거리 표시
|
||||
setting.infoui.name = 정보 UI 표시
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#UI
|
||||
shar-stat.health = 血量: {0}
|
||||
shar-stat.shield = 盾量: {0}
|
||||
shar-stat.payloadCapacity = 有效载荷: {0} / {1}
|
||||
shar-stat.payloadCapacity = 有效载荷: {0}² / {1}²
|
||||
shar-stat.itemCapacity = 装载物品: {0} / {1}
|
||||
shar-stat.ammos = 子弹量: {0} / {1}
|
||||
shar-stat.commandUnits = 控制单位: {0} / {1}
|
||||
@@ -19,7 +19,6 @@ setting.select.name = 显示选择箭头
|
||||
setting.gaycursor.name = 启用鼠标轨迹效果。仅适用于电脑
|
||||
setting.wavemax.name = 要显示的波数
|
||||
setting.rangemax.name = 扫描方块范围
|
||||
setting.panfix.name = 保持核心摄像头ui的摄像头位置 [lightgray](当玩家移动时,它会晃动很多?。)[]
|
||||
setting.scan.name = 显示方块扫描仪
|
||||
setting.range.name = 方块扫描仪显示炮台射程?
|
||||
setting.infoui.name = 显示信息界面
|
||||
|
||||
@@ -26,7 +26,6 @@ import mindustry.input.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.ConstructBlock;
|
||||
import mindustry.world.blocks.defense.turrets.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
@@ -57,11 +56,8 @@ public class HudUi {
|
||||
float heat2;
|
||||
float a;
|
||||
int maxwave;
|
||||
int coreamount;
|
||||
int uiIndex = 0;
|
||||
|
||||
boolean panFix = false;
|
||||
|
||||
public Unit getUnit(){
|
||||
Seq<Unit> units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4);
|
||||
if(units.size <= 0) return player.unit();
|
||||
@@ -265,7 +261,7 @@ public class HudUi {
|
||||
() -> {
|
||||
if(getUnit() instanceof BlockUnitUnit){
|
||||
if(((BlockUnitUnit)getUnit()).tile() instanceof ItemTurret.ItemTurretBuild) {
|
||||
return Core.bundle.format("shar-stat.itemAmmo", ((ItemTurret.ItemTurretBuild) ((BlockUnitUnit)getUnit()).tile()).totalAmmo, ((ItemTurret)((BlockUnitUnit)getUnit()).tile().block).maxAmmo);
|
||||
return bundle.format("shar-stat.itemAmmo", ((ItemTurret.ItemTurretBuild) ((BlockUnitUnit)getUnit()).tile()).totalAmmo, ((ItemTurret)((BlockUnitUnit)getUnit()).tile().block).maxAmmo);
|
||||
|
||||
}
|
||||
else if(((BlockUnitUnit)getUnit()).tile() instanceof LiquidTurret.LiquidTurretBuild){
|
||||
@@ -273,19 +269,17 @@ public class HudUi {
|
||||
Func<Building, Liquid> current;
|
||||
current = entity1 -> entity1.liquids == null ? Liquids.water : entity1.liquids.current();
|
||||
|
||||
return Core.bundle.format("shar-stat.liquidAmmo", entity == null || entity.liquids == null ? 0 : Mathf.round(entity.liquids.get(current.get(entity)) * 10) / 10.0 + " / " + Mathf.round(entity.block.liquidCapacity));
|
||||
return bundle.format("shar-stat.liquidAmmo", entity == null || entity.liquids == null ? 0 : Mathf.round(entity.liquids.get(current.get(entity)) * 10) / 10.0 + " / " + Mathf.round(entity.block.liquidCapacity));
|
||||
}
|
||||
else if(((BlockUnitUnit)getUnit()).tile() instanceof PowerTurret.PowerTurretBuild){
|
||||
|
||||
PowerTurret.PowerTurretBuild entity = ((PowerTurret.PowerTurretBuild)((BlockUnitUnit)getUnit()).tile());
|
||||
ConsumePower cons = entity.block.consumes.getPower();
|
||||
double max = (Math.round(cons.usage * 10) / 10.0) * 60;
|
||||
double v = (Math.round(((ConditionalConsumePower)entity.block.consumes.get(ConsumeType.power)).requestedPower(entity) * 10) / 10.0);
|
||||
return Core.bundle.format("shar-stat.power", (Math.round(entity.power.status * v * 10) / 10.0) * 60, max);
|
||||
float max = entity.block.consumes.getPower().usage;
|
||||
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
|
||||
return bundle.format("shar-stat.power", (int)(Math.min(v,max) * 60), (int)(max * 60));
|
||||
}
|
||||
}
|
||||
|
||||
return Core.bundle.format("shar-stat.itemCapacity", getUnit().stack.amount, getUnit().type.itemCapacity);
|
||||
return bundle.format("shar-stat.itemCapacity", getUnit().stack.amount, getUnit().type.itemCapacity);
|
||||
},
|
||||
() -> {
|
||||
if(getUnit() instanceof BlockUnitUnit){
|
||||
@@ -322,12 +316,10 @@ public class HudUi {
|
||||
return entity == null || entity.liquids == null ? 0f : entity.liquids.get(current.get(entity)) / entity.block.liquidCapacity;
|
||||
}
|
||||
else if(((BlockUnitUnit)getUnit()).tile() instanceof PowerTurret.PowerTurretBuild){
|
||||
PowerTurret.PowerTurretBuild entity = ((PowerTurret.PowerTurretBuild)((BlockUnitUnit)getUnit()).tile());
|
||||
ConsumePower cons = entity.block.consumes.getPower();
|
||||
|
||||
double max = (Math.round(cons.usage * 10) / 10.0) * 60;
|
||||
double v = (Math.round(((ConditionalConsumePower)entity.block.consumes.get(ConsumeType.power)).requestedPower(entity) * 10) / 10.0);
|
||||
return (float) (((Math.round(entity.power.status * v * 10) / 10.0) * 60) / max);
|
||||
Building entity = ((BlockUnitUnit)getUnit()).tile();
|
||||
float max = entity.block.consumes.getPower().usage;
|
||||
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
|
||||
return v/max;
|
||||
}
|
||||
}
|
||||
return Mathf.clamp(getUnit().stack.amount / (getUnit().type.itemCapacity * 1f));
|
||||
@@ -374,28 +366,39 @@ public class HudUi {
|
||||
imaget = new Image(current.get(entity).uiIcon).setScaling(Scaling.fit);
|
||||
}
|
||||
else if(((BlockUnitUnit)getUnit()).tile() instanceof PowerTurret.PowerTurretBuild){
|
||||
PowerTurret.PowerTurretBuild entity = ((PowerTurret.PowerTurretBuild)((BlockUnitUnit)getUnit()).tile());
|
||||
ConsumePower cons = entity.block.consumes.getPower();
|
||||
imaget = new ReqImage(Icon.power.getRegion(), () -> ((BlockUnitUnit)getUnit()).tile().power.status * ((BlockUnitUnit)getUnit()).tile().power.graph.getLastScaledPowerIn() > 0f){
|
||||
{
|
||||
{
|
||||
add(new Image(Icon.power.getRegion()));
|
||||
add(new Element(){
|
||||
@Override
|
||||
public void draw(){
|
||||
Building entity = ((BlockUnitUnit)getUnit()).tile();
|
||||
float max = entity.block.consumes.getPower().usage;
|
||||
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
|
||||
|
||||
|
||||
|
||||
double max = (Math.round(cons.usage * 10) / 10.0) * 60;
|
||||
double v = (Math.round(((ConditionalConsumePower)entity.block.consumes.get(ConsumeType.power)).requestedPower(entity) * 10) / 10.0);
|
||||
float amount = (float) (((Math.round(entity.power.status * v * 10) / 10.0) * 60) / max);
|
||||
|
||||
imaget = new PrograssedReqImage(Icon.power.getRegion(), () -> amount >= 0.99f, amount);
|
||||
if(amount >= 0.999f) imaget = new Image(Icon.power.getRegion()).setScaling(Scaling.fit);
|
||||
Lines.stroke(Scl.scl(2f), Pal.removeBack);
|
||||
Draw.alpha(1 - v/max);
|
||||
Lines.line(x, y - 2f + height, x + width, y - 2f);
|
||||
Draw.color(Pal.remove);
|
||||
Draw.alpha(1 - v/max);
|
||||
Lines.line(x, y + height, x + width, y);
|
||||
Draw.reset();
|
||||
}
|
||||
});
|
||||
}}
|
||||
};
|
||||
}
|
||||
|
||||
if(image != null){
|
||||
if(imaget.getClass() != image.getClass() || imaget.getClass() == Image.class){
|
||||
clearChildren();
|
||||
add(imaget).size(Cicon.small.size).padBottom(2 * 8f).padRight(3 * 8f);
|
||||
add(imaget).size(iconSmall).padBottom(2 * 8f).padRight(3 * 8f);
|
||||
image = imaget;
|
||||
}
|
||||
}
|
||||
else {
|
||||
add(imaget).size(Cicon.small.size).padBottom(2 * 8f).padRight(3 * 8f);
|
||||
add(imaget).size(iconSmall).padBottom(2 * 8f).padRight(3 * 8f);
|
||||
image = imaget;
|
||||
}
|
||||
}
|
||||
@@ -446,7 +449,7 @@ public class HudUi {
|
||||
|
||||
));
|
||||
bars.add(new SBar(
|
||||
() -> Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)getUnit()).payloadUsed())) + "²", Mathf.round(Mathf.sqrt(getUnit().type().payloadCapacity)) + "²"),
|
||||
() -> Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)getUnit()).payloadUsed())), Mathf.round(Mathf.sqrt(getUnit().type().payloadCapacity))),
|
||||
() -> Pal.items,
|
||||
() -> Mathf.clamp(((Payloadc)getUnit()).payloadUsed() / getUnit().type().payloadCapacity),
|
||||
() -> getUnit() instanceof Payloadc
|
||||
@@ -654,8 +657,6 @@ public class HudUi {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
float hh;
|
||||
public void addUnitTable(){
|
||||
if(uiIndex != 0) return;
|
||||
unitTable = new Table(table -> {
|
||||
@@ -849,7 +850,6 @@ public class HudUi {
|
||||
}));
|
||||
}}).pad(2f);
|
||||
tt.clicked(() -> {
|
||||
Log.info("clicked");
|
||||
if(Core.input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(group.type.name) != 0){
|
||||
Core.app.setClipboardText((char)Fonts.getUnicode(group.type.name) + "");
|
||||
ui.showInfoFade("@copied");
|
||||
@@ -905,36 +905,28 @@ public class HudUi {
|
||||
public void setCore(Table table){
|
||||
table.add(new Table(t -> {
|
||||
if(Vars.player.unit() == null) return;
|
||||
coreamount = Vars.player.unit().team().cores().size;
|
||||
for(int r = 0; r < coreamount; r++){
|
||||
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
|
||||
TextureRegion region = core.block.uiIcon;
|
||||
|
||||
if(coreamount > 1 && r % 3 == 0) t.row();
|
||||
for(int r = 0; r < Vars.player.unit().team().cores().size; r++){
|
||||
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
|
||||
|
||||
if(Vars.player.unit().team().cores().size > 1 && r % 3 == 0) t.row();
|
||||
else if(r % 3 == 0) t.row();
|
||||
|
||||
t.table(tt -> {
|
||||
tt.left();
|
||||
tt.add(new Stack(){{
|
||||
add(new Table(tt -> {
|
||||
tt.add(new Stack(){{
|
||||
add(new Table(s -> {
|
||||
s.left();
|
||||
s.add(new Image(region).setScaling(Scaling.fit)).size(Scl.scl(6 * 8f)).scaling(Scaling.fit);
|
||||
Image image = new Image(core.block.uiIcon).setScaling(Scaling.fit);
|
||||
image.clicked(() -> {
|
||||
if(control.input instanceof DesktopInput) ((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
});
|
||||
s.add(image).size(Scl.scl(6 * 8f)).scaling(Scaling.fit);
|
||||
}));
|
||||
|
||||
add(new Table(s -> {
|
||||
s.add(new Stack(){{
|
||||
add(new Table(e -> {
|
||||
e.defaults().growX().height(Scl.scl(9)).width(Scl.scl(6f * 8f)).padTop(Scl.scl(6 * 8f * (settings.getInt("coreuiscaling") / 100f)));
|
||||
Bar healthBar = new Bar(
|
||||
() -> "",
|
||||
() -> Pal.health,
|
||||
core::healthf);
|
||||
e.add(healthBar);
|
||||
e.pack();
|
||||
}));
|
||||
}});
|
||||
s.bottom().defaults().growX().height(Scl.scl(9)).pad(4);
|
||||
s.add(new Bar(() -> "", () -> Pal.health, core::healthf));
|
||||
s.pack();
|
||||
}));
|
||||
}});
|
||||
@@ -942,37 +934,11 @@ public class HudUi {
|
||||
Label label = new Label(() -> "(" + (int)core.x / 8 + ", " + (int)core.y / 8 + ")");
|
||||
label.setFontScale(Scl.scl());
|
||||
tt.add(label);
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
add(new Table(tt -> {
|
||||
tt.center();
|
||||
TextButton button = new TextButton("?", Styles.clearPartialt);
|
||||
button.changed(() -> {
|
||||
if(mobile) {
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
return;
|
||||
}
|
||||
if(!settings.getBool("panfix")) {
|
||||
if(control.input instanceof DesktopInput) ((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
}
|
||||
else panFix = !panFix;
|
||||
});
|
||||
tt.update(() -> {
|
||||
if(mobile || !settings.getBool("panfix")) return;
|
||||
button.setChecked(panFix);
|
||||
if(control.input instanceof DesktopInput) ((DesktopInput) control.input).panning = true;
|
||||
Core.camera.position.set(core.x, core.y);
|
||||
});
|
||||
tt.add(button).size(Scl.scl(3 * 8f)).center().padBottom(2 * 6f);
|
||||
tt.pack();
|
||||
}));
|
||||
}});
|
||||
}).left();
|
||||
}
|
||||
}));
|
||||
}
|
||||
int coreAmount;
|
||||
public void addCoreTable(){
|
||||
if(uiIndex != 2) return;
|
||||
ScrollPane corePane = new ScrollPane(new Table(tx -> tx.table(this::setCore).left()), Styles.smallPane);
|
||||
@@ -987,10 +953,7 @@ public class HudUi {
|
||||
}
|
||||
|
||||
coreScrollPos = corePane.getScrollY();
|
||||
if(Vars.player != null && coreAmount != Vars.player.team().cores().size) {
|
||||
corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
|
||||
coreAmount = Vars.player.team().cores().size;
|
||||
};
|
||||
if(Vars.player != null) corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
|
||||
});
|
||||
corePane.setOverscroll(false, false);
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package UnitInfo.core;
|
||||
|
||||
import arc.func.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
public class PrograssedReqImage extends Stack {
|
||||
public PrograssedReqImage(Element image, Boolp valid, float prograss){
|
||||
add(image);
|
||||
add(new Element(){
|
||||
{
|
||||
visible(() -> !valid.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Lines.stroke(Scl.scl(2f), Pal.removeBack);
|
||||
Draw.alpha(1 - prograss);
|
||||
Lines.line(x, y - 2f + height, x + width, y - 2f);
|
||||
Draw.color(Pal.remove);
|
||||
Draw.alpha(1 - prograss);
|
||||
Lines.line(x, y + height, x + width, y);
|
||||
Draw.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public PrograssedReqImage(TextureRegion region, Boolp valid, float prograss){
|
||||
this(new Image(region), valid, prograss);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,6 @@ public class Setting {
|
||||
addGraphicSetting("emptywave");
|
||||
addGraphicSetting("ssim");
|
||||
addGraphicSetting("gaycursor");
|
||||
addGraphicSetting("panfix");
|
||||
addGraphicSetting("scan");
|
||||
addGraphicSetting("range");
|
||||
addGraphicSetting("select");
|
||||
@@ -172,8 +171,7 @@ public class Setting {
|
||||
Core.settings.defaults("emptywave", true);
|
||||
Core.settings.defaults("ssim", false);
|
||||
Core.settings.defaults("select", false);
|
||||
Core.settings.defaults("gaycursor", true);
|
||||
Core.settings.defaults("panfix", false);
|
||||
Core.settings.defaults("gaycursor", false);
|
||||
Core.settings.defaults("scan", false);
|
||||
Core.settings.defaults("range", false);
|
||||
Core.settings.defaults("infoui", true);
|
||||
|
||||
@@ -14,12 +14,12 @@ import mindustry.graphics.*;
|
||||
import mindustry.ui.*;
|
||||
|
||||
public class SBar extends Element{
|
||||
private static Rect scissor = new Rect();
|
||||
private static final Rect scissor = new Rect();
|
||||
|
||||
private Floatp fraction;
|
||||
private String name = "";
|
||||
private float value, lastValue, blink;
|
||||
private Color blinkColor = new Color();
|
||||
private final Color blinkColor = new Color();
|
||||
private boolean valid = true;
|
||||
|
||||
public SBar(String name, Color color, Floatp fraction){
|
||||
|
||||
Reference in New Issue
Block a user