UI cleanup
This commit is contained in:
@@ -232,7 +232,7 @@ public class MapGenerateDialog extends BaseDialog{
|
|||||||
}else{
|
}else{
|
||||||
Core.scene.setScrollFocus(null);
|
Core.scene.setScrollFocus(null);
|
||||||
}
|
}
|
||||||
}).grow().uniformX().get().setScrollingDisabled(true, false);
|
}).grow().uniformX().scrollX(false);
|
||||||
}).grow();
|
}).grow();
|
||||||
|
|
||||||
buffer1 = create();
|
buffer1 = create();
|
||||||
@@ -350,7 +350,7 @@ public class MapGenerateDialog extends BaseDialog{
|
|||||||
update();
|
update();
|
||||||
selection.hide();
|
selection.hide();
|
||||||
}).with(Table::left).get().getLabelCell().growX().left().padLeft(5).labelAlign(Align.left);
|
}).with(Table::left).get().getLabelCell().growX().left().padLeft(5).labelAlign(Align.left);
|
||||||
}).get().setScrollingDisabled(true, false);
|
}).scrollX(false);
|
||||||
|
|
||||||
selection.addCloseButton();
|
selection.addCloseButton();
|
||||||
selection.show();
|
selection.show();
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ public class WaveGraph extends Table{
|
|||||||
for(UnitType o : hidden) used.remove(o);
|
for(UnitType o : hidden) used.remove(o);
|
||||||
}).update(b -> b.setChecked(hidden.contains(type)));
|
}).update(b -> b.setChecked(hidden.contains(type)));
|
||||||
}
|
}
|
||||||
}).get().setScrollingDisabled(false, true);
|
}).scrollY(false);
|
||||||
|
|
||||||
for(UnitType type : hidden){
|
for(UnitType type : hidden){
|
||||||
used.remove(type);
|
used.remove(type);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
|
|
||||||
cont.clear();
|
cont.clear();
|
||||||
cont.stack(new Table(Tex.clear, main -> {
|
cont.stack(new Table(Tex.clear, main -> {
|
||||||
main.pane(t -> table = t).growX().growY().padRight(8f).get().setScrollingDisabled(true, false);
|
main.pane(t -> table = t).growX().growY().padRight(8f).scrollX(false);
|
||||||
main.row();
|
main.row();
|
||||||
main.button("@add", () -> {
|
main.button("@add", () -> {
|
||||||
if(groups == null) groups = new Seq<>();
|
if(groups == null) groups = new Seq<>();
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ public abstract class LStatement{
|
|||||||
t.top().pane(inner -> {
|
t.top().pane(inner -> {
|
||||||
inner.top();
|
inner.top();
|
||||||
hideCons.get(inner, hide);
|
hideCons.get(inner, hide);
|
||||||
}).pad(0f).top().get().setScrollingDisabled(true, false);
|
}).pad(0f).top().scrollX(false);
|
||||||
|
|
||||||
t.pack();
|
t.pack();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ItemsDisplay extends Table{
|
|||||||
label.actions(Actions.color(Color.white, 0.75f, Interp.fade));
|
label.actions(Actions.color(Color.white, 0.75f, Interp.fade));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).get().setScrollingDisabled(true, false), false).setDuration(0.3f);
|
}).scrollX(false), false).setDuration(0.3f);
|
||||||
|
|
||||||
c.button("@globalitems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
c.button("@globalitems", Icon.downOpen, Styles.clearTogglet, col::toggle).update(t -> {
|
||||||
t.setChecked(col.isCollapsed());
|
t.setChecked(col.isCollapsed());
|
||||||
|
|||||||
@@ -1,59 +1,6 @@
|
|||||||
package mindustry.ui;
|
package mindustry.ui;
|
||||||
|
|
||||||
import arc.func.*;
|
//TODO remove, unlikely to be used anywhere else.
|
||||||
import arc.graphics.*;
|
|
||||||
import arc.scene.ui.layout.*;
|
|
||||||
import arc.struct.*;
|
|
||||||
import mindustry.gen.*;
|
|
||||||
|
|
||||||
public class SearchBar{
|
public class SearchBar{
|
||||||
|
|
||||||
public static <T> Table add(Table parent, Seq<T> list, Func<String, String> queryf,
|
|
||||||
Func<T, String> namef, Cons2<Table, T> itemc, boolean show){
|
|
||||||
Table[] pane = {null};
|
|
||||||
|
|
||||||
Cons<String> rebuild = str -> {
|
|
||||||
String query = queryf.get(str);
|
|
||||||
|
|
||||||
pane[0].clear();
|
|
||||||
boolean any = false;
|
|
||||||
for(T item : list){
|
|
||||||
if(query.isEmpty() || matches(query, namef.get(item))){
|
|
||||||
any = true;
|
|
||||||
itemc.get(pane[0], item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!any){
|
|
||||||
pane[0].add("@none.found").color(Color.lightGray).pad(4);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if(show){
|
|
||||||
parent.table(search -> {
|
|
||||||
search.image(Icon.zoom).padRight(8f);
|
|
||||||
search.field("", rebuild).growX();
|
|
||||||
}).fillX().padBottom(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
parent.row();
|
|
||||||
parent.pane(table -> {
|
|
||||||
pane[0] = table;
|
|
||||||
rebuild.get("");
|
|
||||||
}).get().setScrollingDisabled(true, false);
|
|
||||||
return pane[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Table add(Table parent, Seq<T> list, Func<String, String> queryf, Func<T, String> namef, Cons2<Table, T> itemc){
|
|
||||||
return add(parent, list, queryf, namef, itemc, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> Table add(Table parent, Seq<T> list, Func<T, String> namef, Cons2<Table, T> itemc, boolean show){
|
|
||||||
return add(parent, list, String::toLowerCase, namef, itemc, show);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Match a list item with the search query, case insensitive */
|
|
||||||
public static boolean matches(String query, String name){
|
|
||||||
return name != null && !name.isEmpty() && name.toLowerCase().contains(query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
cont.clear();
|
cont.clear();
|
||||||
cont.pane(m -> main = m).get().setScrollingDisabled(true, false);
|
cont.pane(m -> main = m).scrollX(false);
|
||||||
main.margin(10f);
|
main.margin(10f);
|
||||||
main.button("@settings.reset", () -> {
|
main.button("@settings.reset", () -> {
|
||||||
rules = resetter.get();
|
rules = resetter.get();
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class LaunchLoadoutDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}).growX().get().setScrollingDisabled(true, false);
|
}).growX().scrollX(false);
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.pane(items);
|
cont.pane(items);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ModsDialog extends BaseDialog{
|
|||||||
browser.cont.pane(tablebrow -> {
|
browser.cont.pane(tablebrow -> {
|
||||||
tablebrow.margin(10f).top();
|
tablebrow.margin(10f).top();
|
||||||
browserTable = tablebrow;
|
browserTable = tablebrow;
|
||||||
}).get().setScrollingDisabled(true, false);
|
}).scrollX(false);
|
||||||
browser.addCloseButton();
|
browser.addCloseButton();
|
||||||
|
|
||||||
browser.onResize(this::rebuildBrowser);
|
browser.onResize(this::rebuildBrowser);
|
||||||
@@ -208,90 +208,113 @@ public class ModsDialog extends BaseDialog{
|
|||||||
|
|
||||||
if(!mods.list().isEmpty()){
|
if(!mods.list().isEmpty()){
|
||||||
boolean[] anyDisabled = {false};
|
boolean[] anyDisabled = {false};
|
||||||
SearchBar.add(cont, mods.list(),
|
Table[] pane = {null};
|
||||||
mod -> mod.meta.displayName(),
|
|
||||||
(table, mod) -> {
|
|
||||||
if(!mod.enabled() && !anyDisabled[0] && mods.list().size > 0){
|
|
||||||
anyDisabled[0] = true;
|
|
||||||
table.row();
|
|
||||||
table.image().growX().height(4f).pad(6f).color(Pal.gray);
|
|
||||||
table.row();
|
|
||||||
}
|
|
||||||
|
|
||||||
table.button(t -> {
|
Cons<String> rebuild = query -> {
|
||||||
t.top().left();
|
pane[0].clear();
|
||||||
t.margin(12f);
|
boolean any = false;
|
||||||
|
for(LoadedMod item : mods.list()){
|
||||||
|
if(Strings.matches(query, item.meta.displayName())){
|
||||||
|
any = true;
|
||||||
|
if(!item.enabled() && !anyDisabled[0] && mods.list().size > 0){
|
||||||
|
anyDisabled[0] = true;
|
||||||
|
pane[0].row();
|
||||||
|
pane[0].image().growX().height(4f).pad(6f).color(Pal.gray).row();
|
||||||
|
}
|
||||||
|
|
||||||
t.defaults().left().top();
|
pane[0].button(t -> {
|
||||||
t.table(title -> {
|
t.top().left();
|
||||||
title.left();
|
t.margin(12f);
|
||||||
|
|
||||||
title.add(new BorderImage(){{
|
t.defaults().left().top();
|
||||||
if(mod.iconTexture != null){
|
t.table(title1 -> {
|
||||||
setDrawable(new TextureRegion(mod.iconTexture));
|
title1.left();
|
||||||
}else{
|
|
||||||
setDrawable(Tex.nomap);
|
|
||||||
}
|
|
||||||
border(Pal.accent);
|
|
||||||
}}).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(8f);
|
|
||||||
|
|
||||||
title.table(text -> {
|
title1.add(new BorderImage(){{
|
||||||
boolean hideDisabled = !mod.isSupported() || mod.hasUnmetDependencies() || mod.hasContentErrors();
|
if(item.iconTexture != null){
|
||||||
|
setDrawable(new TextureRegion(item.iconTexture));
|
||||||
|
}else{
|
||||||
|
setDrawable(Tex.nomap);
|
||||||
|
}
|
||||||
|
border(Pal.accent);
|
||||||
|
}}).size(h - 8f).padTop(-8f).padLeft(-8f).padRight(8f);
|
||||||
|
|
||||||
text.add("[accent]" + Strings.stripColors(mod.meta.displayName()) + "\n[lightgray]v" + Strings.stripColors(trimText(mod.meta.version)) + (mod.enabled() || hideDisabled ? "" : "\n" + Core.bundle.get("mod.disabled") + ""))
|
title1.table(text -> {
|
||||||
|
boolean hideDisabled = !item.isSupported() || item.hasUnmetDependencies() || item.hasContentErrors();
|
||||||
|
|
||||||
|
text.add("[accent]" + Strings.stripColors(item.meta.displayName()) + "\n[lightgray]v" + Strings.stripColors(trimText(item.meta.version)) + (item.enabled() || hideDisabled ? "" : "\n" + Core.bundle.get("mod.disabled") + ""))
|
||||||
.wrap().top().width(300f).growX().left();
|
.wrap().top().width(300f).growX().left();
|
||||||
|
|
||||||
text.row();
|
|
||||||
|
|
||||||
if(mod.isOutdated()){
|
|
||||||
text.labelWrap("@mod.outdated").growX();
|
|
||||||
text.row();
|
text.row();
|
||||||
}else if(!mod.isSupported()){
|
|
||||||
text.labelWrap(Core.bundle.format("mod.requiresversion", mod.meta.minGameVersion)).growX();
|
|
||||||
text.row();
|
|
||||||
}else if(mod.hasUnmetDependencies()){
|
|
||||||
text.labelWrap(Core.bundle.format("mod.missingdependencies", mod.missingDependencies.toString(", "))).growX();
|
|
||||||
t.row();
|
|
||||||
}else if(mod.hasContentErrors()){
|
|
||||||
text.labelWrap("@mod.erroredcontent").growX();
|
|
||||||
text.row();
|
|
||||||
}else if(mod.meta.hidden){
|
|
||||||
text.labelWrap("@mod.multiplayer.compatible").growX();
|
|
||||||
text.row();
|
|
||||||
}
|
|
||||||
}).top().growX();
|
|
||||||
|
|
||||||
title.add().growX();
|
if(item.isOutdated()){
|
||||||
}).growX().growY().left();
|
text.labelWrap("@mod.outdated").growX();
|
||||||
|
text.row();
|
||||||
|
}else if(!item.isSupported()){
|
||||||
|
text.labelWrap(Core.bundle.format("mod.requiresversion", item.meta.minGameVersion)).growX();
|
||||||
|
text.row();
|
||||||
|
}else if(item.hasUnmetDependencies()){
|
||||||
|
text.labelWrap(Core.bundle.format("mod.missingdependencies", item.missingDependencies.toString(", "))).growX();
|
||||||
|
t.row();
|
||||||
|
}else if(item.hasContentErrors()){
|
||||||
|
text.labelWrap("@mod.erroredcontent").growX();
|
||||||
|
text.row();
|
||||||
|
}else if(item.meta.hidden){
|
||||||
|
text.labelWrap("@mod.multiplayer.compatible").growX();
|
||||||
|
text.row();
|
||||||
|
}
|
||||||
|
}).top().growX();
|
||||||
|
|
||||||
t.table(right -> {
|
title1.add().growX();
|
||||||
right.right();
|
}).growX().growY().left();
|
||||||
right.button(mod.enabled() ? Icon.downOpen : Icon.upOpen, Styles.clearPartiali, () -> {
|
|
||||||
mods.setEnabled(mod, !mod.enabled());
|
|
||||||
setup();
|
|
||||||
}).size(50f).disabled(!mod.isSupported());
|
|
||||||
|
|
||||||
right.button(mod.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
|
t.table(right -> {
|
||||||
if(!mod.hasSteamID()){
|
right.right();
|
||||||
ui.showConfirm("@confirm", "@mod.remove.confirm", () -> {
|
right.button(item.enabled() ? Icon.downOpen : Icon.upOpen, Styles.clearPartiali, () -> {
|
||||||
mods.removeMod(mod);
|
mods.setEnabled(item, !item.enabled());
|
||||||
setup();
|
setup();
|
||||||
});
|
}).size(50f).disabled(!item.isSupported());
|
||||||
}else{
|
|
||||||
platform.viewListing(mod);
|
|
||||||
}
|
|
||||||
}).size(50f);
|
|
||||||
|
|
||||||
if(steam && !mod.hasSteamID()){
|
right.button(item.hasSteamID() ? Icon.link : Icon.trash, Styles.clearPartiali, () -> {
|
||||||
right.row();
|
if(!item.hasSteamID()){
|
||||||
right.button(Icon.export, Styles.clearPartiali, () -> {
|
ui.showConfirm("@confirm", "@mod.remove.confirm", () -> {
|
||||||
platform.publish(mod);
|
mods.removeMod(item);
|
||||||
|
setup();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
platform.viewListing(item);
|
||||||
|
}
|
||||||
}).size(50f);
|
}).size(50f);
|
||||||
}
|
|
||||||
}).growX().right().padRight(-8f).padTop(-8f);
|
if(steam && !item.hasSteamID()){
|
||||||
}, Styles.clearPartialt, () -> showMod(mod)).size(w, h).growX().pad(4f);
|
right.row();
|
||||||
table.row();
|
right.button(Icon.export, Styles.clearPartiali, () -> {
|
||||||
}, !mobile || Core.graphics.isPortrait()).margin(10f).top();
|
platform.publish(item);
|
||||||
|
}).size(50f);
|
||||||
|
}
|
||||||
|
}).growX().right().padRight(-8f).padTop(-8f);
|
||||||
|
}, Styles.clearPartialt, () -> showMod(item)).size(w, h).growX().pad(4f);
|
||||||
|
pane[0].row();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!any){
|
||||||
|
pane[0].add("@none.found").color(Color.lightGray).pad(4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!mobile || Core.graphics.isPortrait()){
|
||||||
|
cont.table(search -> {
|
||||||
|
search.image(Icon.zoom).padRight(8f);
|
||||||
|
search.field("", rebuild).growX();
|
||||||
|
}).fillX().padBottom(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
cont.row();
|
||||||
|
cont.pane(table1 -> {
|
||||||
|
pane[0] = table1.margin(10f).top();
|
||||||
|
rebuild.get("");
|
||||||
|
}).scrollX(false);
|
||||||
}else{
|
}else{
|
||||||
cont.table(Styles.black6, t -> t.add("@mods.none")).height(80f);
|
cont.table(Styles.black6, t -> t.add("@mods.none")).height(80f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
|
|||||||
};
|
};
|
||||||
|
|
||||||
readd[0].run();
|
readd[0].run();
|
||||||
}).grow().get().setScrollingDisabled(true, false);
|
}).grow().scrollX(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
rebuildTags.run();
|
rebuildTags.run();
|
||||||
}).fillX().height(tagh).get().setScrollingDisabled(false, true);
|
}).fillX().height(tagh).scrollY(false);
|
||||||
|
|
||||||
in.button(Icon.pencilSmall, () -> {
|
in.button(Icon.pencilSmall, () -> {
|
||||||
showAllTags();
|
showAllTags();
|
||||||
@@ -246,7 +246,7 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
};
|
};
|
||||||
|
|
||||||
rebuildPane.run();
|
rebuildPane.run();
|
||||||
}).grow().get().setScrollingDisabled(true, false);
|
}).grow().scrollX(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showInfo(Schematic schematic){
|
public void showInfo(Schematic schematic){
|
||||||
@@ -573,7 +573,7 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fillX().left().height(tagh).get().setScrollingDisabled(false, true);
|
}).fillX().left().height(tagh).scrollY(false);
|
||||||
|
|
||||||
t.button(Icon.addSmall, () -> {
|
t.button(Icon.addSmall, () -> {
|
||||||
var dialog = new BaseDialog("@schematic.addtag");
|
var dialog = new BaseDialog("@schematic.addtag");
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class PlayerListFragment extends Fragment{
|
|||||||
search.setMessageText(Core.bundle.get("players.search"));
|
search.setMessageText(Core.bundle.get("players.search"));
|
||||||
|
|
||||||
pane.row();
|
pane.row();
|
||||||
pane.pane(content).grow().get().setScrollingDisabled(true, false);
|
pane.pane(content).grow().scrollX(false);
|
||||||
pane.row();
|
pane.row();
|
||||||
|
|
||||||
pane.table(menu -> {
|
pane.table(menu -> {
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
http.socketTimeout=80000
|
http.socketTimeout=80000
|
||||||
http.connectionTimeout=80000
|
http.connectionTimeout=80000
|
||||||
archash=0d9a003fc8f70b58f739bfacc3817b4c2522a8af
|
archash=6b77c7f375e42e3049ab60b47bd0654becb5eab4
|
||||||
|
|||||||
Reference in New Issue
Block a user