mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-14 01:37:36 +07:00
Logic layout bugfixes
This commit is contained in:
BIN
core/assets-raw/sprites/ui/pane-solid.9.png
Normal file
BIN
core/assets-raw/sprites/ui/pane-solid.9.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
@ -62,10 +62,10 @@ public abstract class LStatement{
|
|||||||
showSelectTable(b, (t, hide) -> {
|
showSelectTable(b, (t, hide) -> {
|
||||||
ButtonGroup<Button> group = new ButtonGroup<>();
|
ButtonGroup<Button> group = new ButtonGroup<>();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
t.defaults().size(56f, 40f);
|
t.defaults().size(60f, 38f);
|
||||||
|
|
||||||
for(T p : values){
|
for(T p : values){
|
||||||
sizer.get(t.button(p.toString(), Styles.clearTogglet, () -> {
|
sizer.get(t.button(p.toString(), Styles.logicTogglet, () -> {
|
||||||
getter.get(p);
|
getter.get(p);
|
||||||
hide.run();
|
hide.run();
|
||||||
}).checked(current == p).group(group));
|
}).checked(current == p).group(group));
|
||||||
@ -80,7 +80,18 @@ public abstract class LStatement{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void showSelectTable(Button b, Cons2<Table, Runnable> hideCons){
|
protected void showSelectTable(Button b, Cons2<Table, Runnable> hideCons){
|
||||||
Table t = new Table(Tex.button);
|
Table t = new Table(Tex.paneSolid){
|
||||||
|
@Override
|
||||||
|
public float getPrefHeight(){
|
||||||
|
return Math.min(super.getPrefHeight(), Core.graphics.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getPrefWidth(){
|
||||||
|
return Math.min(super.getPrefWidth(), Core.graphics.getWidth());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.margin(4);
|
||||||
|
|
||||||
//triggers events behind the element to simulate deselection
|
//triggers events behind the element to simulate deselection
|
||||||
Element hitter = new Element();
|
Element hitter = new Element();
|
||||||
@ -110,13 +121,15 @@ public abstract class LStatement{
|
|||||||
if(t.getWidth() > Core.scene.getWidth()) t.setWidth(Core.graphics.getWidth());
|
if(t.getWidth() > Core.scene.getWidth()) t.setWidth(Core.graphics.getWidth());
|
||||||
if(t.getHeight() > Core.scene.getHeight()) t.setHeight(Core.graphics.getHeight());
|
if(t.getHeight() > Core.scene.getHeight()) t.setHeight(Core.graphics.getHeight());
|
||||||
t.keepInStage();
|
t.keepInStage();
|
||||||
|
t.invalidateHierarchy();
|
||||||
|
t.pack();
|
||||||
});
|
});
|
||||||
t.actions(Actions.alpha(0), Actions.fadeIn(0.3f, Interp.fade));
|
t.actions(Actions.alpha(0), Actions.fadeIn(0.3f, Interp.fade));
|
||||||
|
|
||||||
t.top().pane(inner -> {
|
t.top().pane(inner -> {
|
||||||
inner.top();
|
inner.top();
|
||||||
hideCons.get(inner, hide);
|
hideCons.get(inner, hide);
|
||||||
}).top();
|
}).pad(0f).top().get().setScrollingDisabled(true, false);
|
||||||
|
|
||||||
t.pack();
|
t.pack();
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ public class LStatements{
|
|||||||
|
|
||||||
t.parent.parent.pack();
|
t.parent.parent.pack();
|
||||||
t.parent.parent.invalidateHierarchy();
|
t.parent.parent.invalidateHierarchy();
|
||||||
}).size(80f, 50f).growX().checked(selected == fi).group(group);
|
}).height(50f).growX().checked(selected == fi).group(group);
|
||||||
}
|
}
|
||||||
t.row();
|
t.row();
|
||||||
t.add(stack).colspan(3).width(240f).left();
|
t.add(stack).colspan(3).width(240f).left();
|
||||||
@ -610,11 +610,17 @@ public class LStatements{
|
|||||||
|
|
||||||
//"function"-type operations have the name at the left and arguments on the right
|
//"function"-type operations have the name at the left and arguments on the right
|
||||||
if(op.func){
|
if(op.func){
|
||||||
opButton(table);
|
if(LCanvas.useRows()){
|
||||||
|
table.left();
|
||||||
field(table, a, str -> a = str);
|
table.row();
|
||||||
|
table.table(c -> {
|
||||||
field(table, b, str -> b = str);
|
c.color.set(color());
|
||||||
|
c.left();
|
||||||
|
funcs(c);
|
||||||
|
}).colspan(2).left();
|
||||||
|
}else{
|
||||||
|
funcs(table);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
field(table, a, str -> a = str);
|
field(table, a, str -> a = str);
|
||||||
|
|
||||||
@ -625,6 +631,14 @@ public class LStatements{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void funcs(Table table){
|
||||||
|
opButton(table);
|
||||||
|
|
||||||
|
field(table, a, str -> a = str);
|
||||||
|
|
||||||
|
field(table, b, str -> b = str);
|
||||||
|
}
|
||||||
|
|
||||||
void opButton(Table table){
|
void opButton(Table table){
|
||||||
table.button(b -> {
|
table.button(b -> {
|
||||||
b.label(() -> op.symbol);
|
b.label(() -> op.symbol);
|
||||||
@ -632,7 +646,7 @@ public class LStatements{
|
|||||||
op = o;
|
op = o;
|
||||||
rebuild(table);
|
rebuild(table);
|
||||||
}));
|
}));
|
||||||
}, Styles.logict, () -> {}).size(65f, 40f).pad(4f).color(table.color);
|
}, Styles.logict, () -> {}).size(64f, 40f).pad(4f).color(table.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,9 +24,9 @@ import static mindustry.gen.Tex.*;
|
|||||||
@StyleDefaults
|
@StyleDefaults
|
||||||
public class Styles{
|
public class Styles{
|
||||||
//TODO all these names are inconsistent and not descriptive
|
//TODO all these names are inconsistent and not descriptive
|
||||||
public static Drawable black, black9, black8, black6, black3, black5, none, flatDown, flatOver;
|
public static Drawable black, black9, black8, black6, black3, black5, none, flatDown, flatOver, accentDrawable;
|
||||||
public static ButtonStyle defaultb, waveb, modsb;
|
public static ButtonStyle defaultb, waveb, modsb;
|
||||||
public static TextButtonStyle defaultt, squaret, nodet, cleart, discordt, nonet, infot, clearPartialt, clearTogglet, clearToggleMenut, togglet, transt, fullTogglet, logict;
|
public static TextButtonStyle defaultt, squaret, nodet, cleart, discordt, nonet, infot, clearPartialt, clearTogglet, logicTogglet, clearToggleMenut, togglet, transt, fullTogglet, logict;
|
||||||
public static ImageButtonStyle defaulti, nodei, righti, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearPartial2i, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
|
public static ImageButtonStyle defaulti, nodei, righti, emptyi, emptytogglei, selecti, logici, geni, colori, accenti, cleari, clearFulli, clearPartiali, clearPartial2i, clearTogglei, clearTransi, clearToggleTransi, clearTogglePartiali;
|
||||||
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane;
|
public static ScrollPaneStyle defaultPane, horizontalPane, smallPane;
|
||||||
public static KeybindDialogStyle defaultKeybindDialog;
|
public static KeybindDialogStyle defaultKeybindDialog;
|
||||||
@ -46,6 +46,7 @@ public class Styles{
|
|||||||
none = whiteui.tint(0f, 0f, 0f, 0f);
|
none = whiteui.tint(0f, 0f, 0f, 0f);
|
||||||
flatDown = createFlatDown();
|
flatDown = createFlatDown();
|
||||||
flatOver = whiteui.tint(Color.valueOf("454545"));
|
flatOver = whiteui.tint(Color.valueOf("454545"));
|
||||||
|
accentDrawable = whiteui.tint(Pal.accent);
|
||||||
|
|
||||||
defaultb = new ButtonStyle(){{
|
defaultb = new ButtonStyle(){{
|
||||||
down = buttonDown;
|
down = buttonDown;
|
||||||
@ -151,6 +152,16 @@ public class Styles{
|
|||||||
disabled = black;
|
disabled = black;
|
||||||
disabledFontColor = Color.gray;
|
disabledFontColor = Color.gray;
|
||||||
}};
|
}};
|
||||||
|
logicTogglet = new TextButtonStyle(){{
|
||||||
|
font = Fonts.outline;
|
||||||
|
fontColor = Color.white;
|
||||||
|
checked = accentDrawable;
|
||||||
|
down = accentDrawable;
|
||||||
|
up = black;
|
||||||
|
over = flatOver;
|
||||||
|
disabled = black;
|
||||||
|
disabledFontColor = Color.gray;
|
||||||
|
}};
|
||||||
clearToggleMenut = new TextButtonStyle(){{
|
clearToggleMenut = new TextButtonStyle(){{
|
||||||
font = Fonts.def;
|
font = Fonts.def;
|
||||||
fontColor = Color.white;
|
fontColor = Color.white;
|
||||||
|
@ -38,7 +38,7 @@ public class ModsDialog extends BaseDialog{
|
|||||||
|
|
||||||
private String searchtxt = "";
|
private String searchtxt = "";
|
||||||
private @Nullable Seq<ModListing> modList;
|
private @Nullable Seq<ModListing> modList;
|
||||||
private boolean orderDate = true;
|
private boolean orderDate = false;
|
||||||
private BaseDialog currentContent;
|
private BaseDialog currentContent;
|
||||||
|
|
||||||
private BaseDialog browser;
|
private BaseDialog browser;
|
||||||
@ -384,7 +384,7 @@ public class ModsDialog extends BaseDialog{
|
|||||||
|
|
||||||
}).tooltip(c.localizedName);
|
}).tooltip(c.localizedName);
|
||||||
|
|
||||||
if(++i % Math.min(Core.graphics.getWidth() / Scl.scl(70), 14) == 0) cs.row();
|
if(++i % Math.min(Core.graphics.getWidth() / Scl.scl(110), 14) == 0) cs.row();
|
||||||
}
|
}
|
||||||
}).grow();
|
}).grow();
|
||||||
d.addCloseButton();
|
d.addCloseButton();
|
||||||
|
Reference in New Issue
Block a user