This commit is contained in:
sharlotte
2021-08-08 15:23:12 +09:00
parent 06f020ceb9
commit 16a4a699ca
8 changed files with 122 additions and 81 deletions

View File

@@ -24,6 +24,8 @@ shar-stat.waveItem = [lightgray]Item:[]
setting.wavesetting.name = Wave UI Setting setting.wavesetting.name = Wave UI Setting
setting.opacitysetting.name = Opacity Setting setting.opacitysetting.name = Opacity Setting
setting.infoUiScale.name = Info UI Scaling
setting.infoUiScale.description = set scale for info ui on left-side.
setting.pastwave.name = Display Previous Wave setting.pastwave.name = Display Previous Wave
setting.pastwave.description = toggle to shows previous wave on wave info ingame.\nCurrent wave is highlighted with red. setting.pastwave.description = toggle to shows previous wave on wave info ingame.\nCurrent wave is highlighted with red.
setting.emptywave.name = Display Empty Wave setting.emptywave.name = Display Empty Wave

View File

@@ -24,6 +24,8 @@ shar-stat.waveItem = [lightgray]아이템:[]
setting.wavesetting.name = 단계 UI 설정 setting.wavesetting.name = 단계 UI 설정
setting.opacitysetting.name = 투명도 설정 setting.opacitysetting.name = 투명도 설정
setting.infoUiScale.name = 정보 UI 스케일링
setting.infoUiScale.description = 인게임 좌측 정보 UI의 크기를 설정합니다.
setting.pastwave.name = 이전 단계 표시 setting.pastwave.name = 이전 단계 표시
setting.pastwave.description = 인게임 단계 탭에서 이전 단계도 표시합니다. 현재 단계는 빨간색으로 강조됩니다. setting.pastwave.description = 인게임 단계 탭에서 이전 단계도 표시합니다. 현재 단계는 빨간색으로 강조됩니다.
setting.emptywave.name = 빈 단계 표시 setting.emptywave.name = 빈 단계 표시

View File

