Files
TheGame/scripts/Core/GameState.cs
Björn Blomberg ed4ce28921 Refactor: reorganize scripts with domain-driven design structure
Move all C# scripts from flat structure to organized folders:
- Core/ for game logic (Game, GameState, GameSettings)
- UI/Menus/ and UI/Dialogs/ for user interface
- Systems/ for reusable systems (Save, Localization)
- Data/ for data models and configuration
- Added framework for future: Gameplay/, Story/, Modding/

Update all .tscn scene files to reference new script paths.
Fix timing issue in AdvancedSaveDialog focus handling.
2025-10-17 14:50:40 +02:00

37 lines
1.1 KiB
C#

using Godot;
namespace TheGame
{
public static class GameState
{
public static float LoadedGameTime = -1;
public static GameSeed CurrentGameSeed = null;
public static SaveInstance LoadedInstance = null;
public static bool HasUnsavedProgress = false;
public static float LastSavedGameTime = 0;
public static void MarkProgressAsSaved(float gameTime)
{
LastSavedGameTime = gameTime;
HasUnsavedProgress = false;
}
public static void CheckUnsavedProgress(float currentGameTime)
{
// Om speltiden har ökat sedan senaste sparningen, markera som osparad
if (currentGameTime > LastSavedGameTime + 1.0f) // 1 sekund tolerans
{
HasUnsavedProgress = true;
}
}
public static void ResetGameState()
{
LoadedGameTime = -1;
CurrentGameSeed = null;
LoadedInstance = null;
HasUnsavedProgress = false;
LastSavedGameTime = 0;
}
}
}