Fixed the bug where time remains paused when back button is clicked.
import org.terasology.crashreporter.CrashReporter;
import org.terasology.engine.GameEngine;
import org.terasology.engine.LoggingContext;
+import org.terasology.engine.Time;
import org.terasology.engine.modes.StateMainMenu;
+import org.terasology.network.NetworkMode;
+import org.terasology.network.NetworkSystem;
import org.terasology.registry.CoreRegistry;
+import org.terasology.registry.In;
import org.terasology.rendering.nui.CoreScreenLayer;
import org.terasology.rendering.nui.WidgetUtil;
import org.terasology.telemetry.TelemetryScreen;
*/
public class PauseMenu extends CoreScreenLayer {
+ @In
+ private Time time;
+
+ @In
+ private NetworkSystem networkSystem;
+
@Override
public void initialise() {
WidgetUtil.trySubscribe(this, "close", widget -> getManager().closeScreen(PauseMenu.this));
@@ -44,4 +54,10 @@ public void onScreenOpened() {
getManager().removeOverlay( "engine:onlinePlayersOverlay" );
}
+ @Override
+ public void onClosed() {
+ if (networkSystem.getMode() == NetworkMode.NONE) {
+ time.setPaused(false);
+ }
+ }
}
