From 717a620ff4ffc62675c980ee0b726c86d53d00a5 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 16 Oct 2021 14:51:53 -0400 Subject: [PATCH] Unpause game in logic variable dialog if necessary --- core/src/mindustry/logic/LogicDialog.java | 13 +++++++++++++ core/src/mindustry/ui/dialogs/BaseDialog.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LogicDialog.java b/core/src/mindustry/logic/LogicDialog.java index 115526d70f19..6331d4031af1 100644 --- a/core/src/mindustry/logic/LogicDialog.java +++ b/core/src/mindustry/logic/LogicDialog.java @@ -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.*; @@ -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 -> { diff --git a/core/src/mindustry/ui/dialogs/BaseDialog.java b/core/src/mindustry/ui/dialogs/BaseDialog.java index b99b164ca4b4..3087addd32e6 100644 --- a/core/src/mindustry/ui/dialogs/BaseDialog.java +++ b/core/src/mindustry/ui/dialogs/BaseDialog.java @@ -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){