Исправить паузу после возврата в игру

This commit is contained in:
2026-08-18 01:03:50 +03:00
parent 8ee8cff773
commit 20357c4c29
3 changed files with 117 additions and 0 deletions
@@ -45,16 +45,26 @@ public final class GameView extends View implements Runnable {
private final boolean completed;
private final boolean playerAlive;
private final boolean allDoorsOpen;
private final boolean visiblyPaused;
private final boolean inputActive;
private final int levelNumber;
private final long elapsedMilliseconds;
private final float playerX;
private final float playerY;
private final int deaths;
private final int corpseCount;
AutomationSnapshot(boolean completed, boolean playerAlive, boolean allDoorsOpen,
boolean visiblyPaused, boolean inputActive, int levelNumber,
long elapsedMilliseconds,
float playerX, float playerY, int deaths, int corpseCount) {
this.completed = completed;
this.playerAlive = playerAlive;
this.allDoorsOpen = allDoorsOpen;
this.visiblyPaused = visiblyPaused;
this.inputActive = inputActive;
this.levelNumber = levelNumber;
this.elapsedMilliseconds = elapsedMilliseconds;
this.playerX = playerX;
this.playerY = playerY;
this.deaths = deaths;
@@ -64,6 +74,10 @@ public final class GameView extends View implements Runnable {
public boolean completed() { return completed; }
public boolean playerAlive() { return playerAlive; }
public boolean allDoorsOpen() { return allDoorsOpen; }
public boolean visiblyPaused() { return visiblyPaused; }
public boolean inputActive() { return inputActive; }
public int levelNumber() { return levelNumber; }
public long elapsedMilliseconds() { return elapsedMilliseconds; }
public float playerX() { return playerX; }
public float playerY() { return playerY; }
public int deaths() { return deaths; }
@@ -174,6 +188,7 @@ public final class GameView extends View implements Runnable {
public void setPaused(boolean value) {
paused = value;
if (value && screen == Screen.PLAYING) userPaused = true;
pointers.clear();
deriveControls();
lastFrameNanos = System.nanoTime();
@@ -1117,6 +1132,10 @@ public final class GameView extends View implements Runnable {
screen == Screen.COMPLETE,
player.alive,
allOpen,
userPaused,
leftPressed || rightPressed || jumpPressed,
level == null ? 0 : level.number,
(long) (levelElapsed * 1000f),
player.x,
player.y,
deaths,