mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-10 12:09:27 +02:00
code cleanup with refactoring
This commit is contained in:
@@ -36,11 +36,12 @@ public class Main extends Mod {
|
||||
for (Window window : windows) {
|
||||
if(window instanceof Updatable u) u.update();
|
||||
}
|
||||
|
||||
if((input.keyDown(KeyCode.shiftRight) || input.keyDown(KeyCode.shiftLeft))) {
|
||||
if(input.keyTap(KeyCode.r)) {
|
||||
if(target==getTarget()) locked = !locked;
|
||||
target = getTarget();
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.Pal;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.Block;
|
||||
import mindustry.world.Tile;
|
||||
import mindustry.world.blocks.environment.Floor;
|
||||
|
||||
import static unitinfo.SUtils.*;
|
||||
import static unitinfo.SVars.*;
|
||||
@@ -20,11 +23,33 @@ public class WaveInfoDisplay {
|
||||
table.table(head -> {
|
||||
head.table(image -> {
|
||||
image.left();
|
||||
image.image(() -> getTile() == null || getTile().floor().uiIcon == error ? clear : getTile().floor().uiIcon).size(iconSmall);
|
||||
image.image(() -> getTile() == null || getTile().overlay().uiIcon == error ? clear : getTile().overlay().uiIcon).size(iconSmall);
|
||||
image.image(() -> getTile() == null || getTile().block().uiIcon == error ? clear : getTile().block().uiIcon).size(iconSmall);
|
||||
image.image(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return clear;
|
||||
Floor floor = tile.floor();
|
||||
if(floor.uiIcon == error) return clear;
|
||||
return floor.uiIcon;
|
||||
}).size(iconSmall);
|
||||
image.image(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return clear;
|
||||
Floor floor = tile.overlay();
|
||||
if(floor.uiIcon == error) return clear;
|
||||
return floor.uiIcon;
|
||||
}).size(iconSmall);
|
||||
image.image(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return clear;
|
||||
Block floor = tile.block();
|
||||
if(floor.uiIcon == error) return clear;
|
||||
return floor.uiIcon;
|
||||
}).size(iconSmall);
|
||||
});
|
||||
head.label(() -> Strings.format("(@, @)", getTile() == null ? "NaN" : getTile().x, getTile() == null ? "NaN" : getTile().y)).center();
|
||||
head.label(() -> {
|
||||
Tile tile = getTile();
|
||||
if(tile == null) return "(NaN, NaN)";
|
||||
return Strings.format("(@, @)", tile.x, tile.y);
|
||||
}).center();
|
||||
});
|
||||
table.row();
|
||||
table.image().height(4f).color(Pal.gray).growX().row();
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package unitinfo.ui.windows;
|
||||
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public class Windows {
|
||||
public static MapEditorWindow editorTable;
|
||||
|
||||
@@ -13,12 +10,5 @@ public class Windows {
|
||||
new PlayerWindow();
|
||||
new ToolWindow();
|
||||
editorTable = new MapEditorWindow();
|
||||
new Window(Icon.box, "test-window", t -> {
|
||||
t.labelWrap(() -> t.parent.x + ", " + t.parent.y).top().right().growX();
|
||||
t.row();
|
||||
t.labelWrap(() -> t.parent.getWidth() + ", " + t.parent.getHeight()).top().right().growX();
|
||||
t.row();
|
||||
t.labelWrap(() -> "T: " + Time.time).top().right().growX();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user