mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-10 07:47:25 +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) -> {
|
||||
ButtonGroup<Button> group = new ButtonGroup<>();
|
||||
int i = 0;
|
||||
t.defaults().size(56f, 40f);
|
||||
t.defaults().size(60f, 38f);
|
||||
|
||||
for(T p : values){
|
||||
sizer.get(t.button(p.toString(), Styles.clearTogglet, () -> {
|
||||
sizer.get(t.button(p.toString(), Styles.logicTogglet, () -> {
|
||||
getter.get(p);
|
||||
hide.run();
|
||||
}).checked(current == p).group(group));
|
||||
@ -80,7 +80,18 @@ public abstract class LStatement{
|
||||
}
|
||||
|
||||
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
|
||||
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.getHeight() > Core.scene.getHeight()) t.setHeight(Core.graphics.getHeight());
|
||||
t.keepInStage();
|
||||
t.invalidateHierarchy();
|
||||
t.pack();
|
||||
});
|
||||
t.actions(Actions.alpha(0), Actions.fadeIn(0.3f, Interp.fade));
|
||||
|
||||
t.top().pane(inner -> {
|
||||
inner.top();
|
||||
hideCons.get(inner, hide);
|
||||
}).top();
|
||||
}).pad(0f).top().get().setScrollingDisabled(true, false);
|
||||
|
||||
t.pack();
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ public class LStatements{
|
||||
|
||||
t.parent.parent.pack();
|
||||
t.parent.parent.invalidateHierarchy();
|
||||
}).size(80f, 50f).growX().checked(selected == fi).group(group);
|
||||
}).height(50f).growX().checked(selected == fi).group(group);
|
||||
}
|
||||
t.row();
|
||||
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
|
||||
if(op.func){
|
||||
opButton(table);
|
||||
|
||||
field(table, a, str -> a = str);
|
||||
|
||||
field(table, b, str -> b = str);
|
||||
if(LCanvas.useRows()){
|
||||
table.left();
|
||||
table.row();
|
||||
table.table(c -> {
|
||||
c.color.set(color());
|
||||
c.left();
|
||||
funcs(c);
|
||||
}).colspan(2).left();
|
||||
}else{
|
||||
funcs(table);
|
||||
}
|
||||
}else{
|
||||
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){
|
||||
table.button(b -> {
|
||||
b.label(() -> op.symbol);
|
||||
@ -632,7 +646,7 @@ public class LStatements{
|
||||
op = o;
|
||||
rebuild(table);
|
||||
}));
|
||||
}, Styles.logict, () -> {}).size(65f, 40f).pad(4f).color(table.color);
|
||||
}, Styles.logict, () -> {}).size(64f, 40f).pad(4f).color(table.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,9 +24,9 @@ import static mindustry.gen.Tex.*;
|
||||
@StyleDefaults
|
||||
public class Styles{
|
||||
//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 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 ScrollPaneStyle defaultPane, horizontalPane, smallPane;
|
||||
public static KeybindDialogStyle defaultKeybindDialog;
|
||||
@ -46,6 +46,7 @@ public class Styles{
|
||||
none = whiteui.tint(0f, 0f, 0f, 0f);
|
||||
flatDown = createFlatDown();
|
||||
flatOver = whiteui.tint(Color.valueOf("454545"));
|
||||
accentDrawable = whiteui.tint(Pal.accent);
|
||||
|
||||
defaultb = new ButtonStyle(){{
|
||||
down = buttonDown;
|
||||
@ -151,6 +152,16 @@ public class Styles{
|
||||
disabled = black;
|
||||
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(){{
|
||||
font = Fonts.def;
|
||||
fontColor = Color.white;
|
||||
|
@ -38,7 +38,7 @@ public class ModsDialog extends BaseDialog{
|
||||
|
||||
private String searchtxt = "";
|
||||
private @Nullable Seq<ModListing> modList;
|
||||
private boolean orderDate = true;
|
||||
private boolean orderDate = false;
|
||||
private BaseDialog currentContent;
|
||||
|
||||
private BaseDialog browser;
|
||||
@ -384,7 +384,7 @@ public class ModsDialog extends BaseDialog{
|
||||
|
||||
}).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();
|
||||
d.addCloseButton();
|
||||
|
Reference in New Issue
Block a user