Skip to content

Commit

Permalink
Unpause game in logic variable dialog if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuken committed Oct 16, 2021
1 parent 9dfd4d0 commit 717a620
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions core/src/mindustry/logic/LogicDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import arc.scene.ui.*;
import arc.scene.ui.TextButton.*;
import arc.util.*;
import mindustry.core.GameState.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.graphics.*;
Expand Down Expand Up @@ -66,6 +67,18 @@ public LogicDialog(){

buttons.button("@variables", Icon.menu, () -> {
BaseDialog dialog = new BaseDialog("@variables");
dialog.hidden(() -> {
if(!wasPaused){
state.set(State.paused);
}
});

dialog.shown(() -> {
if(!wasPaused){
state.set(State.playing);
}
});

dialog.cont.pane(p -> {
p.margin(10f).marginRight(16f);
p.table(Tex.button, t -> {
Expand Down
2 changes: 1 addition & 1 deletion core/src/mindustry/ui/dialogs/BaseDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import static mindustry.Vars.*;

public class BaseDialog extends Dialog{
private boolean wasPaused;
protected boolean wasPaused;
protected boolean shouldPause;

public BaseDialog(String title, DialogStyle style){
Expand Down

0 comments on commit 717a620

Please sign in to comment.