Made built-in variables viewable in editor
This commit is contained in:
@@ -153,6 +153,12 @@ public class LogicDialog extends BaseDialog{
|
|||||||
if(Core.graphics.isPortrait()) buttons.row();
|
if(Core.graphics.isPortrait()) buttons.row();
|
||||||
|
|
||||||
buttons.button("@variables", Icon.menu, () -> {
|
buttons.button("@variables", Icon.menu, () -> {
|
||||||
|
//in the editor, it should display the global variables only (the button text is different)
|
||||||
|
if(!shouldShowVariables()){
|
||||||
|
globalsDialog.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BaseDialog dialog = new BaseDialog("@variables");
|
BaseDialog dialog = new BaseDialog("@variables");
|
||||||
dialog.hidden(() -> {
|
dialog.hidden(() -> {
|
||||||
if(!wasPaused && !net.active() && !state.isMenu()){
|
if(!wasPaused && !net.active() && !state.isMenu()){
|
||||||
@@ -167,6 +173,7 @@ public class LogicDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
dialog.cont.pane(p -> {
|
dialog.cont.pane(p -> {
|
||||||
|
|
||||||
p.margin(10f).marginRight(16f);
|
p.margin(10f).marginRight(16f);
|
||||||
p.table(Tex.button, t -> {
|
p.table(Tex.button, t -> {
|
||||||
t.defaults().fillX().height(45f);
|
t.defaults().fillX().height(45f);
|
||||||
@@ -220,7 +227,13 @@ public class LogicDialog extends BaseDialog{
|
|||||||
dialog.buttons.button("@logic.globals", Icon.list, () -> globalsDialog.show()).size(210f, 64f);
|
dialog.buttons.button("@logic.globals", Icon.list, () -> globalsDialog.show()).size(210f, 64f);
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}).name("variables").disabled(b -> executor == null || executor.vars.length == 0 || state.isMenu());
|
}).name("variables").update(b -> {
|
||||||
|
if(shouldShowVariables()){
|
||||||
|
b.setText("@variables");
|
||||||
|
}else{
|
||||||
|
b.setText("@logic.globals");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
buttons.button("@add", Icon.add, () -> {
|
buttons.button("@add", Icon.add, () -> {
|
||||||
showAddDialog();
|
showAddDialog();
|
||||||
@@ -229,6 +242,10 @@ public class LogicDialog extends BaseDialog{
|
|||||||
Core.app.post(canvas::rebuild);
|
Core.app.post(canvas::rebuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldShowVariables(){
|
||||||
|
return executor != null && executor.vars.length > 0 && !state.isMenu();
|
||||||
|
}
|
||||||
|
|
||||||
public void showAddDialog(){
|
public void showAddDialog(){
|
||||||
BaseDialog dialog = new BaseDialog("@add");
|
BaseDialog dialog = new BaseDialog("@add");
|
||||||
dialog.cont.table(table -> {
|
dialog.cont.table(table -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user