mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
better ui
This commit is contained in:
@@ -106,9 +106,6 @@ public class SettingS {
|
|||||||
Seq<Seq<SharSetting>> settingSeq = new Seq<>();
|
Seq<Seq<SharSetting>> settingSeq = new Seq<>();
|
||||||
Seq<SharSetting> tapSeq = new Seq<>();
|
Seq<SharSetting> tapSeq = new Seq<>();
|
||||||
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? bundle.get("default-bar") : s + bundle.get("th-bar"), tapSeq);
|
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? bundle.get("default-bar") : s + bundle.get("th-bar"), tapSeq);
|
||||||
addGraphicTypeSetting("wavemax", 0, 200,100, true, () -> true, s -> s + "waves", tapSeq);
|
|
||||||
addGraphicCheckSetting("pastwave", false, tapSeq);
|
|
||||||
addGraphicCheckSetting("emptywave", true, tapSeq);
|
|
||||||
addGraphicCheckSetting("schem", !mobile, tapSeq);
|
addGraphicCheckSetting("schem", !mobile, tapSeq);
|
||||||
|
|
||||||
//TODO: remove all drawing settings
|
//TODO: remove all drawing settings
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
package unitinfo.ui.windows;
|
package unitinfo.ui.windows;
|
||||||
|
|
||||||
import arc.Events;
|
import arc.Events;
|
||||||
import arc.graphics.g2d.Draw;
|
import arc.graphics.g2d.*;
|
||||||
import arc.graphics.g2d.Lines;
|
|
||||||
import arc.math.geom.Bresenham2;
|
|
||||||
import arc.math.geom.Geometry;
|
import arc.math.geom.Geometry;
|
||||||
import arc.math.geom.Point2;
|
|
||||||
import arc.scene.Element;
|
|
||||||
import arc.scene.event.InputEvent;
|
|
||||||
import arc.scene.event.InputListener;
|
|
||||||
import mindustry.editor.MapEditor;
|
import mindustry.editor.MapEditor;
|
||||||
import mindustry.game.EventType;
|
import mindustry.game.EventType;
|
||||||
import mindustry.graphics.Layer;
|
import mindustry.graphics.Layer;
|
||||||
@@ -176,7 +170,7 @@ public class MapEditorDisplay extends Window implements Updatable {
|
|||||||
tools.top().left();
|
tools.top().left();
|
||||||
tools.table(title -> title.left().background(Tex.underline2).add("Tools [accent]"+(tool==null?"":tool.name())+"[]")).growX().row();
|
tools.table(title -> title.left().background(Tex.underline2).add("Tools [accent]"+(tool==null?"":tool.name())+"[]")).growX().row();
|
||||||
tools.table(bt->{
|
tools.table(bt->{
|
||||||
Cons<unitinfo.ui.EditorTool> addTool = tool -> {
|
Cons<EditorTool> addTool = tool -> {
|
||||||
ImageButton button = new ImageButton(ui.getIcon(tool.name()), Styles.clearTogglei);
|
ImageButton button = new ImageButton(ui.getIcon(tool.name()), Styles.clearTogglei);
|
||||||
button.clicked(() -> {
|
button.clicked(() -> {
|
||||||
button.toggle();
|
button.toggle();
|
||||||
@@ -195,11 +189,11 @@ public class MapEditorDisplay extends Window implements Updatable {
|
|||||||
bt.stack(button, mode);
|
bt.stack(button, mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
addTool.get(unitinfo.ui.EditorTool.line);
|
addTool.get(EditorTool.line);
|
||||||
addTool.get(unitinfo.ui.EditorTool.pencil);
|
addTool.get(EditorTool.pencil);
|
||||||
addTool.get(unitinfo.ui.EditorTool.eraser);
|
addTool.get(EditorTool.eraser);
|
||||||
addTool.get(unitinfo.ui.EditorTool.fill);
|
addTool.get(EditorTool.fill);
|
||||||
addTool.get(unitinfo.ui.EditorTool.spray);
|
addTool.get(EditorTool.spray);
|
||||||
|
|
||||||
ImageButton grid = new ImageButton(Icon.grid, Styles.clearTogglei);
|
ImageButton grid = new ImageButton(Icon.grid, Styles.clearTogglei);
|
||||||
grid.clicked(() -> {
|
grid.clicked(() -> {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class UnitDisplay extends Window {
|
|||||||
to.label(() -> target == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(target.x() / tilesize, 2) + ", " + Strings.fixed(target.y() / tilesize, 2) + ")").row();
|
to.label(() -> target == null ? "(" + 0 + ", " + 0 + ")" : "(" + Strings.fixed(target.x() / tilesize, 2) + ", " + Strings.fixed(target.y() / tilesize, 2) + ")").row();
|
||||||
to.label(() -> target instanceof Unit u ? "[accent]"+ Strings.fixed(u.armor, 0) + "[] Armor" : "");
|
to.label(() -> target instanceof Unit u ? "[accent]"+ Strings.fixed(u.armor, 0) + "[] Armor" : "");
|
||||||
})).margin(12f).row();
|
})).margin(12f).row();
|
||||||
table.image().height(4f).color(player.team().color).growX().row();
|
table.image().height(4f).color((target==null?player.unit():target).team().color).growX().row();
|
||||||
table.add(new OverScrollPane(new Table(bars -> {
|
table.add(new OverScrollPane(new Table(bars -> {
|
||||||
bars.top();
|
bars.top();
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package unitinfo.ui.windows;
|
package unitinfo.ui.windows;
|
||||||
|
|
||||||
|
import mindustry.Vars;
|
||||||
import mindustry.game.Team;
|
import mindustry.game.Team;
|
||||||
|
import mindustry.type.UnitType;
|
||||||
import unitinfo.ui.OverScrollPane;
|
import unitinfo.ui.OverScrollPane;
|
||||||
import arc.Events;
|
import arc.Events;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
@@ -38,9 +40,54 @@ public class WaveDisplay extends Window implements Updatable {
|
|||||||
window = table;
|
window = table;
|
||||||
|
|
||||||
table.top().background(Styles.black8);
|
table.top().background(Styles.black8);
|
||||||
|
|
||||||
ScrollPane pane = new OverScrollPane(rebuild(), Styles.nonePane, scrollPos).disableScroll(true, false);
|
ScrollPane pane = new OverScrollPane(rebuild(), Styles.nonePane, scrollPos).disableScroll(true, false);
|
||||||
table.add(pane).grow().name("wave-pane");
|
table.add(pane).grow().name("wave-pane").row();
|
||||||
|
table.table(total -> {
|
||||||
|
total.left();
|
||||||
|
|
||||||
|
total.field("~"+state.wave+" + "+settings.getInt("wavemax"), f->{
|
||||||
|
String str = f.replaceAll("\\D", "");
|
||||||
|
if(str.isEmpty()) settings.put("wavemax", 0);
|
||||||
|
else settings.put("wavemax", Integer.parseInt(str));
|
||||||
|
});
|
||||||
|
total.table().update(units->{
|
||||||
|
units.clear();
|
||||||
|
units.center();
|
||||||
|
|
||||||
|
if(Groups.unit.count(u->u.team==state.rules.waveTeam) <= 0) {
|
||||||
|
units.add("[lightgray]<Empty>[]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int row = 0;
|
||||||
|
int max = Math.max(1, Math.round(window.getWidth()/2/8/2));
|
||||||
|
for (UnitType unit : Vars.content.units()) {
|
||||||
|
int amount = Groups.unit.count(u->u.type==unit&&u.team==state.rules.waveTeam);
|
||||||
|
if(amount<=0) continue;
|
||||||
|
units.stack(
|
||||||
|
new Table(ttt -> {
|
||||||
|
ttt.center();
|
||||||
|
ttt.image(unit.uiIcon).size(iconMed);
|
||||||
|
ttt.pack();
|
||||||
|
}),
|
||||||
|
|
||||||
|
new Table(ttt -> {
|
||||||
|
ttt.bottom().left();
|
||||||
|
ttt.add(amount + "").padTop(2f).fontScale(0.9f);
|
||||||
|
ttt.pack();
|
||||||
|
})
|
||||||
|
).pad(2f);
|
||||||
|
if(row++ % max == max-1){
|
||||||
|
units.row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).growX();
|
||||||
|
}).growX().row();
|
||||||
|
table.image().height(4f).color(Pal.gray).growX().row();
|
||||||
|
table.table(option->{
|
||||||
|
option.check("Show empty wave", settings.getBool("emptywave"), b->settings.put("emptywave", b)).margin(4f);
|
||||||
|
option.check("Show previous wave", settings.getBool("pastwave"), b->settings.put("pastwave", b)).margin(4f);
|
||||||
|
});
|
||||||
Events.on(EventType.WorldLoadEvent.class, e -> {
|
Events.on(EventType.WorldLoadEvent.class, e -> {
|
||||||
pane.clearChildren();
|
pane.clearChildren();
|
||||||
pane.setWidget(rebuild());
|
pane.setWidget(rebuild());
|
||||||
@@ -90,6 +137,8 @@ public class WaveDisplay extends Window implements Updatable {
|
|||||||
for (int i = settings.getBool("pastwave") ? 1 : state.wave; i <= Math.min(state.wave + settings.getInt("wavemax"), (state.isCampaign() && state.rules.winWave > 0 ? state.rules.winWave : Integer.MAX_VALUE)); i++) {
|
for (int i = settings.getBool("pastwave") ? 1 : state.wave; i <= Math.min(state.wave + settings.getInt("wavemax"), (state.isCampaign() && state.rules.winWave > 0 ? state.rules.winWave : Integer.MAX_VALUE)); i++) {
|
||||||
final int index = i;
|
final int index = i;
|
||||||
|
|
||||||
|
if (state.rules.spawns.find(g -> g.getSpawned(index-1) > 0) == null && !settings.getBool("emptywave")) continue;
|
||||||
|
|
||||||
body.table(waveRow -> {
|
body.table(waveRow -> {
|
||||||
waveRow.left();
|
waveRow.left();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user