Search bar for wave UI (#8501)
* wave search + other editor things * everything but wave search
This commit is contained in:
@@ -462,6 +462,8 @@ waves.sort.reverse = Reverse Sort
|
|||||||
waves.sort.begin = Begin
|
waves.sort.begin = Begin
|
||||||
waves.sort.health = Health
|
waves.sort.health = Health
|
||||||
waves.sort.type = Type
|
waves.sort.type = Type
|
||||||
|
waves.search = Search waves...
|
||||||
|
waves.filter.unit = Unit Filter
|
||||||
waves.units.hide = Hide All
|
waves.units.hide = Hide All
|
||||||
waves.units.show = Show All
|
waves.units.show = Show All
|
||||||
|
|
||||||
|
|||||||
@@ -752,9 +752,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
cont.table(search -> {
|
cont.table(search -> {
|
||||||
search.image(Icon.zoom).padRight(8);
|
search.image(Icon.zoom).padRight(8);
|
||||||
search.field("", this::rebuildBlockSelection)
|
search.field("", this::rebuildBlockSelection).growX()
|
||||||
.name("editor/search").maxTextLength(maxNameLength).get().setMessageText("@players.search");
|
.name("editor/search").maxTextLength(maxNameLength).get().setMessageText("@players.search");
|
||||||
}).pad(-2);
|
}).growX().pad(-2).padLeft(6f);
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.table(Tex.underline, extra -> extra.labelWrap(() -> editor.drawBlock.localizedName).width(200f).center()).growX();
|
cont.table(Tex.underline, extra -> extra.labelWrap(() -> editor.drawBlock.localizedName).width(200f).center()).growX();
|
||||||
cont.row();
|
cont.row();
|
||||||
@@ -803,7 +803,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(i == 0){
|
if(i == 0){
|
||||||
blockSelection.add("@none").color(Color.lightGray).padLeft(80f).padTop(10f);
|
blockSelection.add("@none.found").color(Color.lightGray).padLeft(54f).padTop(10f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class MapLoadDialog extends BaseDialog{
|
|||||||
buttons.defaults().size(200f, 50f);
|
buttons.defaults().size(200f, 50f);
|
||||||
buttons.button("@cancel", this::hide);
|
buttons.button("@cancel", this::hide);
|
||||||
buttons.add(button);
|
buttons.add(button);
|
||||||
|
addCloseListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuild(){
|
public void rebuild(){
|
||||||
@@ -48,13 +49,13 @@ public class MapLoadDialog extends BaseDialog{
|
|||||||
table.defaults().size(200f, 90f).pad(4f);
|
table.defaults().size(200f, 90f).pad(4f);
|
||||||
table.margin(10f);
|
table.margin(10f);
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(table, Styles.horizontalPane);
|
ScrollPane pane = new ScrollPane(table);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
for(Map map : maps.all()){
|
for(Map map : maps.all()){
|
||||||
|
|
||||||
TextButton button = new TextButton(map.name(), Styles.togglet);
|
TextButton button = new TextButton(map.name(), Styles.flatTogglet);
|
||||||
button.add(new BorderImage(map.safeTexture(), 2f).setScaling(Scaling.fit)).size(16 * 4f);
|
button.add(new BorderImage(map.safeTexture(), 2f).setScaling(Scaling.fit)).padLeft(5f).size(16 * 4f);
|
||||||
button.getCells().reverse();
|
button.getCells().reverse();
|
||||||
button.clicked(() -> selected = map);
|
button.clicked(() -> selected = map);
|
||||||
button.getLabelCell().grow().left().padLeft(5f);
|
button.getLabelCell().grow().left().padLeft(5f);
|
||||||
@@ -63,14 +64,12 @@ public class MapLoadDialog extends BaseDialog{
|
|||||||
if(++i % maxcol == 0) table.row();
|
if(++i % maxcol == 0) table.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(maps.all().size == 0){
|
if(maps.all().isEmpty()){
|
||||||
table.add("@maps.none").center();
|
table.add("@maps.none").center();
|
||||||
}else{
|
|
||||||
cont.add("@editor.loadmap");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.add(pane);
|
cont.add(pane).growX();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package mindustry.editor;
|
package mindustry.editor;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.func.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
|
import arc.input.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
@@ -21,19 +23,18 @@ import mindustry.type.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
import static mindustry.game.SpawnGroup.*;
|
import static mindustry.game.SpawnGroup.*;
|
||||||
|
|
||||||
public class WaveInfoDialog extends BaseDialog{
|
public class WaveInfoDialog extends BaseDialog{
|
||||||
private int displayed = 20;
|
private int start = 0, displayed = 20;
|
||||||
Seq<SpawnGroup> groups = new Seq<>();
|
Seq<SpawnGroup> groups = new Seq<>();
|
||||||
private SpawnGroup expandedGroup;
|
private @Nullable SpawnGroup expandedGroup;
|
||||||
|
|
||||||
private Table table;
|
private Table table;
|
||||||
private int start = 0;
|
private int search = -1;
|
||||||
private UnitType lastType = UnitTypes.dagger;
|
private UnitType lastType = UnitTypes.dagger;
|
||||||
|
private @Nullable UnitType filterType;
|
||||||
private Sort sort = Sort.begin;
|
private Sort sort = Sort.begin;
|
||||||
private boolean reverseSort = false;
|
private boolean reverseSort = false;
|
||||||
private float updateTimer, updatePeriod = 1f;
|
private float updateTimer, updatePeriod = 1f;
|
||||||
@@ -49,45 +50,22 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
hidden(() -> state.rules.spawns = groups);
|
hidden(() -> state.rules.spawns = groups);
|
||||||
|
|
||||||
addCloseListener();
|
|
||||||
|
|
||||||
onResize(this::setup);
|
onResize(this::setup);
|
||||||
buttons.button(Icon.filter, () -> {
|
|
||||||
BaseDialog dialog = new BaseDialog("@waves.sort");
|
|
||||||
dialog.setFillParent(false);
|
|
||||||
dialog.cont.table(Tex.button, t -> {
|
|
||||||
for(Sort s : Sort.all){
|
|
||||||
t.button("@waves.sort." + s, Styles.flatTogglet, () -> {
|
|
||||||
sort = s;
|
|
||||||
dialog.hide();
|
|
||||||
buildGroups();
|
|
||||||
}).size(150f, 60f).checked(s == sort);
|
|
||||||
}
|
|
||||||
}).row();
|
|
||||||
dialog.cont.check("@waves.sort.reverse", b -> {
|
|
||||||
reverseSort = b;
|
|
||||||
buildGroups();
|
|
||||||
}).padTop(4).checked(reverseSort).padBottom(8f);
|
|
||||||
dialog.addCloseButton();
|
|
||||||
dialog.show();
|
|
||||||
buildGroups();
|
|
||||||
}).size(60f, 64f);
|
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
buttons.button("@waves.edit", Icon.pencil, () -> {
|
buttons.button("@waves.edit", Icon.edit, () -> {
|
||||||
BaseDialog dialog = new BaseDialog("@waves.edit");
|
BaseDialog dialog = new BaseDialog("@waves.edit");
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.cont.table(Tex.button, t -> {
|
dialog.cont.table(Tex.button, t -> {
|
||||||
var style = Styles.flatt;
|
var style = Styles.cleart;
|
||||||
t.defaults().size(210f, 58f);
|
t.defaults().size(280f, 64f).pad(2f);
|
||||||
|
|
||||||
t.button("@waves.copy", Icon.copy, style, () -> {
|
t.button("@waves.copy", Icon.copy, style, () -> {
|
||||||
ui.showInfoFade("@waves.copied");
|
ui.showInfoFade("@waves.copied");
|
||||||
Core.app.setClipboardText(maps.writeWaves(groups));
|
Core.app.setClipboardText(maps.writeWaves(groups));
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}).disabled(b -> groups == null).marginLeft(12f).row();
|
}).disabled(b -> groups == null || groups.isEmpty()).marginLeft(12f).row();
|
||||||
|
|
||||||
t.button("@waves.load", Icon.download, style, () -> {
|
t.button("@waves.load", Icon.download, style, () -> {
|
||||||
try{
|
try{
|
||||||
@@ -98,16 +76,16 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
ui.showErrorMessage("@waves.invalid");
|
ui.showErrorMessage("@waves.invalid");
|
||||||
}
|
}
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}).marginLeft(12f).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty()).row();
|
}).disabled(Core.app.getClipboardText() == null || !Core.app.getClipboardText().startsWith("[")).marginLeft(12f).row();
|
||||||
|
|
||||||
t.button("@settings.reset", Icon.upload, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
t.button("@clear", Icon.none, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||||
groups = JsonIO.copy(waves.get());
|
groups.clear();
|
||||||
buildGroups();
|
buildGroups();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
})).marginLeft(12f).row();
|
})).marginLeft(12f).row();
|
||||||
|
|
||||||
t.button("@clear", Icon.cancel, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
t.button("@settings.reset", Icon.refresh, style, () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||||
groups.clear();
|
groups = JsonIO.copy(waves.get());
|
||||||
buildGroups();
|
buildGroups();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
})).marginLeft(12f);
|
})).marginLeft(12f);
|
||||||
@@ -144,7 +122,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
buttons.button(Core.bundle.get("waves.random"), Icon.refresh, () -> {
|
buttons.button(Core.bundle.get("waves.random"), Icon.refresh, () -> {
|
||||||
groups.clear();
|
groups.clear();
|
||||||
groups = Waves.generate(1f / 10f);
|
groups = Waves.generate(1f / 10f);
|
||||||
updateWaves();
|
buildGroups();
|
||||||
}).width(200f);
|
}).width(200f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,19 +149,53 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? waves.get() : state.rules.spawns);
|
groups = JsonIO.copy(state.rules.spawns.isEmpty() ? waves.get() : state.rules.spawns);
|
||||||
|
if(groups == null) groups = new Seq<>();
|
||||||
|
|
||||||
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).scrollX(false);
|
main.table(s -> {
|
||||||
main.row();
|
s.image(Icon.zoom).padRight(8);
|
||||||
main.button("@add", () -> {
|
s.field(search < 0 ? "" : (search + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(groups == null) groups = new Seq<>();
|
search = groups.any() ? Strings.parseInt(text, 0) - 1 : -1;
|
||||||
SpawnGroup newGroup = new SpawnGroup(lastType);
|
start = Math.max(search - (displayed / 2) - (displayed % 2), 0);
|
||||||
groups.add(newGroup);
|
buildGroups();
|
||||||
expandedGroup = newGroup;
|
}).growX().maxTextLength(8).get().setMessageText("@waves.search");
|
||||||
showUpdate(newGroup);
|
s.button(Icon.units, Styles.emptyi, () -> showUnits(type -> filterType = type, true)).size(46f).tooltip("@waves.filter.unit")
|
||||||
buildGroups();
|
.update(b -> b.getStyle().imageUp = filterType != null ? new TextureRegionDrawable(filterType.uiIcon) : Icon.filter);
|
||||||
}).growX().height(70f);
|
}).growX().pad(6f).row();
|
||||||
|
|
||||||
|
main.pane(t -> table = t).grow().padRight(8f).scrollX(false).row();
|
||||||
|
|
||||||
|
main.table(t -> {
|
||||||
|
t.button("@add", () -> {
|
||||||
|
SpawnGroup newGroup = new SpawnGroup(lastType);
|
||||||
|
groups.add(newGroup);
|
||||||
|
expandedGroup = newGroup;
|
||||||
|
showUnits(type -> newGroup.type = lastType = type, false);
|
||||||
|
buildGroups();
|
||||||
|
}).growX().height(70f);
|
||||||
|
|
||||||
|
t.button(Icon.filter, () -> {
|
||||||
|
BaseDialog dialog = new BaseDialog("@waves.sort");
|
||||||
|
dialog.setFillParent(false);
|
||||||
|
dialog.cont.table(Tex.button, f -> {
|
||||||
|
for(Sort s : Sort.all){
|
||||||
|
f.button("@waves.sort." + s, Styles.flatTogglet, () -> {
|
||||||
|
sort = s;
|
||||||
|
dialog.hide();
|
||||||
|
buildGroups();
|
||||||
|
}).size(150f, 60f).checked(s == sort);
|
||||||
|
}
|
||||||
|
}).row();
|
||||||
|
dialog.cont.check("@waves.sort.reverse", b -> {
|
||||||
|
reverseSort = b;
|
||||||
|
buildGroups();
|
||||||
|
}).padTop(4).checked(reverseSort).padBottom(8f);
|
||||||
|
dialog.addCloseButton();
|
||||||
|
dialog.show();
|
||||||
|
}).size(64f, 70f).padLeft(6f);
|
||||||
|
}).growX();
|
||||||
|
|
||||||
}), new Label("@waves.none"){{
|
}), new Label("@waves.none"){{
|
||||||
visible(() -> groups.isEmpty());
|
visible(() -> groups.isEmpty());
|
||||||
this.touchable = Touchable.disabled;
|
this.touchable = Touchable.disabled;
|
||||||
@@ -202,10 +214,13 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
table.margin(10f);
|
table.margin(10f);
|
||||||
|
|
||||||
if(groups != null){
|
if(groups != null){
|
||||||
groups.sort(sort.sort);
|
groups.sort(Structs.comps(Structs.comparingFloat(sort.sort), Structs.comparingFloat(sort.secondary)));
|
||||||
if(reverseSort) groups.reverse();
|
if(reverseSort) groups.reverse();
|
||||||
|
|
||||||
for(SpawnGroup group : groups){
|
for(SpawnGroup group : groups){
|
||||||
|
if(group.effect == StatusEffects.none) group.effect = null;
|
||||||
|
if((search >= 0 && group.getSpawned(search) <= 0) || (filterType != null && group.type != filterType)) continue;
|
||||||
|
|
||||||
table.table(Tex.button, t -> {
|
table.table(Tex.button, t -> {
|
||||||
t.margin(0).defaults().pad(3).padLeft(5f).growX().left();
|
t.margin(0).defaults().pad(3).padLeft(5f).growX().left();
|
||||||
t.button(b -> {
|
t.button(b -> {
|
||||||
@@ -218,24 +233,31 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
b.label(() -> (group.begin + 1) + "").color(Color.lightGray).minWidth(45f).labelAlign(Align.left).left();
|
b.label(() -> (group.begin + 1) + "").color(Color.lightGray).minWidth(45f).labelAlign(Align.left).left();
|
||||||
|
|
||||||
b.button(Icon.copySmall, Styles.emptyi, () -> {
|
b.button(Icon.copySmall, Styles.emptyi, () -> {
|
||||||
SpawnGroup newGroup = group.copy();
|
SpawnGroup copy = group.copy();
|
||||||
expandedGroup = newGroup;
|
expandedGroup = copy;
|
||||||
groups.add(newGroup);
|
groups.insert(groups.indexOf(group) + 1, copy);
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}).pad(-6).size(46f);
|
}).pad(-6).size(46f).tooltip("@editor.copy");
|
||||||
|
|
||||||
b.button(group.effect != null && group.effect != StatusEffects.none ?
|
b.button(group.effect != null ?
|
||||||
new TextureRegionDrawable(group.effect.uiIcon) :
|
new TextureRegionDrawable(group.effect.uiIcon) :
|
||||||
Icon.logicSmall,
|
Icon.logicSmall,
|
||||||
Styles.emptyi, () -> showEffect(group)).pad(-6).size(46f);
|
Styles.emptyi, () -> showEffects(group)).pad(-6).size(46f).scaling(Scaling.fit).tooltip(group.effect != null ? group.effect.localizedName : "@none");
|
||||||
|
|
||||||
b.button(Icon.unitsSmall, Styles.emptyi, () -> showUpdate(group)).pad(-6).size(46f);
|
b.button(Icon.unitsSmall, Styles.emptyi, () -> showUnits(type -> group.type = lastType = type, false)).pad(-6).size(46f).tooltip("@stat.unittype");
|
||||||
b.button(Icon.cancel, Styles.emptyi, () -> {
|
b.button(Icon.cancel, Styles.emptyi, () -> {
|
||||||
groups.remove(group);
|
groups.remove(group);
|
||||||
|
if(expandedGroup == group) expandedGroup = null;
|
||||||
table.getCell(t).pad(0f);
|
table.getCell(t).pad(0f);
|
||||||
t.remove();
|
t.remove();
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}).pad(-6).size(46f).padRight(-12f);
|
}).pad(-6).size(46f).padRight(-12f).tooltip("@waves.remove");
|
||||||
|
b.clicked(KeyCode.mouseMiddle, () -> {
|
||||||
|
SpawnGroup copy = group.copy();
|
||||||
|
groups.insert(groups.indexOf(group) + 1, copy);
|
||||||
|
expandedGroup = copy;
|
||||||
|
buildGroups();
|
||||||
|
});
|
||||||
}, () -> {
|
}, () -> {
|
||||||
expandedGroup = expandedGroup == group ? null : group;
|
expandedGroup = expandedGroup == group ? null : group;
|
||||||
buildGroups();
|
buildGroups();
|
||||||
@@ -369,7 +391,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
dialog.hide();
|
dialog.hide();
|
||||||
}).size(110f, 45f).checked(-1 == group.spawn);
|
}).size(110f, 45f).checked(-1 == group.spawn);
|
||||||
}
|
}
|
||||||
});
|
}).grow();
|
||||||
dialog.setFillParent(false);
|
dialog.setFillParent(false);
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
@@ -381,6 +403,10 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(table.getChildren().isEmpty() && groups.any()){
|
||||||
|
table.add("@none.found");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
table.add("@editor.default");
|
table.add("@editor.default");
|
||||||
}
|
}
|
||||||
@@ -388,11 +414,23 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
|
|
||||||
void showUpdate(SpawnGroup group){
|
void showUnits(Cons<UnitType> cons, boolean reset){
|
||||||
BaseDialog dialog = new BaseDialog("");
|
BaseDialog dialog = new BaseDialog("");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
dialog.cont.pane(p -> {
|
dialog.cont.pane(p -> {
|
||||||
int i = 0;
|
p.defaults().pad(2).fillX();
|
||||||
|
if(reset){
|
||||||
|
p.button(t -> {
|
||||||
|
t.left();
|
||||||
|
t.image(Icon.none).size(8 * 4).scaling(Scaling.fit).padRight(2f);
|
||||||
|
t.add("@settings.resetKey");
|
||||||
|
}, () -> {
|
||||||
|
cons.get(null);
|
||||||
|
dialog.hide();
|
||||||
|
buildGroups();
|
||||||
|
}).margin(12f);
|
||||||
|
}
|
||||||
|
int i = reset ? 1 : 0;
|
||||||
for(UnitType type : content.units()){
|
for(UnitType type : content.units()){
|
||||||
if(type.isHidden()) continue;
|
if(type.isHidden()) continue;
|
||||||
p.button(t -> {
|
p.button(t -> {
|
||||||
@@ -400,19 +438,18 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
t.image(type.uiIcon).size(8 * 4).scaling(Scaling.fit).padRight(2f);
|
t.image(type.uiIcon).size(8 * 4).scaling(Scaling.fit).padRight(2f);
|
||||||
t.add(type.localizedName);
|
t.add(type.localizedName);
|
||||||
}, () -> {
|
}, () -> {
|
||||||
lastType = type;
|
cons.get(type);
|
||||||
group.type = type;
|
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}).pad(2).margin(12f).fillX();
|
}).margin(12f);
|
||||||
if(++i % 3 == 0) p.row();
|
if(++i % 3 == 0) p.row();
|
||||||
}
|
}
|
||||||
});
|
}).growX().scrollX(false);
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void showEffect(SpawnGroup group){
|
void showEffects(SpawnGroup group){
|
||||||
BaseDialog dialog = new BaseDialog("");
|
BaseDialog dialog = new BaseDialog("");
|
||||||
dialog.setFillParent(true);
|
dialog.setFillParent(true);
|
||||||
dialog.cont.pane(p -> {
|
dialog.cont.pane(p -> {
|
||||||
@@ -434,28 +471,33 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
t.add("@settings.resetKey");
|
t.add("@settings.resetKey");
|
||||||
}
|
}
|
||||||
}, () -> {
|
}, () -> {
|
||||||
group.effect = effect;
|
group.effect = effect != StatusEffects.none ? effect : null;
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}).pad(2).margin(12f).fillX();
|
}).pad(2).margin(12f).fillX();
|
||||||
if(++i % 3 == 0) p.row();
|
if(++i % 3 == 0) p.row();
|
||||||
}
|
}
|
||||||
});
|
}).growX().scrollX(false);
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Sort{
|
enum Sort{
|
||||||
begin(Structs.comps(Structs.comparingFloat(g -> g.begin), Structs.comparingFloat(g -> g.type.id))),
|
begin(g -> g.begin, g -> g.type.id),
|
||||||
health(Structs.comps(Structs.comparingFloat(g -> g.type.health), Structs.comparingFloat(g -> g.begin))),
|
health(g -> g.type.health),
|
||||||
type(Structs.comps(Structs.comparingFloat(g -> g.type.id), Structs.comparingFloat(g -> g.begin)));
|
type(g -> g.type.id);
|
||||||
|
|
||||||
static final Sort[] all = values();
|
static final Sort[] all = values();
|
||||||
|
|
||||||
final Comparator<SpawnGroup> sort;
|
final Floatf<SpawnGroup> sort, secondary;
|
||||||
|
|
||||||
Sort(Comparator<SpawnGroup> sort){
|
Sort(Floatf<SpawnGroup> sort){
|
||||||
|
this(sort, g -> g.begin);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sort(Floatf<SpawnGroup> sort, Floatf<SpawnGroup> secondary){
|
||||||
this.sort = sort;
|
this.sort = sort;
|
||||||
|
this.secondary = secondary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
if(unitAmount != 1) json.writeValue("amount", unitAmount);
|
if(unitAmount != 1) json.writeValue("amount", unitAmount);
|
||||||
if(effect != null) json.writeValue("effect", effect.name);
|
if(effect != null) json.writeValue("effect", effect.name);
|
||||||
if(spawn != -1) json.writeValue("spawn", spawn);
|
if(spawn != -1) json.writeValue("spawn", spawn);
|
||||||
if(payloads != null && payloads.size > 0) json.writeValue("payloads", payloads.map(u -> u.name).toArray(String.class));
|
if(payloads != null && payloads.any()) json.writeValue("payloads", payloads.map(u -> u.name).toArray(String.class));
|
||||||
if(items != null && items.amount > 0) json.writeValue("items", items);
|
if(items != null && items.amount > 0) json.writeValue("items", items);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
public void read(Json json, JsonValue data){
|
public void read(Json json, JsonValue data){
|
||||||
String tname = data.getString("type", "dagger");
|
String tname = data.getString("type", "dagger");
|
||||||
|
|
||||||
type = content.getByName(ContentType.unit, LegacyIO.unitMap.get(tname, tname));
|
type = content.unit(LegacyIO.unitMap.get(tname, tname));
|
||||||
if(type == null) type = UnitTypes.dagger;
|
if(type == null) type = UnitTypes.dagger;
|
||||||
begin = data.getInt("begin", 0);
|
begin = data.getInt("begin", 0);
|
||||||
end = data.getInt("end", never);
|
end = data.getInt("end", never);
|
||||||
@@ -138,7 +138,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
shieldScaling = data.getFloat("shieldScaling", 0);
|
shieldScaling = data.getFloat("shieldScaling", 0);
|
||||||
unitAmount = data.getInt("amount", 1);
|
unitAmount = data.getInt("amount", 1);
|
||||||
spawn = data.getInt("spawn", -1);
|
spawn = data.getInt("spawn", -1);
|
||||||
if(data.has("payloads")) payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.getByName(ContentType.unit, s));
|
if(data.has("payloads")) payloads = Seq.with(json.readValue(String[].class, data.get("payloads"))).map(s -> content.unit(s));
|
||||||
if(data.has("items")) items = json.readValue(ItemStack.class, data.get("items"));
|
if(data.has("items")) items = json.readValue(ItemStack.class, data.get("items"));
|
||||||
|
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ public class SpawnGroup implements JsonSerializable, Cloneable{
|
|||||||
if(data.has("effect") && data.get("effect").isNumber() && data.getInt("effect", -1) == 8){
|
if(data.has("effect") && data.get("effect").isNumber() && data.getInt("effect", -1) == 8){
|
||||||
effect = StatusEffects.boss;
|
effect = StatusEffects.boss;
|
||||||
}else{
|
}else{
|
||||||
effect = content.getByName(ContentType.status, data.has("effect") && data.get("effect").isString() ? data.getString("effect", "none") : "none");
|
effect = content.statusEffect(data.has("effect") && data.get("effect").isString() ? data.getString("effect", "none") : "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ public abstract class FilterOption{
|
|||||||
.setRegion(supplier.get() == Blocks.air ? Icon.none.getRegion() : supplier.get().uiIcon)).size(iconSmall), () -> {
|
.setRegion(supplier.get() == Blocks.air ? Icon.none.getRegion() : supplier.get().uiIcon)).size(iconSmall), () -> {
|
||||||
BaseDialog dialog = new BaseDialog("@filter.option." + name);
|
BaseDialog dialog = new BaseDialog("@filter.option." + name);
|
||||||
dialog.cont.pane(t -> {
|
dialog.cont.pane(t -> {
|
||||||
|
t.margin(14f);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Block block : Vars.content.blocks()){
|
for(Block block : Vars.content.blocks()){
|
||||||
if(!filter.get(block)) continue;
|
if(!filter.get(block)) continue;
|
||||||
@@ -120,7 +121,7 @@ public abstract class FilterOption{
|
|||||||
if(++i % 10 == 0) t.row();
|
if(++i % 10 == 0) t.row();
|
||||||
}
|
}
|
||||||
dialog.setFillParent(i > 100);
|
dialog.setFillParent(i > 100);
|
||||||
}).padRight(8f).scrollX(false);
|
}).scrollX(false);
|
||||||
|
|
||||||
|
|
||||||
dialog.addCloseButton();
|
dialog.addCloseButton();
|
||||||
|
|||||||
@@ -85,9 +85,11 @@ public class ItemSelection{
|
|||||||
|
|
||||||
Table main = new Table().background(Styles.black6);
|
Table main = new Table().background(Styles.black6);
|
||||||
if(rowCount > rows * 1.5f){
|
if(rowCount > rows * 1.5f){
|
||||||
search = main.field(null, text -> rebuild.run()).width(40 * columns).padBottom(4).left().growX().get();
|
main.table(s -> {
|
||||||
search.setMessageText("@players.search");
|
s.image(Icon.zoom).padLeft(4f);
|
||||||
main.row();
|
search = s.field(null, text -> rebuild.run()).width(40 * columns).padBottom(4).left().growX().get();
|
||||||
|
search.setMessageText("@players.search");
|
||||||
|
}).row();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(cont, Styles.smallPane);
|
ScrollPane pane = new ScrollPane(cont, Styles.smallPane);
|
||||||
@@ -101,7 +103,7 @@ public class ItemSelection{
|
|||||||
}
|
}
|
||||||
|
|
||||||
pane.setOverscroll(false, false);
|
pane.setOverscroll(false, false);
|
||||||
main.add(pane).maxHeight(40 * rows);
|
main.add(pane).growX().maxHeight(40 * rows);
|
||||||
table.top().add(main);
|
table.top().add(main);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user