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:
Björn Blomberg
2025-10-17 14:50:40 +02:00
parent 74062a37d6
commit ed4ce28921
41 changed files with 173 additions and 8 deletions

View File

@@ -0,0 +1,57 @@
using System;
namespace TheGame
{
public class SaveInstance
{
public string InstanceId { get; set; }
public float GameTime { get; set; }
public DateTime SaveDate { get; set; }
public string DisplayName { get; set; }
public bool IsAutoSave { get; set; } = false;
public SaveInstance()
{
InstanceId = Guid.NewGuid().ToString("N")[..8]; // 8-tecken ID
SaveDate = DateTime.Now;
DisplayName = $"Save {SaveDate:HH:mm:ss}";
}
public SaveInstance(float gameTime, string displayName = "", bool isAutoSave = false)
{
InstanceId = Guid.NewGuid().ToString("N")[..8];
GameTime = gameTime;
SaveDate = DateTime.Now;
IsAutoSave = isAutoSave;
if (string.IsNullOrEmpty(displayName))
{
if (isAutoSave)
{
DisplayName = $"Auto-save {SaveDate:HH:mm:ss}";
}
else
{
DisplayName = $"Save {SaveDate:HH:mm:ss}";
}
}
else
{
DisplayName = displayName;
}
}
public string GetFormattedGameTime()
{
int hours = (int)(GameTime / 3600);
int minutes = (int)((GameTime % 3600) / 60);
int seconds = (int)(GameTime % 60);
return $"{hours:D2}:{minutes:D2}:{seconds:D2}";
}
public override string ToString()
{
return $"{DisplayName} - {GetFormattedGameTime()} ({SaveDate:yyyy-MM-dd HH:mm:ss})";
}
}
}