mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-12-22 17:14:00 +07:00
Status apply statement cleanup
This commit is contained in:
parent
e94fd845eb
commit
1dacb7989e
@ -1324,15 +1324,11 @@ public class LStatements{
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
rebuild(table);
|
||||
}
|
||||
|
||||
void rebuild(Table table){
|
||||
table.clearChildren();
|
||||
|
||||
table.button(clear ? "clear" : "apply", Styles.logict, () -> {
|
||||
clear = !clear;
|
||||
rebuild(table);
|
||||
build(table);
|
||||
}).size(80f, 40f).pad(4f).color(table.color);
|
||||
|
||||
if(statusNames == null){
|
||||
@ -1343,11 +1339,10 @@ public class LStatements{
|
||||
b.label(() -> effect).grow().wrap().labelAlign(Align.center).center();
|
||||
b.clicked(() -> showSelect(b, statusNames, effect, o -> {
|
||||
effect = o;
|
||||
build(table);
|
||||
}, 2, c -> c.size(120f, 38f)));
|
||||
}, Styles.logict, () -> {}).size(120f, 40f).pad(4f).color(table.color);
|
||||
|
||||
//TODO effect select
|
||||
|
||||
table.add(clear ? " from " : " to ");
|
||||
|
||||
row(table);
|
||||
@ -2123,69 +2118,69 @@ public class LStatements{
|
||||
return LCategory.world;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RegisterStatement("playsound")
|
||||
public static class PlaySoundStatement extends LStatement{
|
||||
public boolean positional;
|
||||
public String id = "@sfx-pew", volume = "1", pitch = "1", pan = "0", x = "@thisx", y = "@thisy", limit = "true";
|
||||
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
rebuild(table);
|
||||
}
|
||||
|
||||
|
||||
void rebuild(Table table){
|
||||
table.clearChildren();
|
||||
|
||||
|
||||
table.button(positional ? "positional" : "global", Styles.logict, () -> {
|
||||
positional = !positional;
|
||||
rebuild(table);
|
||||
}).size(160f, 40f).pad(4f).color(table.color);
|
||||
|
||||
|
||||
row(table);
|
||||
|
||||
|
||||
field(table, id, str -> id = str).padRight(0f).get();
|
||||
|
||||
|
||||
table.button(b -> {
|
||||
b.image(Icon.pencilSmall);
|
||||
|
||||
|
||||
String soundName = id.startsWith("@sfx-") ? id.substring(5) : id;
|
||||
b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), soundName, t -> {
|
||||
id = "@sfx-" + t;
|
||||
rebuild(table);
|
||||
}, 2, cell -> cell.size(160, 50)));
|
||||
}, Styles.logict, () -> {}).size(40).color(table.color).left().padLeft(-1);
|
||||
|
||||
|
||||
row(table);
|
||||
|
||||
|
||||
fieldst(table, "volume", volume, str -> volume = str);
|
||||
fieldst(table, "pitch", pitch, str -> pitch = str);
|
||||
|
||||
|
||||
table.row();
|
||||
|
||||
|
||||
if(positional){
|
||||
fieldst(table, "x", x, str -> x = str);
|
||||
|
||||
|
||||
fieldst(table, "y", y, str -> y = str);
|
||||
}else{
|
||||
fieldst(table, "pan", pan, str -> pan = str);
|
||||
}
|
||||
|
||||
|
||||
table.row();
|
||||
|
||||
|
||||
fieldst(table, "limit", limit, str -> limit = str);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean privileged(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LInstruction build(LAssembler builder){
|
||||
return new PlaySoundI(positional, builder.var(id), builder.var(volume), builder.var(pitch), builder.var(pan), builder.var(x), builder.var(y), builder.var(limit));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LCategory category(){
|
||||
return LCategory.world;
|
||||
|
Loading…
Reference in New Issue
Block a user