Merge branch 'logic-editor-autowrap'

# Conflicts:
#	core/src/mindustry/logic/LStatements.java
This commit is contained in:
Anuken
2026-09-09 12:45:27 -04:00
35 changed files with 398 additions and 594 deletions
+15 -14
View File
@@ -3202,8 +3202,8 @@ cutsceneaction.label.pan = pan
cutsceneaction.label.zoom = zoom
cutsceneaction.label.stop = stop
cutsceneaction.label.shake = shake
cutsceneaction.label.gethud = get Hud
cutsceneaction.label.sethud = set Hud
cutsceneaction.label.gethud = get HUD
cutsceneaction.label.sethud = set HUD
fetchtype.label.unit = unit
fetchtype.label.player = player
fetchtype.label.core = core
@@ -3386,7 +3386,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
@@ -3410,7 +3410,7 @@ tilelayer.label.ore = ore
tilelayer.label.block = block
tilelayer.label.building = building
name.token.Jump = jump
name.token.jump = Jump
name.token.color = color
name.token.width = width
name.token.height = height
@@ -3483,6 +3483,7 @@ name.token.natural = natural
name.token.speed = speed
name.token.level = level
name.token.duration = duration
name.token.seconds = seconds
name.token.shown = shown
name.token.data = data
name.token.effect = effect
@@ -3494,7 +3495,7 @@ name.token.volume = volume
name.token.pitch = pitch
name.token.pan = pan
name.token.limit = limit
name.token.of-id- = of id\#
name.token.id = id \#
name.token.replace = replace?
name.token.for = for
name.token.success = success
@@ -3578,13 +3579,13 @@ name.token.wave = wave
name.token.bubble = bubble
name.token.music = music
name.token.interrupt = interrupt
name.token.all = All
name.token.beams = Beams
name.token.block = Block
name.token.charge = Charge
name.token.environment = Environment
name.token.explosions = Explosions
name.token.loops = Loops
name.token.movement = Movement
name.token.shoot = Shoot
name.token.all = all
name.token.beams = beams
name.token.block = block
name.token.charge = charge
name.token.environment = environment
name.token.explosions = explosions
name.token.loops = loops
name.token.movement = movement
name.token.shoot = shoot
name.token.ui = UI
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+1 -1
View File
@@ -3381,7 +3381,7 @@ lunitcontrol.label.build = build block
lunitcontrol.label.getblock = get block
lunitcontrol.label.deconstruct = deconstruct
lunitcontrol.label.within = within?
lunitcontrol.label.boost = boost?
lunitcontrol.label.boost = boost
messagetype.label.notify = notify
messagetype.label.announce = announce
messagetype.label.toast = toast
+15 -8
View File
@@ -60,10 +60,14 @@ public class LCanvas extends Table{
}
/** @return if statement elements should have rows. */
public static boolean useRows(){
public static boolean isCompact(){
return Core.graphics.getWidth() < Scl.scl(900f) * 1.2f;
}
public static float getTargetWidth(){
return isCompact() ? 410f : Mathf.clamp(Core.graphics.getWidth() / Scl.scl(1f) * 0.95f - Scl.scl(80f), 400f, 1200f);
}
public static void tooltip(Cell<?> cell, String key){
String lkey = key.toLowerCase().replace(" ", "");
if(Core.bundle.has(lkey)){
@@ -101,7 +105,7 @@ public class LCanvas extends Table{
}
public void rebuild(){
targetWidth = useRows() ? 400f : 900f;
targetWidth = getTargetWidth();
float s = pane != null ? pane.getVisualScrollY() : 0f;
String toLoad = statements != null ? save() : null;
@@ -492,12 +496,15 @@ public class LCanvas extends Table{
row();
table(t -> {
t.left();
t.marginLeft(4);
t.setColor(color);
st.build(t);
}).pad(4).padTop(2).left().grow();
Table t = st.useWrapping() ? new WrapTable() : new Table();
t.left();
t.marginLeft(4);
t.setColor(color);
if(st.useWrapping()) t.marginRight(4f);
st.build(t);
add(t).pad(4).padTop(2).left().grow();
marginBottom(7);
}
+24 -22
View File
@@ -62,6 +62,10 @@ public abstract class LStatement{
return read.size == 0 ? null : read.first();
}
public boolean useWrapping(){
return true;
}
public boolean hidden(){
return false;
}
@@ -181,24 +185,32 @@ public abstract class LStatement{
protected Cell<TextField> field(Table table, String value, Cons<String> setter){
return table.field(value, Styles.nodeField, s -> setter.get(sanitize(s)))
.size(144f, 40f).pad(2f).color(table.color);
.size(180f, 40f).pad(2f).color(table.color);
}
protected Cell<TextField> fields(Table table, String desc, String value, Cons<String> setter){
table.add(desc).padLeft(10).left().self(this::param);
return field(table, value, setter).width(85f).padRight(10).left();
return fields(table, desc, LCanvas.isCompact(), value, setter);
}
/** Puts the text and field in one table, taking up one cell. */
protected Cell<TextField> fieldst(Table table, String desc, String value, Cons<String> setter){
Cell[] result = {null};
table.table(t -> {
t.setColor(table.color);
t.add(desc).padLeft(10).left().self(this::param);
result[0] = field(t, value, setter).width(85f).padRight(10).left();
});
protected Cell<TextField> fields(Table table, String value, Cons<String> setter){
return field(table, value, setter).width(180f);
}
return result[0];
protected Cell<TextField> fields(Table table, String desc, boolean nameAfterField, String value, Cons<String> setter){
Table sub = new Table();
sub.setColor(table.color);
table.add(sub);
float width = 180f;
String text = bundle(desc);
if(nameAfterField){
var result = field(sub, value, setter).width(width).padRight(4f).left();
sub.add(text).padRight(12f).self(this::param);
return result;
}else{
sub.add(text).padLeft(10).self(this::param);
return field(sub, value, setter).width(width).padRight(10).left();
}
}
/** Adds color edit button */
@@ -218,16 +230,6 @@ public abstract class LStatement{
}, Styles.logict, () -> {}).size(40f).padLeft(-11).color(table.color);
}
protected Cell<TextField> fields(Table table, String value, Cons<String> setter){
return field(table, value, setter).width(85f);
}
protected void row(Table table){
if(LCanvas.useRows()){
table.row();
}
}
protected <T> void showSelect(Button b, T[] values, T current, Cons<T> getter, int cols, Cons<Cell> sizer){
showSelectTable(b, (t, hide) -> {
ButtonGroup<Button> group = new ButtonGroup<>();
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -45,16 +45,16 @@ public class LogicDialog extends BaseDialog{
shown(this::setup);
shown(() -> {
wasRows = LCanvas.useRows();
wasRows = LCanvas.isCompact();
wasPortrait = Core.graphics.isPortrait();
});
hidden(() -> consumer.get(canvas.save()));
onResize(() -> {
if(wasRows != LCanvas.useRows() || wasPortrait != Core.graphics.isPortrait()){
if(wasRows != LCanvas.isCompact() || wasPortrait != Core.graphics.isPortrait()){
setup();
canvas.rebuild();
wasPortrait = Core.graphics.isPortrait();
wasRows = LCanvas.useRows();
wasRows = LCanvas.isCompact();
}
});