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.
57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
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})";
|
|
}
|
|
}
|
|
} |