Add actual ASCII-Art for distros, add first three distros and being able to choose a starting-distro. Update UI to fix multiple small bugs.

This commit is contained in:
2026-07-04 00:12:03 +02:00
parent 36ddc8fa1c
commit 00e990ac18
36 changed files with 1421 additions and 13 deletions
+50 -3
View File
@@ -1,4 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace KernelPanic.Meta
{
@@ -7,22 +10,66 @@ namespace KernelPanic.Meta
/// </summary>
public sealed class SaveService
{
private const string SaveFileName = "kernel-panic-save.json";
public string SavePath => Path.Combine(Application.persistentDataPath, SaveFileName);
public void Save(SaveData data)
{
throw new NotImplementedException();
data ??= new SaveData();
data.EnsureLists();
string directory = Path.GetDirectoryName(SavePath);
if (!string.IsNullOrEmpty(directory))
{
Directory.CreateDirectory(directory);
}
string json = JsonUtility.ToJson(data, true);
File.WriteAllText(SavePath, json);
}
public SaveData Load()
{
throw new NotImplementedException();
if (!File.Exists(SavePath))
{
return SaveData.CreateDefault();
}
try
{
SaveData data = JsonUtility.FromJson<SaveData>(File.ReadAllText(SavePath));
data ??= SaveData.CreateDefault();
data.EnsureLists();
return data;
}
catch (Exception ex)
{
Debug.LogWarning($"Save file could not be loaded; starting fresh. {ex.Message}");
return SaveData.CreateDefault();
}
}
}
/// <summary>
/// Stores persistent progression data for serialization.
/// </summary>
[Serializable]
public sealed class SaveData
{
public int EntropyBalance { get; set; }
public bool starterChosen;
public List<string> ownedUnitIds = new();
public List<string> bannerPoolIds = new();
public static SaveData CreateDefault()
{
return new SaveData();
}
public void EnsureLists()
{
ownedUnitIds ??= new List<string>();
bannerPoolIds ??= new List<string>();
}
}
}