@@ -6,6 +6,7 @@ import arc.graphics.g2d.TextureRegion;
import arc.struct.*; import arc.struct.*;
import static arc.Core.atlas; import static arc.Core.atlas;
import static arc.Core.settings;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class SVars { public class SVars {
@@ -17,4 +18,6 @@ public class SVars {
public static PlayerParser playerinfo = new PlayerParser(); public static PlayerParser playerinfo = new PlayerParser();
public static TextureRegion clear = atlas.find("clear"); public static TextureRegion clear = atlas.find("clear");
public static float modUiScale = (settings.getInt("infoUiScale") / 100f == 0 ? 1 : settings.getInt("infoUiScale") / 100f);
} }

View File

@@ -37,6 +37,7 @@ import mindustry.world.blocks.power.PowerNode;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
import static UnitInfo.SVars.clear; import static UnitInfo.SVars.clear;
import static UnitInfo.SVars.modUiScale;
import static arc.Core.*; import static arc.Core.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -271,6 +272,11 @@ public class HudUi {
}); });
Events.run(EventType.Trigger.update, ()->{ Events.run(EventType.Trigger.update, ()->{
if(modUiScale != settings.getInt("infoUiScale") / 100f && settings.getInt("infoUiScale") / 100f != 0){
modUiScale = settings.getInt("infoUiScale") / 100f;
mainTable.clearChildren();
addTable();
}
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))){ if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))){
if(input.keyTap(KeyCode.r)) lockButton.change(); if(input.keyTap(KeyCode.r)) lockButton.change();
} }
@@ -365,8 +371,8 @@ public class HudUi {
fontColor = Color.white; fontColor = Color.white;
background = Styles.black8; background = Styles.black8;
}}); }});
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
Table labelTable = new Table(t -> t.add(label).scaling(Scaling.fit).left().padRight(40 * 8f)); Table labelTable = new Table(t -> t.add(label).left().padRight(Scl.scl(modUiScale) * 40 * 8f));
table.table(t -> { table.table(t -> {
Seq<Button> buttons = Seq.with(null, null, null, null, null, null); Seq<Button> buttons = Seq.with(null, null, null, null, null, null);
@@ -375,17 +381,14 @@ public class HudUi {
for(int i = 0; i < buttons.size; i++){ for(int i = 0; i < buttons.size; i++){
int finalI = i; int finalI = i;
buttons.set(i, t.button(icons.get(i), Styles.clearToggleTransi, () -> buttons.set(i, t.button(icons.get(i), Styles.clearToggleTransi, () ->
reset(finalI, buttons, label, table, labelTable, strs.get(finalI))).size(5*8f).get()); reset(finalI, buttons, label, table, labelTable, strs.get(finalI))).size(Scl.scl(modUiScale) * 5 * 8f).get());
t.row(); t.row();
} }
}); });
baseTable = table.table(tt -> tt.stack(unitTable, coreTable, waveTable, tileTable, itemTable, labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).get(); baseTable = table.table(tt -> tt.stack(unitTable, coreTable, waveTable, tileTable, itemTable, labelTable).align(Align.left).left().visible(() -> settings.getBool("infoui"))).get();
table.fillParent = true; table.fillParent = true;
table.visibility = () -> (ui.hudfrag.shown && !ui.minimapfrag.shown() table.visibility = () -> ui.hudfrag.shown && !ui.minimapfrag.shown();
&& (!Vars.mobile ||
!(Vars.control.input.block != null || !Vars.control.input.selectRequests.isEmpty()
&& !(Vars.control.input.lastSchematic != null && !Vars.control.input.selectRequests.isEmpty()))));
}); });
ui.hudGroup.addChild(mainTable); ui.hudGroup.addChild(mainTable);
} }
@@ -417,7 +420,7 @@ public class HudUi {
} }
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(modUiScale) * 23 * 8f).height(Scl.scl(modUiScale) * 4f * 8f);
int i = 2; int i = 2;
t.add(new SBar( t.add(new SBar(
() -> BarInfo.strings.get(i), () -> BarInfo.strings.get(i),
@@ -458,7 +461,7 @@ public class HudUi {
float v = entity.power.status * entity.power.graph.getLastScaledPowerIn(); float v = entity.power.status * entity.power.graph.getLastScaledPowerIn();
super.draw(); super.draw();
Lines.stroke(Scl.scl(2f), Pal.removeBack); Lines.stroke(2f, Pal.removeBack);
Draw.alpha(1 - v/max); Draw.alpha(1 - v/max);
Lines.line(x, y - 2f + height, x + width, y - 2f); Lines.line(x, y - 2f + height, x + width, y - 2f);
Draw.color(Pal.remove); Draw.color(Pal.remove);
@@ -469,7 +472,7 @@ public class HudUi {
}; };
} }
clearChildren(); clearChildren();
add(image).size(iconSmall).padBottom(2 * 8f).padRight(3 * 8f); add(image).size(iconSmall * Scl.scl(modUiScale)).padBottom(2 * 8f).padRight(3 * 8f);
}); });
pack(); pack();
}}); }});
@@ -482,7 +485,7 @@ public class HudUi {
else setDrawable(clear); else setDrawable(clear);
}); });
visibility = () -> getTarget() instanceof Unit; visibility = () -> getTarget() instanceof Unit;
}}.setScaling(Scaling.fit)).size(Scl.scl(30f)).padBottom(Scl.scl(4 * 8f)).padRight(Scl.scl(6 * 8f)); }}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 30f).padBottom(Scl.scl(modUiScale) * 4 * 8f).padRight(Scl.scl(modUiScale) * 6 * 8f);
t.pack(); t.pack();
})); }));
}}); }});
@@ -515,7 +518,7 @@ public class HudUi {
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(modUiScale) * 23 * 8f).height(Scl.scl(modUiScale) * 4 * 8f);
int i = 5; int i = 5;
t.add(new SBar( t.add(new SBar(
@@ -540,7 +543,7 @@ public class HudUi {
} }
setDrawable(region); setDrawable(region);
}); });
}}.setScaling(Scaling.fit)).size(Scl.scl(30f)).padBottom(Scl.scl(4 * 8f)).padRight(Scl.scl(6 * 8f)); }}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 30f).padBottom(Scl.scl(modUiScale) * 4 * 8f).padRight(Scl.scl(modUiScale) * 6 * 8f);
t.pack(); t.pack();
})); }));
}}); }});
@@ -548,10 +551,10 @@ public class HudUi {
public void addWeapon(){ public void addWeapon(){
weapon = new Table(tx -> { weapon = new Table(tx -> {
tx.left().defaults().minSize(Scl.scl(12 * 8f)); tx.left().defaults().minSize(Scl.scl(modUiScale) * 12 * 8f);
tx.add(new Table(Tex.button, tt -> { tx.add(new Table(Tex.button, tt -> {
tt.left().top().defaults().width(Scl.scl(24/3f * 8f)).minHeight(Scl.scl(12/3f * 8f)); tt.left().top().defaults().width(Scl.scl(modUiScale) * 8 * 8f).minHeight(Scl.scl(modUiScale) * 4 * 8f);
if(getTarget() instanceof Unit u && u.type != null) { if(getTarget() instanceof Unit u && u.type != null) {
UnitType type = u.type; UnitType type = u.type;
@@ -593,15 +596,15 @@ public class HudUi {
if(getDrawable() != null) if(getDrawable() != null)
getDrawable().draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY); getDrawable().draw(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
} }
}.setScaling(Scaling.fit)).size(Scl.scl(6 * 8f)).scaling(Scaling.fit); }.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 6 * 8f);
})); }));
add(new Table(h -> { add(new Table(h -> {
h.defaults().growX().height(Scl.scl(9)).width(Scl.scl(31.5f)).padTop(Scl.scl(9*2f)); h.defaults().growX().height(Scl.scl(modUiScale) * 9f).width(Scl.scl(modUiScale) * 31.5f).padTop(Scl.scl(modUiScale) * 18f);
h.add(new Bar( h.add(new Bar(
() -> "", () -> "",
() -> Pal.accent.cpy().lerp(Color.orange, mount.reload / weapon.reload), () -> Pal.accent.cpy().lerp(Color.orange, mount.reload / weapon.reload),
() -> mount.reload / weapon.reload)).padLeft(Scl.scl(8f)); () -> mount.reload / weapon.reload)).padLeft(Scl.scl(modUiScale) * 8f);
h.pack(); h.pack();
})); }));
}}).left(); }}).left();
@@ -617,7 +620,7 @@ public class HudUi {
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha); Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
getBackground().draw(x, y, width, height); getBackground().draw(x, y, width, height);
} }
}).padRight(Scl.scl(24 * 8f)); }).padRight(Scl.scl(modUiScale) * 24 * 8f);
tx.setColor(tx.color.cpy().a(1f)); tx.setColor(tx.color.cpy().a(1f));
}); });
} }
@@ -628,21 +631,21 @@ public class HudUi {
table.left(); table.left();
addBars(); addBars();
table.add(new Table(Tex.button, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().width(Scl.scl(25 * 8f)).scaling(Scaling.bounded); t.defaults().width(Scl.scl(modUiScale) * 25 * 8f);
t.table(Tex.underline2, tt -> { t.table(Tex.underline2, tt -> {
Stack stack = new Stack(){{ Stack stack = new Stack(){{
add(new Table(ttt -> ttt.add(new Image(){{ add(new Table(ttt -> ttt.add(new Image(){{
update(() -> { update(() -> {
TextureRegion region = clear; TextureRegion region = clear;
if(getTarget() instanceof Unit && ((Unit) getTarget()).type() != null) region = ((Unit) getTarget()).type().uiIcon; if(getTarget() instanceof Unit u && u.type != null) region = ((Unit) getTarget()).type().uiIcon;
else if(getTarget() instanceof Building && ((Building) getTarget()).block != null) { else if(getTarget() instanceof Building b && b.block != null) {
if(getTarget() instanceof ConstructBlock.ConstructBuild) region = ((ConstructBlock.ConstructBuild) getTarget()).current.uiIcon; if(getTarget() instanceof ConstructBlock.ConstructBuild cb) region = cb.current.uiIcon;
else region = ((Building) getTarget()).block.uiIcon; else region = b.block.uiIcon;
} }
setDrawable(region); setDrawable(region);
}); });
}}.setScaling(Scaling.fit)).size(Scl.scl(4f * 8f)))); }}.setScaling(Scaling.fit)).size(Scl.scl(modUiScale) * 4f * 8f)));
add(new Table(ttt -> { add(new Table(ttt -> {
ttt.add(new Stack(){{ ttt.add(new Stack(){{
add(new Table(temp -> temp.add(new Image(){{ add(new Table(temp -> temp.add(new Image(){{
@@ -651,14 +654,14 @@ public class HudUi {
add(new Table(temp -> { add(new Table(temp -> {
if(getTarget() instanceof Unit) { if(getTarget() instanceof Unit) {
Label label = new Label(() -> (getTarget() instanceof Unit && ((Unit) getTarget()).type() != null ? (int) ((Unit) getTarget()).type().armor + "" : "")); Label label = new Label(() -> (getTarget() instanceof Unit u && u.type != null ? (int) u.type.armor + "" : ""));
label.setColor(Pal.surge); label.setColor(Pal.surge);
label.setFontScale(0.5f); label.setFontScale(Scl.scl(modUiScale) * 0.5f);
temp.add(label).center(); temp.add(label).center();
} }
temp.pack(); temp.pack();
})); }));
}}).padLeft(Scl.scl(2 * 8f)).padBottom(Scl.scl(2 * 8f)); }}).padLeft(Scl.scl(modUiScale) * 2 * 8f).padBottom(Scl.scl(modUiScale) * 2 * 8f);
})); }));
}}; }};
@@ -672,6 +675,7 @@ public class HudUi {
} }
return name; return name;
}); });
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
TextButton button = Elem.newButton("?", Styles.clearPartialt, () -> { TextButton button = Elem.newButton("?", Styles.clearPartialt, () -> {
if(getTarget() instanceof Unit && ((Unit) getTarget()).type() != null) if(getTarget() instanceof Unit && ((Unit) getTarget()).type() != null)
@@ -696,8 +700,8 @@ public class HudUi {
tt.top(); tt.top();
tt.add(stack); tt.add(stack);
tt.add(label); tt.add(label);
tt.add(button).size(Scl.scl(5 * 8f)); tt.add(button).size(Scl.scl(modUiScale) * 5 * 8f);
tt.add(lockButton).size(Scl.scl(3 * 8f)); tt.add(lockButton).size(Scl.scl(modUiScale) * 3 * 8f);
tt.clicked(()->{ tt.clicked(()->{
if(getTarget() == null) return; if(getTarget() == null) return;
@@ -707,7 +711,7 @@ public class HudUi {
}); });
tt.addListener(new Tooltip(tool -> tool.background(Tex.button).table(to -> { tt.addListener(new Tooltip(tool -> tool.background(Tex.button).table(to -> {
to.table(Tex.underline2, tool2 -> { to.table(Tex.underline2, tool2 -> {
tool2.label(()->{ Label label2 = new Label(()->{
if(getTarget() instanceof Unit u){ if(getTarget() instanceof Unit u){
if(u.getPlayer() != null) return u.getPlayer().name; if(u.getPlayer() != null) return u.getPlayer().name;
else if(u.type != null) return u.type.localizedName; else if(u.type != null) return u.type.localizedName;
@@ -716,17 +720,21 @@ public class HudUi {
return ""; return "";
}); });
if(modUiScale < 1) label2.setFontScale(Scl.scl(modUiScale));
tool2.add(label2);
}); });
to.row(); to.row();
to.label(()->getTarget() == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(getTarget().x() / tilesize, 2) + ", " + Strings.fixed(getTarget().y() / tilesize, 2) + ")"); Label label2 = new Label(()->getTarget() == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(getTarget().x() / tilesize, 2) + ", " + Strings.fixed(getTarget().y() / tilesize, 2) + ")");
if(modUiScale < 1) label2.setFontScale(Scl.scl(modUiScale));
to.add(label2);
}))); })));
}); });
t.row(); t.row();
t.table(tt -> { t.table(tt -> {
tt.defaults().width(Scl.scl(23 * 8f)).height(Scl.scl(4f * 8f)).top(); tt.defaults().width(Scl.scl(modUiScale) * 23 * 8f).height(Scl.scl(modUiScale) * 4f * 8f).top();
for(Element bar : bars){ for(Element bar : bars){
bar.setWidth(bar.getWidth()); bar.setScale(Scl.scl(modUiScale));
bar.setHeight(bar.getHeight());
tt.add(bar).growX().left(); tt.add(bar).growX().left();
tt.row(); tt.row();
} }
@@ -740,7 +748,7 @@ public class HudUi {
Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha); Draw.color(color.r, color.g, color.b, (settings.getInt("uiopacity") / 100f) * this.parentAlpha);
getBackground().draw(x, y, width, height); getBackground().draw(x, y, width, height);
} }
}).padRight(Scl.scl(24 * 8f)); }).padRight(Scl.scl(modUiScale) * 24 * 8f);
table.row(); table.row();
table.update(() -> { table.update(() -> {
try { try {
@@ -779,9 +787,10 @@ public class HudUi {
table.center(); table.center();
final int jj = j+1; final int jj = j+1;
Label label = new Label(() -> "[#" + (state.wave == j+1 ? Color.red.toString() : Pal.accent.toString()) + "]" + jj + "[]"); Label label = new Label(() -> "[#" + (state.wave == j+1 ? Color.red.toString() : Pal.accent.toString()) + "]" + jj + "[]");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
t.add(label); t.add(label);
}).size(Scl.scl(32f)); }).size(Scl.scl(modUiScale) * 4 * 8f);
table.table(Tex.underline, tx -> { table.table(Tex.underline, tx -> {
if(settings.getBool("emptywave") && state.rules.spawns.find(g -> g.getSpawned(j) > 0) == null) { if(settings.getBool("emptywave") && state.rules.spawns.find(g -> g.getSpawned(j) > 0) == null) {
@@ -818,13 +827,14 @@ public class HudUi {
tt.add(new Stack(){{ tt.add(new Stack(){{
add(new Table(ttt -> { add(new Table(ttt -> {
ttt.center(); ttt.center();
ttt.add(image).size(iconLarge); ttt.add(image).size(iconLarge * Scl.scl(modUiScale < 1 ? modUiScale : 1));
ttt.pack(); ttt.pack();
})); }));
add(new Table(ttt -> { add(new Table(ttt -> {
ttt.bottom().left(); ttt.bottom().left();
Label label = new Label(() -> amount + ""); Label label = new Label(() -> amount + "");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
ttt.add(label); ttt.add(label);
ttt.pack(); ttt.pack();
})); }));
@@ -833,11 +843,11 @@ public class HudUi {
ttt.top().right(); ttt.top().right();
Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit); Image image = new Image(Icon.warning.getRegion()).setScaling(Scaling.fit);
image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)))); image.update(() -> image.setColor(Tmp.c2.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f))));
ttt.add(image).size(Scl.scl(12f)); ttt.add(image).size(Scl.scl(modUiScale < 1 ? modUiScale : 1) * 12f);
ttt.visible(() -> group.effect == StatusEffects.boss); ttt.visible(() -> group.effect == StatusEffects.boss);
ttt.pack(); ttt.pack();
})); }));
}}).pad(2f); }}).pad(2f * Scl.scl(modUiScale));
tt.clicked(() -> { tt.clicked(() -> {
if(input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(group.type.name) != 0){ if(input.keyDown(KeyCode.shiftLeft) && Fonts.getUnicode(group.type.name) != 0){
app.setClipboardText((char)Fonts.getUnicode(group.type.name) + ""); app.setClipboardText((char)Fonts.getUnicode(group.type.name) + "");
@@ -868,14 +878,14 @@ public class HudUi {
to.table(tot -> { to.table(tot -> {
tot.left(); tot.left();
tot.add(bundle.get("shar-stat.waveStatus")); tot.add(bundle.get("shar-stat.waveStatus"));
tot.add(finalStatus).size(8 * 3); tot.add(finalStatus).size(Scl.scl(modUiScale) * 3 * 8f);
if(!mobile){ if(!mobile){
HandCursorListener listener = new HandCursorListener(); HandCursorListener listener = new HandCursorListener();
finalStatus.addListener(listener); finalStatus.addListener(listener);
finalStatus.update(() -> finalStatus.color.lerp(!listener.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta))); finalStatus.update(() -> finalStatus.color.lerp(!listener.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)));
} }
tot.add("[stat]" + group.effect.localizedName); tot.add("[stat]" + group.effect.localizedName);
}).size(iconMed); }).size(iconMed * Scl.scl(modUiScale));
to.row(); to.row();
} }
if(group.items != null) { if(group.items != null) {
@@ -883,14 +893,14 @@ public class HudUi {
tot.left(); tot.left();
ItemStack stack = group.items; ItemStack stack = group.items;
tot.add(bundle.get("shar-stat.waveItem")); tot.add(bundle.get("shar-stat.waveItem"));
tot.add(new ItemImage(stack)).size(8 * 3); tot.add(new ItemImage(stack)).size(Scl.scl(modUiScale) * 3 * 8f);
if(!mobile){ if(!mobile){
HandCursorListener listener = new HandCursorListener(); HandCursorListener listener = new HandCursorListener();
tot.addListener(listener); tot.addListener(listener);
tot.update(() -> tot.color.lerp(!listener.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta))); tot.update(() -> tot.color.lerp(!listener.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)));
} }
tot.add("[stat]" + stack.item.localizedName); tot.add("[stat]" + stack.item.localizedName);
}).size(iconMed); }).size(iconMed * Scl.scl(modUiScale));
to.row(); to.row();
} }
}))); })));
@@ -922,8 +932,8 @@ public class HudUi {
wavePane.setWidget(new Table(tx -> tx.table(this::setWave).left())); wavePane.setWidget(new Table(tx -> tx.table(this::setWave).left()));
waveTable = new Table(table -> { waveTable = new Table(table -> {
table.add(new Table(Tex.button, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
t.add(wavePane).maxHeight(Scl.scl(32 * 8f)); t.add(wavePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
}){ }){
@Override @Override
protected void drawBackground(float x, float y) { protected void drawBackground(float x, float y) {
@@ -932,7 +942,7 @@ public class HudUi {
getBackground().draw(x, y, width, height); getBackground().draw(x, y, width, height);
Draw.reset(); Draw.reset();
} }
}).padRight(Scl.scl(39 * 8f)); }).padRight(Scl.scl(modUiScale) * 39 * 8f);
table.fillParent = true; table.fillParent = true;
table.visibility = () -> uiIndex == 1; table.visibility = () -> uiIndex == 1;
@@ -950,7 +960,9 @@ public class HudUi {
int finalI = i; int finalI = i;
t.table(Tex.underline2, head -> { t.table(Tex.underline2, head -> {
head.center(); head.center();
head.label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]"); Label label = new Label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
head.add(label);
}); });
t.row(); t.row();
for(int r = 0; r < coreamount; r++) { for(int r = 0; r < coreamount; r++) {
@@ -974,18 +986,25 @@ public class HudUi {
image.addListener(listener1); image.addListener(listener1);
image.update(() -> image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta))); image.update(() -> image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)));
} }
image.addListener(new Tooltip(t -> t.background(Tex.button).label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")"))); image.addListener(new Tooltip(t -> {
s.add(image).size(iconLarge).scaling(Scaling.fit);
Label label = new Label(() -> "([#" + Tmp.c1.set(Color.green).lerp(Color.red, 1 - core.healthf()).toString() + "]" + Strings.fixed(core.health, 2) + "[]/" + Strings.fixed(core.block.health, 2) + ")");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
t.background(Tex.button).add(label);
}));
s.add(image).size(iconLarge * Scl.scl(modUiScale < 1 ? modUiScale : 1));
})); }));
add(new Table(s -> { add(new Table(s -> {
s.bottom().defaults().growX().height(Scl.scl(9)).pad(4); s.bottom().defaults().growX().height(Scl.scl(modUiScale) * 9f).pad(4 * Scl.scl(modUiScale));
s.add(new Bar(() -> "", () -> Pal.health, core::healthf)); s.add(new Bar(() -> "", () -> Pal.health, core::healthf));
s.pack(); s.pack();
})); }));
}}); }});
tt.row(); tt.row();
tt.label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")"); Label label = new Label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
tt.add(label);
}); });
} }
t.row(); t.row();
@@ -1012,8 +1031,8 @@ public class HudUi {
coreTable = new Table(table -> { coreTable = new Table(table -> {
table.add(new Table(Tex.button, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
t.add(corePane).maxHeight(Scl.scl(32 * 8f)); t.add(corePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
}){ }){
@Override @Override
protected void drawBackground(float x, float y) { protected void drawBackground(float x, float y) {
@@ -1022,7 +1041,7 @@ public class HudUi {
getBackground().draw(x, y, width, height); getBackground().draw(x, y, width, height);
Draw.reset(); Draw.reset();
} }
}).padRight(Scl.scl(39 * 8f)); }).padRight(Scl.scl(modUiScale) * 39 * 8f);
table.fillParent = true; table.fillParent = true;
table.visibility = () -> uiIndex == 2; table.visibility = () -> uiIndex == 2;
@@ -1040,7 +1059,9 @@ public class HudUi {
if(tile.overlay().uiIcon != atlas.find("error")) image.image(tile.overlay().uiIcon); if(tile.overlay().uiIcon != atlas.find("error")) image.image(tile.overlay().uiIcon);
if(tile.block().uiIcon != atlas.find("error")) image.image(tile.block().uiIcon); if(tile.block().uiIcon != atlas.find("error")) image.image(tile.block().uiIcon);
}); });
head.label(() -> tile == null ? "(null, null)" : "(" + tile.x + ", " + tile.y + ")").center(); Label label = new Label(() -> tile == null ? "(null, null)" : "(" + tile.x + ", " + tile.y + ")");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
head.add(label).center();
}); });
}); });
} }
@@ -1064,8 +1085,8 @@ public class HudUi {
tilePane.setOverscroll(false, false); tilePane.setOverscroll(false, false);
tileTable = new Table(table -> { tileTable = new Table(table -> {
table.add(new Table(Tex.button, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
t.add(tilePane).maxHeight(Scl.scl(32 * 8f)); t.add(tilePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
}){ }){
@Override @Override
protected void drawBackground(float x, float y) { protected void drawBackground(float x, float y) {
@@ -1074,7 +1095,7 @@ public class HudUi {
getBackground().draw(x, y, width, height); getBackground().draw(x, y, width, height);
Draw.reset(); Draw.reset();
} }
}).padRight(Scl.scl(39 * 8f)); }).padRight(Scl.scl(modUiScale) * 39 * 8f);
table.fillParent = true; table.fillParent = true;
table.visibility = () -> uiIndex == 3; table.visibility = () -> uiIndex == 3;
@@ -1086,7 +1107,9 @@ public class HudUi {
for(int i = 0; i < coreItems.tables.size; i++){ for(int i = 0; i < coreItems.tables.size; i++){
if((state.rules.pvp && coreItems.teams[i] != player.team()) || coreItems.teams[i].cores().isEmpty()) continue; if((state.rules.pvp && coreItems.teams[i] != player.team()) || coreItems.teams[i].cores().isEmpty()) continue;
int finalI = i; int finalI = i;
t.background(Tex.underline2).label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]").center(); Label label = new Label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]");
if(modUiScale < 1) label.setFontScale(Scl.scl(modUiScale));
t.background(Tex.underline2).add(label).center();
t.row(); t.row();
t.add(coreItems.tables.get(finalI)).left(); t.add(coreItems.tables.get(finalI)).left();
t.row(); t.row();
@@ -1113,8 +1136,8 @@ public class HudUi {
tilePane.setOverscroll(false, false); tilePane.setOverscroll(false, false);
itemTable = new Table(table -> { itemTable = new Table(table -> {
table.add(new Table(Tex.button, t -> { table.add(new Table(Tex.button, t -> {
t.defaults().minWidth(Scl.scl(25 * 8f)).scaling(Scaling.fit).left(); t.defaults().minWidth(Scl.scl(modUiScale) * 25 * 8f).left();
t.add(tilePane).maxHeight(Scl.scl(32 * 8f)); t.add(tilePane).maxHeight(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
}){ }){
@Override @Override
protected void drawBackground(float x, float y) { protected void drawBackground(float x, float y) {
@@ -1123,7 +1146,7 @@ public class HudUi {
getBackground().draw(x, y, width, height); getBackground().draw(x, y, width, height);
Draw.reset(); Draw.reset();
} }
}).padRight(Scl.scl(39 * 8f)); }).padRight(Scl.scl(modUiScale) * 39 * 8f);
table.fillParent = true; table.fillParent = true;
table.visibility = () -> uiIndex == 4; table.visibility = () -> uiIndex == 4;

View File

@@ -114,7 +114,7 @@ public class Main extends Mod {
if(player.dst(e) <= max || (control.input.block != null && dst <= max)) { if(player.dst(e) <= max || (control.input.block != null && dst <= max)) {
if(canHit || settings.getBool("allTargetRange")){ if(canHit || settings.getBool("allTargetRange")){
if(settings.getBool("softRangeDrawing")){ if(settings.getBool("softRangeDrawing")){
Lines.stroke(1, Tmp.c1.set(canHit ? e.team.color : Team.derelict.color).a(0.5f)); Lines.stroke(Scl.scl(), Tmp.c1.set(canHit ? e.team.color : Team.derelict.color).a(0.5f));
Lines.poly(e.x, e.y, Lines.circleVertices(range), range); Lines.poly(e.x, e.y, Lines.circleVertices(range), range);
Fill.light(e.x, e.y, Lines.circleVertices(range), range, Color.clear, Tmp.c1.a(Mathf.clamp(1-((control.input.block != null && dst <= max ? dst : player.dst(e))/max), 0, settings.getInt("softRangeOpacity")/100f))); Fill.light(e.x, e.y, Lines.circleVertices(range), range, Color.clear, Tmp.c1.a(Mathf.clamp(1-((control.input.block != null && dst <= max ? dst : player.dst(e))/max), 0, settings.getInt("softRangeOpacity")/100f)));
} }
@@ -136,7 +136,7 @@ public class Main extends Mod {
if(Vars.player.dst(u) <= max) { // TODO: Store value of rangeRadius as an int, should increase performance if(Vars.player.dst(u) <= max) { // TODO: Store value of rangeRadius as an int, should increase performance
if (canHit || settings.getBool("allTargetRange")) // Same as above if (canHit || settings.getBool("allTargetRange")) // Same as above
if(settings.getBool("softRangeDrawing")){ if(settings.getBool("softRangeDrawing")){
Lines.stroke(1, Tmp.c1.set(canHit ? u.team.color : Team.derelict.color).a(0.5f)); Lines.stroke(Scl.scl(), Tmp.c1.set(canHit ? u.team.color : Team.derelict.color).a(0.5f));
Lines.poly(u.x, u.y, Lines.circleVertices(range), range); Lines.poly(u.x, u.y, Lines.circleVertices(range), range);
Fill.light(u.x, u.y, Lines.circleVertices(range), range, Color.clear, Tmp.c1.a(Math.min(settings.getInt("softRangeOpacity")/100f, 1-Vars.player.dst(u)/max))); Fill.light(u.x, u.y, Lines.circleVertices(range), range, Color.clear, Tmp.c1.a(Math.min(settings.getInt("softRangeOpacity")/100f, 1-Vars.player.dst(u)/max)));
} }

View File

@@ -289,6 +289,7 @@ public class SettingS {
addGraphicDialogSetting("opacitysetting", opacitySeq, opacityTable); addGraphicDialogSetting("opacitysetting", opacitySeq, opacityTable);
*/ */
addGraphicSlideSetting("infoUiScale", 100, 25, 300, 25, s -> s + "%");
addGraphicCheckSetting("pastwave", false); addGraphicCheckSetting("pastwave", false);
addGraphicCheckSetting("emptywave", true); addGraphicCheckSetting("emptywave", true);
addGraphicSlideSetting("wavemax", 50, 0, 200, 1, s -> s + "waves"); addGraphicSlideSetting("wavemax", 50, 0, 200, 1, s -> s + "waves");

View File

@@ -12,6 +12,7 @@ import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
import static UnitInfo.SVars.modUiScale;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class CoresItemsDisplay { public class CoresItemsDisplay {
@@ -95,8 +96,10 @@ public class CoresItemsDisplay {
if(usedItems.get(team).contains(item)){ if(usedItems.get(team).contains(item)){
itemTable.add(new Stack(){{ itemTable.add(new Stack(){{
add(new Table(tt -> { add(new Table(tt -> {
tt.image(item.uiIcon).size(iconSmall).tooltip(ttt -> ttt.background(Styles.black6).margin(2f).add(item.localizedName).style(Styles.outlineLabel)); tt.image(item.uiIcon).size(iconSmall * Scl.scl(modUiScale < 1 ? modUiScale : 1)).tooltip(ttt -> ttt.background(Styles.black6).margin(2f * Scl.scl(modUiScale)).add(item.localizedName).style(Styles.outlineLabel));
tt.label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item))).minWidth(5 * 8f).left(); Label label = new Label(() -> core == null ? "0" : UI.formatAmount(core.items.get(item)));
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1));
tt.add(label).minWidth(5 * 8f * Scl.scl(modUiScale)).left();
})); }));
add(new Table(tt -> { add(new Table(tt -> {
tt.bottom().right(); tt.bottom().right();
@@ -104,11 +107,11 @@ public class CoresItemsDisplay {
int amount = updateItems.get(team).get(item.id).amount; int amount = updateItems.get(team).get(item.id).amount;
return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]"; return (amount > 0 ? "[green]+" : amount == 0 ? "[orange]" : "[red]") + amount + "[]";
}); });
label.setFontScale(0.65f); label.setFontScale(0.65f * Scl.scl(modUiScale < 1 ? modUiScale : 1));
tt.add(label).bottom().right().padTop(16f); tt.add(label).bottom().right().padTop(16f * Scl.scl(modUiScale));
tt.pack(); tt.pack();
})); }));
}}).padRight(3).left(); }}).padRight(3 * Scl.scl(modUiScale)).left();
if(++i[0] % 5 == 0) itemTable.row(); if(++i[0] % 5 == 0) itemTable.row();
} }
} }
@@ -119,8 +122,11 @@ public class CoresItemsDisplay {
unitTable.center(); unitTable.center();
for(UnitType unit : content.units()){ for(UnitType unit : content.units()){
if(unit != UnitTypes.block && usedUnits.get(team).contains(unit)){ if(unit != UnitTypes.block && usedUnits.get(team).contains(unit)){
unitTable.image(unit.uiIcon).size(iconSmall).padRight(3).tooltip(tt -> tt.background(Styles.black6).margin(2f).add(unit.localizedName).style(Styles.outlineLabel)); unitTable.image(unit.uiIcon).size(iconSmall * Scl.scl(modUiScale < 1 ? modUiScale : 1)).padRight(3 * Scl.scl(modUiScale)).tooltip(tt -> tt.background(Styles.black6).margin(2f * Scl.scl(modUiScale)).add(unit.localizedName).style(Styles.outlineLabel));
unitTable.label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit))).padRight(3).minWidth(5 * 8f).left(); Label label = new Label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit)));
label.setFontScale(Scl.scl(modUiScale < 1 ? modUiScale : 1));
unitTable.add(label).padRight(3 * Scl.scl(modUiScale)).minWidth(5 * 8f * Scl.scl(modUiScale)).left();
if(++i[0] % 5 == 0) unitTable.row(); if(++i[0] % 5 == 0) unitTable.row();
} }
} }

View File

@@ -8,11 +8,17 @@ import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.scene.*; import arc.scene.*;
import arc.scene.style.*; import arc.scene.style.*;
import arc.scene.ui.Label;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.util.Align;
import arc.util.Strings;
import arc.util.pooling.*; import arc.util.pooling.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.ui.*; import mindustry.ui.*;
import static UnitInfo.SVars.modUiScale;
import static mindustry.Vars.player;
public class SBar extends Element{ public class SBar extends Element{
static final Rect scissor = new Rect(); static final Rect scissor = new Rect();
@@ -52,7 +58,7 @@ public class SBar extends Element{
NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]); NinePatch patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
int[] pads = region.pads; int[] pads = region.pads;
if(pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]); if(pads != null) patch.setPadding(pads[0], pads[1], pads[2], pads[3]);
out = new ScaledNinePatchDrawable(patch, 1f); out = new ScaledNinePatchDrawable(patch, Scl.scl());
return out; return out;
} }
@@ -144,17 +150,15 @@ public class SBar extends Element{
ScissorStack.pop(); ScissorStack.pop();
} }
} }
Draw.color(); Draw.color();
Fonts.outline.draw(name, x + width / 2f, y + height / 2f, Color.white, Scl.scl(modUiScale < 1 ? modUiScale : 1), false, Align.center);
Font font = Fonts.outline; Font font = Fonts.outline;
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
font.getData().setScale(Scl.scl());
lay.setText(font, name); lay.setText(font, name);
font.setColor(Color.white);
font.draw(name, x + width / 2f - lay.width / 2f, y + height / 2f + lay.height / 2f + 1);
font.getData().setScale(Scl.scl());
Pools.free(lay); Pools.free(lay);
Draw.reset();
} }
} }