SearchBar class - add search bars to mods (#3267)
* Create SearchBar and make ModsDialog use it * add search bar to servers * Update core/src/mindustry/ui/SearchBar.java Co-authored-by: Antsiferov Andrew <summet.dev@gmail.com> * a * fix mods menu not rowing * remove search bar for remote servers * h * hide searchbar on landscape mobile * anukes feedback * Update core/src/mindustry/ui/SearchBar.java Co-authored-by: Anuken <arnukren@gmail.com> * java dumb Co-authored-by: Antsiferov Andrew <summet.dev@gmail.com> Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -37,6 +37,9 @@ public class ModsDialog extends BaseDialog{
|
||||
buttons.button("@mods.guide", Icon.link, () -> Core.app.openURI(modGuideURL)).size(210, 64f);
|
||||
|
||||
shown(this::setup);
|
||||
if(mobile){
|
||||
onResize(this::setup);
|
||||
}
|
||||
|
||||
hidden(() -> {
|
||||
if(mods.requiresReload()){
|
||||
@@ -228,14 +231,12 @@ public class ModsDialog extends BaseDialog{
|
||||
cont.row();
|
||||
|
||||
if(!mods.list().isEmpty()){
|
||||
cont.pane(table -> {
|
||||
table.margin(10f).top();
|
||||
|
||||
boolean anyDisabled = false;
|
||||
for(LoadedMod mod : mods.list()){
|
||||
|
||||
if(!mod.enabled() && !anyDisabled && mods.list().size > 0){
|
||||
anyDisabled = true;
|
||||
boolean[] anyDisabled = {false};
|
||||
SearchBar.add(cont, mods.list(),
|
||||
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();
|
||||
@@ -309,20 +310,19 @@ public class ModsDialog extends BaseDialog{
|
||||
}).size(50f);
|
||||
}
|
||||
}).growX().right().padRight(-8f).padTop(-8f);
|
||||
|
||||
|
||||
}, Styles.clearPartialt, () -> showMod(mod)).size(w, h).growX().pad(4f);
|
||||
table.row();
|
||||
}
|
||||
});
|
||||
|
||||
}, bar -> {
|
||||
if(mobile && !Core.graphics.isPortrait()){
|
||||
//hide search bar on mobile, takes up too much space
|
||||
bar.get().clear();
|
||||
}
|
||||
}).margin(10f).top();
|
||||
}else{
|
||||
cont.table(Styles.black6, t -> t.add("@mods.none")).height(80f);
|
||||
}
|
||||
|
||||
cont.row();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void reload(){
|
||||
|
||||
Reference in New Issue
Block a user