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

55
scripts/Data/GameSeed.cs Normal file
View File

@@ -0,0 +1,55 @@
using System;
namespace TheGame
{
public class GameSeed
{
public string SeedValue { get; set; }
public DateTime CreatedDate { get; set; }
public string DisplayName { get; set; }
public GameSeed()
{
SeedValue = GenerateNewSeed();
CreatedDate = DateTime.Now;
DisplayName = $"Game {CreatedDate:yyyy-MM-dd HH:mm}";
}
public GameSeed(string customSeed, string displayName = "")
{
SeedValue = customSeed;
CreatedDate = DateTime.Now;
DisplayName = string.IsNullOrEmpty(displayName) ? $"Game {CreatedDate:yyyy-MM-dd HH:mm}" : displayName;
}
private static string GenerateNewSeed()
{
// Generera en 8-tecken seed baserad på timestamp och random
var random = new Random();
var timestamp = DateTime.Now.Ticks;
var combined = timestamp + random.Next(1000, 9999);
// Konvertera till hexadecimal och ta första 8 tecknen
return Math.Abs(combined).ToString("X")[..8];
}
public override string ToString()
{
return $"{DisplayName} (Seed: {SeedValue})";
}
public override bool Equals(object obj)
{
if (obj is GameSeed other)
{
return SeedValue.Equals(other.SeedValue);
}
return false;
}
public override int GetHashCode()
{
return SeedValue.GetHashCode();
}
}
}

View File

@@ -0,0 +1 @@
uid://bibp6hpk275ab