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.
This commit is contained in:
37
scripts/Core/GameState.cs
Normal file
37
scripts/Core/GameState.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user