From be5ba0314248b41b38ac6133da70575743ed7529 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 29 May 2020 14:01:27 -0400 Subject: [PATCH] Cleaned up schematic dialog code --- .../mindustry/ui/dialogs/SchematicsDialog.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/ui/dialogs/SchematicsDialog.java b/core/src/mindustry/ui/dialogs/SchematicsDialog.java index fc5635d100..eda28a1fb1 100644 --- a/core/src/mindustry/ui/dialogs/SchematicsDialog.java +++ b/core/src/mindustry/ui/dialogs/SchematicsDialog.java @@ -71,19 +71,13 @@ public class SchematicsDialog extends BaseDialog{ rebuildPane[0] = () -> { t.clear(); int i = 0; - String 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; - } + String regex = "[`~!@#$%^&*()-_=+[{]}|;:'\",<.>/?]"; + String searchString = search.toLowerCase().replaceAll(regex, " "); firstSchematic = null; 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; Button[] sel = {null}; @@ -160,6 +154,10 @@ public class SchematicsDialog extends BaseDialog{ t.row(); } } + + if(firstSchematic == null){ + t.add("$none"); + } }; rebuildPane[0].run();