mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-06 07:30:35 +07:00
Cleaned up schematic dialog code
This commit is contained in:
parent
35679925d2
commit
be5ba03142
@ -71,18 +71,12 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
rebuildPane[0] = () -> {
|
rebuildPane[0] = () -> {
|
||||||
t.clear();
|
t.clear();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
String regex = "[`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?]";
|
String regex = "[`~!@#$%^&*()-_=+[{]}|;:'\",<.>/?]";
|
||||||
String searchString = search.toLowerCase().replaceAll(regex, " ");
|
String searchString = search.toLowerCase().replaceAll(regex, " ");
|
||||||
|
|
||||||
if(!schematics.all().contains(s -> search.isEmpty() || s.name().toLowerCase().replaceAll(regex," ").contains(searchString))){
|
|
||||||
t.add("$none");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
firstSchematic = null;
|
firstSchematic = null;
|
||||||
|
|
||||||
for(Schematic s : schematics.all()){
|
for(Schematic s : schematics.all()){
|
||||||
|
|
||||||
if(!search.isEmpty() && !s.name().toLowerCase().replaceAll(regex, " ").contains(searchString)) continue;
|
if(!search.isEmpty() && !s.name().toLowerCase().replaceAll(regex, " ").contains(searchString)) continue;
|
||||||
if(firstSchematic == null) firstSchematic = s;
|
if(firstSchematic == null) firstSchematic = s;
|
||||||
|
|
||||||
@ -160,6 +154,10 @@ public class SchematicsDialog extends BaseDialog{
|
|||||||
t.row();
|
t.row();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(firstSchematic == null){
|
||||||
|
t.add("$none");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rebuildPane[0].run();
|
rebuildPane[0].run();
|
||||||
|
Loading…
Reference in New Issue
Block a user