This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package mindustry.editor;
|
package mindustry.editor;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.scene.event.*;
|
import arc.scene.event.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
@@ -14,14 +15,18 @@ import mindustry.gen.*;
|
|||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.io.*;
|
import mindustry.io.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
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 displayed = 20;
|
||||||
Seq<SpawnGroup> groups = new Seq<>();
|
Seq<SpawnGroup> groups = new Seq<>();
|
||||||
|
private SpawnGroup expandedGroup;
|
||||||
|
|
||||||
private Table table;
|
private Table table;
|
||||||
private int start = 0;
|
private int start = 0;
|
||||||
@@ -67,6 +72,12 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
buildGroups();
|
buildGroups();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}));
|
}));
|
||||||
|
dialog.cont.row();
|
||||||
|
dialog.cont.button("@clear", () -> ui.showConfirm("@confirm", "@settings.clear.confirm", () -> {
|
||||||
|
groups.clear();
|
||||||
|
buildGroups();
|
||||||
|
dialog.hide();
|
||||||
|
}));
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}).size(270f, 64f);
|
}).size(270f, 64f);
|
||||||
|
|
||||||
@@ -132,7 +143,10 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
main.row();
|
main.row();
|
||||||
main.button("@add", () -> {
|
main.button("@add", () -> {
|
||||||
if(groups == null) groups = new Seq<>();
|
if(groups == null) groups = new Seq<>();
|
||||||
groups.add(new SpawnGroup(lastType));
|
SpawnGroup newGroup = new SpawnGroup(lastType);
|
||||||
|
groups.add(newGroup);
|
||||||
|
expandedGroup = newGroup;
|
||||||
|
showUpdate(newGroup);
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}).growX().height(70f);
|
}).growX().height(70f);
|
||||||
}), new Label("@waves.none"){{
|
}), new Label("@waves.none"){{
|
||||||
@@ -153,6 +167,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
table.margin(10f);
|
table.margin(10f);
|
||||||
|
|
||||||
if(groups != null){
|
if(groups != null){
|
||||||
|
groups.sort(Comparator.comparing(g -> g.begin));
|
||||||
|
|
||||||
for(SpawnGroup group : groups){
|
for(SpawnGroup group : groups){
|
||||||
table.table(Tex.button, t -> {
|
table.table(Tex.button, t -> {
|
||||||
@@ -164,92 +179,100 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
|
|
||||||
b.add().growX();
|
b.add().growX();
|
||||||
|
|
||||||
b.button(Icon.cancel, () -> {
|
b.label(() -> (group.begin + 1) + "").color(Color.lightGray).minWidth(45f).labelAlign(Align.left).left();
|
||||||
|
|
||||||
|
b.button(Icon.unitsSmall, Styles.emptyi, () -> showUpdate(group)).pad(-6).size(46f);
|
||||||
|
b.button(Icon.cancel, Styles.emptyi, () -> {
|
||||||
groups.remove(group);
|
groups.remove(group);
|
||||||
table.getCell(t).pad(0f);
|
table.getCell(t).pad(0f);
|
||||||
t.remove();
|
t.remove();
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}).pad(-6).size(46f).padRight(-12f);
|
}).pad(-6).size(46f).padRight(-12f);
|
||||||
}, () -> showUpdate(group)).height(46f).pad(-6f).padBottom(0f).row();
|
}, () -> {
|
||||||
|
expandedGroup = expandedGroup == group ? null : group;
|
||||||
|
buildGroups();
|
||||||
|
}).height(46f).pad(-6f).padBottom(0f).row();
|
||||||
|
|
||||||
t.table(spawns -> {
|
if(expandedGroup == group){
|
||||||
spawns.field("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> {
|
t.table(spawns -> {
|
||||||
if(Strings.canParsePositiveInt(text)){
|
spawns.field("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> {
|
||||||
group.begin = Strings.parseInt(text) - 1;
|
if(Strings.canParsePositiveInt(text)){
|
||||||
updateWaves();
|
group.begin = Strings.parseInt(text) - 1;
|
||||||
}
|
updateWaves();
|
||||||
}).width(100f);
|
}
|
||||||
spawns.add("@waves.to").padLeft(4).padRight(4);
|
}).width(100f);
|
||||||
spawns.field(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
spawns.add("@waves.to").padLeft(4).padRight(4);
|
||||||
if(Strings.canParsePositiveInt(text)){
|
spawns.field(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
group.end = Strings.parseInt(text) - 1;
|
if(Strings.canParsePositiveInt(text)){
|
||||||
updateWaves();
|
group.end = Strings.parseInt(text) - 1;
|
||||||
}else if(text.isEmpty()){
|
updateWaves();
|
||||||
group.end = never;
|
}else if(text.isEmpty()){
|
||||||
updateWaves();
|
group.end = never;
|
||||||
}
|
updateWaves();
|
||||||
}).width(100f).get().setMessageText("∞");
|
}
|
||||||
}).row();
|
}).width(100f).get().setMessageText("∞");
|
||||||
|
}).row();
|
||||||
|
|
||||||
t.table(p -> {
|
t.table(p -> {
|
||||||
p.add("@waves.every").padRight(4);
|
p.add("@waves.every").padRight(4);
|
||||||
p.field(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
p.field(group.spacing + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(Strings.canParsePositiveInt(text) && Strings.parseInt(text) > 0){
|
if(Strings.canParsePositiveInt(text) && Strings.parseInt(text) > 0){
|
||||||
group.spacing = Strings.parseInt(text);
|
group.spacing = Strings.parseInt(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
}).width(100f);
|
}).width(100f);
|
||||||
p.add("@waves.waves").padLeft(4);
|
p.add("@waves.waves").padLeft(4);
|
||||||
}).row();
|
}).row();
|
||||||
|
|
||||||
t.table(a -> {
|
t.table(a -> {
|
||||||
a.field(group.unitAmount + "", TextFieldFilter.digitsOnly, text -> {
|
a.field(group.unitAmount + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(Strings.canParsePositiveInt(text)){
|
if(Strings.canParsePositiveInt(text)){
|
||||||
group.unitAmount = Strings.parseInt(text);
|
group.unitAmount = Strings.parseInt(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
}).width(80f);
|
}).width(80f);
|
||||||
|
|
||||||
a.add(" + ");
|
a.add(" + ");
|
||||||
a.field(Strings.fixed(Math.max((Mathf.zero(group.unitScaling) ? 0 : 1f / group.unitScaling), 0), 2), TextFieldFilter.floatsOnly, text -> {
|
a.field(Strings.fixed(Math.max((Mathf.zero(group.unitScaling) ? 0 : 1f / group.unitScaling), 0), 2), TextFieldFilter.floatsOnly, text -> {
|
||||||
if(Strings.canParsePositiveFloat(text)){
|
if(Strings.canParsePositiveFloat(text)){
|
||||||
group.unitScaling = 1f / Strings.parseFloat(text);
|
group.unitScaling = 1f / Strings.parseFloat(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
}).width(80f);
|
}).width(80f);
|
||||||
a.add("@waves.perspawn").padLeft(4);
|
a.add("@waves.perspawn").padLeft(4);
|
||||||
}).row();
|
}).row();
|
||||||
|
|
||||||
t.table(a -> {
|
t.table(a -> {
|
||||||
a.field(group.max + "", TextFieldFilter.digitsOnly, text -> {
|
a.field(group.max + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(Strings.canParsePositiveInt(text)){
|
if(Strings.canParsePositiveInt(text)){
|
||||||
group.max = Strings.parseInt(text);
|
group.max = Strings.parseInt(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
}).width(80f);
|
}).width(80f);
|
||||||
|
|
||||||
a.add("@waves.max").padLeft(5);
|
a.add("@waves.max").padLeft(5);
|
||||||
}).row();
|
}).row();
|
||||||
|
|
||||||
t.table(a -> {
|
t.table(a -> {
|
||||||
a.field((int)group.shields + "", TextFieldFilter.digitsOnly, text -> {
|
a.field((int)group.shields + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(Strings.canParsePositiveInt(text)){
|
if(Strings.canParsePositiveInt(text)){
|
||||||
group.shields = Strings.parseInt(text);
|
group.shields = Strings.parseInt(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
}).width(80f);
|
}).width(80f);
|
||||||
|
|
||||||
a.add(" + ");
|
a.add(" + ");
|
||||||
a.field((int)group.shieldScaling + "", TextFieldFilter.digitsOnly, text -> {
|
a.field((int)group.shieldScaling + "", TextFieldFilter.digitsOnly, text -> {
|
||||||
if(Strings.canParsePositiveInt(text)){
|
if(Strings.canParsePositiveInt(text)){
|
||||||
group.shieldScaling = Strings.parseInt(text);
|
group.shieldScaling = Strings.parseInt(text);
|
||||||
updateWaves();
|
updateWaves();
|
||||||
}
|
}
|
||||||
}).width(80f);
|
}).width(80f);
|
||||||
a.add("@waves.shields").padLeft(4);
|
a.add("@waves.shields").padLeft(4);
|
||||||
}).row();
|
}).row();
|
||||||
|
|
||||||
t.check("@waves.guardian", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss)).padBottom(8f);
|
t.check("@waves.guardian", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss)).padBottom(8f);
|
||||||
|
}
|
||||||
}).width(340f).pad(8);
|
}).width(340f).pad(8);
|
||||||
|
|
||||||
table.row();
|
table.row();
|
||||||
@@ -281,6 +304,7 @@ public class WaveInfoDialog extends BaseDialog{
|
|||||||
if(++i % 3 == 0) p.row();
|
if(++i % 3 == 0) p.row();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
dialog.addCloseButton();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
http.socketTimeout=80000
|
http.socketTimeout=80000
|
||||||
http.connectionTimeout=80000
|
http.connectionTimeout=80000
|
||||||
archash=95a66af563dfad96ecc4992bd0ab36b07a14e28b
|
archash=7e96b986053ce489aae161aa6bcbb5d921c609d4
|
||||||
|
|||||||
Reference in New Issue
Block a user