summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2022-10-15 17:16:28 +0200
committerilotterytea <iltsu@alright.party>2022-10-15 17:16:28 +0200
commit768d4000bf4cc4389d4c984a70c55777384ba29a (patch)
treeddc86b68fe3dbd76b2d74d5dbda1dd059982b961
parent6661e7129ef8027f44ca3cba1025d753bfb85d1e (diff)
update the elapsed time and last timestamp
-rw-r--r--core/src/com/ilotterytea/maxoning/screens/GameScreen.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java
index e0d2624..f2e5716 100644
--- a/core/src/com/ilotterytea/maxoning/screens/GameScreen.java
+++ b/core/src/com/ilotterytea/maxoning/screens/GameScreen.java
@@ -33,6 +33,7 @@ import java.util.Map;
public class GameScreen implements Screen, InputProcessor {
final MaxonGame game;
final int slotId;
+ final long playTimestamp;
MaxonSavegame player;
@@ -57,6 +58,7 @@ public class GameScreen implements Screen, InputProcessor {
public GameScreen(MaxonGame game, MaxonSavegame sav, int slotId) throws IOException, ClassNotFoundException {
this.game = game;
this.slotId = slotId;
+ this.playTimestamp = System.currentTimeMillis();
player = sav;
@@ -385,7 +387,9 @@ public class GameScreen implements Screen, InputProcessor {
@Override
public boolean keyDown(int keycode) {
if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
- GameDataSystem.save(player, String.format("%s.sav", (slotId >= 0) ? slotId : "latest"));
+ player.lastTimestamp = System.currentTimeMillis();
+ player.elapsedTime = System.currentTimeMillis() - playTimestamp;
+ GameDataSystem.save(player, String.format("0%s.maxon", (slotId >= 0) ? slotId : "latest"));
game.setScreen(new MenuScreen(game));
dispose();