Minor editor/world processor fixes and tweaks (#10505)
* Rules search and info button tweaks * Tweak spawnunit and some searching (again) * Just revert a condition removal
This commit is contained in:
@@ -56,7 +56,7 @@ public class BannedContentDialog<T extends UnlockableContent> extends BaseDialog
|
|||||||
t.table(s -> {
|
t.table(s -> {
|
||||||
s.label(() -> "@search").padRight(10);
|
s.label(() -> "@search").padRight(10);
|
||||||
var field = s.field(contentSearch, value -> {
|
var field = s.field(contentSearch, value -> {
|
||||||
contentSearch = value;
|
contentSearch = value.trim().replaceAll(" +", " ").toLowerCase();
|
||||||
rebuildTables();
|
rebuildTables();
|
||||||
}).get();
|
}).get();
|
||||||
s.button(Icon.cancel, Styles.emptyi, () -> {
|
s.button(Icon.cancel, Styles.emptyi, () -> {
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
if(!Core.atlas.isFound(region) || !block.inEditor
|
if(!Core.atlas.isFound(region) || !block.inEditor
|
||||||
|| block.buildVisibility == BuildVisibility.debugOnly
|
|| block.buildVisibility == BuildVisibility.debugOnly
|
||||||
|| (!searchText.isEmpty() && !block.localizedName.toLowerCase().contains(searchText.toLowerCase()))
|
|| (!searchText.isEmpty() && !block.localizedName.toLowerCase().contains(searchText.trim().replaceAll(" +", " ").toLowerCase()))
|
||||||
) continue;
|
) continue;
|
||||||
|
|
||||||
ImageButton button = new ImageButton(Tex.whiteui, Styles.clearNoneTogglei);
|
ImageButton button = new ImageButton(Tex.whiteui, Styles.clearNoneTogglei);
|
||||||
|
|||||||
@@ -1433,7 +1433,7 @@ public class LExecutor{
|
|||||||
|
|
||||||
Team t = team.team();
|
Team t = team.team();
|
||||||
|
|
||||||
if(type.obj() instanceof UnitType type && !type.internal && !type.hidden && t != null && Units.canCreate(t, type)){
|
if(type.obj() instanceof UnitType type && !type.internal && Units.canCreate(t, type)){
|
||||||
//random offset to prevent stacking
|
//random offset to prevent stacking
|
||||||
var unit = type.spawn(t, World.unconv(x.numf()) + Mathf.range(0.01f), World.unconv(y.numf()) + Mathf.range(0.01f));
|
var unit = type.spawn(t, World.unconv(x.numf()) + Mathf.range(0.01f), World.unconv(y.numf()) + Mathf.range(0.01f));
|
||||||
spawner.spawnEffect(unit);
|
spawner.spawnEffect(unit);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import mindustry.type.Weather.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
import static arc.Core.*;
|
||||||
import static arc.util.Time.*;
|
import static arc.util.Time.*;
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -117,24 +118,30 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
categories.clear();
|
|
||||||
cont.clear();
|
cont.clear();
|
||||||
cont.table(t -> {
|
cont.table(t -> {
|
||||||
t.add("@search").padRight(10);
|
t.add("@search").padRight(10);
|
||||||
var field = t.field(ruleSearch, text -> {
|
var field = t.field(ruleSearch, text -> {
|
||||||
ruleSearch = text.trim().replaceAll(" +", " ").toLowerCase();
|
ruleSearch = text.trim().replaceAll(" +", " ").toLowerCase();
|
||||||
setup();
|
setupMain();
|
||||||
}).grow().pad(8).get();
|
}).grow().pad(8).get();
|
||||||
field.setCursorPosition(ruleSearch.length());
|
field.setCursorPosition(ruleSearch.length());
|
||||||
Core.scene.setKeyboardFocus(field);
|
Core.scene.setKeyboardFocus(field);
|
||||||
t.button(Icon.cancel, Styles.emptyi, () -> {
|
t.button(Icon.cancel, Styles.emptyi, () -> {
|
||||||
ruleSearch = "";
|
ruleSearch = "";
|
||||||
setup();
|
setupMain();
|
||||||
}).padLeft(10f).size(35f);
|
}).padLeft(10f).size(35f);
|
||||||
t.button(Icon.zoom, Styles.emptyi, this::setup).size(54f);
|
|
||||||
}).row();
|
}).row();
|
||||||
cont.pane(m -> main = m).scrollX(false);
|
Cell<ScrollPane> paneCell = cont.pane(m -> main = m);
|
||||||
main.margin(10f);
|
|
||||||
|
setupMain();
|
||||||
|
|
||||||
|
paneCell.scrollX(main.getPrefWidth() + 40f > graphics.getWidth());
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupMain(){
|
||||||
|
categories.clear();
|
||||||
|
main.clear();
|
||||||
main.left().defaults().fillX().left();
|
main.left().defaults().fillX().left();
|
||||||
main.row();
|
main.row();
|
||||||
|
|
||||||
@@ -333,7 +340,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
|
|
||||||
public void category(String name){
|
public void category(String name){
|
||||||
current = new Table();
|
current = new Table();
|
||||||
current.left().defaults().fillX().left().pad(5);
|
current.left().defaults().fillX().expandX().left().pad(5);
|
||||||
currentName = name;
|
currentName = name;
|
||||||
categories.add(current);
|
categories.add(current);
|
||||||
categoryNames.add(currentName);
|
categoryNames.add(currentName);
|
||||||
@@ -403,7 +410,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
t.add(text).left().padRight(5)
|
t.add(text).left().padRight(5)
|
||||||
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
.update(a -> a.setColor(condition.get() ? Color.white : Color.gray));
|
||||||
t.field((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s)))
|
t.field((integer ? (int)prov.get() : prov.get()) + "", s -> cons.get(Strings.parseFloat(s)))
|
||||||
.padRight(100f)
|
.padRight(50f)
|
||||||
.update(a -> a.setDisabled(!condition.get()))
|
.update(a -> a.setDisabled(!condition.get()))
|
||||||
.valid(f -> Strings.canParsePositiveFloat(f) && Strings.parseFloat(f) >= min && Strings.parseFloat(f) <= max).width(120f).left();
|
.valid(f -> Strings.canParsePositiveFloat(f) && Strings.parseFloat(f) >= min && Strings.parseFloat(f) <= max).width(120f).left();
|
||||||
}).padTop(0);
|
}).padTop(0);
|
||||||
@@ -429,7 +436,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
Table table = new Table();
|
Table table = new Table();
|
||||||
table.add(cell.get()).left().expandX().fillX();
|
table.add(cell.get()).left().expandX().fillX();
|
||||||
cell.clearElement();
|
cell.clearElement();
|
||||||
table.button(Icon.infoSmall, () -> ui.showInfo(text + ".info")).size(32f).padRight(24f).right();
|
table.button(Icon.infoSmall, () -> ui.showInfo(text + ".info")).size(32f).right();
|
||||||
cell.setElement(table).left().expandX().fillX();
|
cell.setElement(table).left().expandX().fillX();
|
||||||
}else{
|
}else{
|
||||||
cell.tooltip(text + ".info");
|
cell.tooltip(text + ".info");
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public class HudFragment{
|
|||||||
|| (!block.inEditor && !(block instanceof RemoveWall) && !(block instanceof RemoveOre))
|
|| (!block.inEditor && !(block instanceof RemoveWall) && !(block instanceof RemoveOre))
|
||||||
|| !block.isOnPlanet(state.rules.planet)
|
|| !block.isOnPlanet(state.rules.planet)
|
||||||
|| block.buildVisibility == BuildVisibility.debugOnly
|
|| block.buildVisibility == BuildVisibility.debugOnly
|
||||||
|| (!searchText.isEmpty() && !block.localizedName.toLowerCase().contains(searchText.toLowerCase()))
|
|| (!searchText.isEmpty() && !block.localizedName.toLowerCase().contains(searchText.trim().replaceAll(" +", " ").toLowerCase()))
|
||||||
) continue;
|
) continue;
|
||||||
|
|
||||||
ImageButton button = new ImageButton(Tex.whiteui, Styles.clearNoneTogglei);
|
ImageButton button = new ImageButton(Tex.whiteui, Styles.clearNoneTogglei);
|
||||||
|
|||||||
Reference in New Issue
Block a user