Delete the old run, settings, layout and loadout authorities (Cut 10)

The deletion line lands before RunSave, as the spec orders. Deleted, not
demoted:
- PlayerSettings.SavedRun (Key 1 stays unclaimed) and the SavedGame
  constructor that upserted a fresh SavedZone per zone on every save.
- ActionGameManager: the PlayerSettings.msgpack getter, file path and
  writer; the .loadout format (_loadoutPath, Loadouts, SaveLoadout and its
  default-options serializer, the commented loader); OnApplicationQuit and
  SaveState; SaveZone, which had no caller.
- MainMenu's SavedRun Continue branch and both `SavedRun = null` writes.
- InventoryPanel's Save Loadout and Restore Loadout bodies.
- InputDisplayLayout's KeyboardLayouts file reader, ParseJson,
  AssociateInputKeys, SaveLayout and the usings they alone needed.
- AetherDb's Cut 9 importer (Import.cs, legacy-census, import).
- The three-gates note on loading writes; Cut 3 made loading non-writing.
- .gitignore ignores GameData/run.cc and GameData/player.cc instead of
  PlayerSettings.msgpack.

DOES NOT BUILD in Unity: ActionGameManager, MainMenu and InputDisplayLayout
still reference the deleted members until the next commit wires RunSave,
the settings getter and the catalog layout read. Headless builds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-14 21:51:10 +02:00
commit 5c5c3d5e19
11 changed files with 6 additions and 508 deletions

View file

@ -55,23 +55,6 @@ public class ActionGameManager : MonoBehaviour
}
}
private static PlayerSettings _playerSettings;
public static PlayerSettings PlayerSettings
{
get
{
return _playerSettings ??= File.Exists(_playerSettingsFilePath)
? MessagePackSerializer.Deserialize<PlayerSettings>(File.ReadAllBytes(_playerSettingsFilePath), CultDocumentMessagePackSerialization.OptionsFor(typeof(PlayerSettings).Assembly))
: GetDefaultPlayerSettings();
}
}
private static string _playerSettingsFilePath => Path.Combine(GameDataDirectory.FullName, "PlayerSettings.msgpack");
public static void SavePlayerSettings()
{
File.WriteAllBytes(_playerSettingsFilePath, MessagePackSerializer.Serialize(_playerSettings, CultDocumentMessagePackSerialization.OptionsFor(typeof(PlayerSettings).Assembly)));
}
private static PlayerSettings GetDefaultPlayerSettings()
{
var settings = new PlayerSettings();
@ -161,7 +144,6 @@ public class ActionGameManager : MonoBehaviour
// private CinemachineFramingTransposer _transposer;
// private CinemachineComposer _composer;
private DirectoryInfo _loadoutPath;
private bool _paused;
private float _time;
private int _zoomLevelIndex;
@ -205,7 +187,6 @@ public class ActionGameManager : MonoBehaviour
public ItemManager ItemManager { get; private set; }
public Zone Zone { get; private set; }
public List<EntityPack> Loadouts { get; } = new List<EntityPack>();
private readonly (float2 direction, string name)[] _directions = {
(float2(0, 1), "Front"),
@ -224,24 +205,6 @@ public class ActionGameManager : MonoBehaviour
get => MessagePackSerializer.Deserialize<EntitySettings>(MessagePackSerializer.Serialize(Settings.GameplaySettings.DefaultEntitySettings));
}
public void SaveLoadout(EntityPack pack)
{
File.WriteAllBytes(Path.Combine(_loadoutPath.FullName, $"{pack.Name}.loadout"), MessagePackSerializer.Serialize(pack));
}
private void OnApplicationQuit() => SaveState();
public void SaveState()
{
PlayerSettings.SavedRun = CurrentGalaxy == null ? null : new SavedGame(CultCache, CurrentGalaxy, Zone, DockedEntity ?? CurrentEntity);
if(PlayerSettings.SavedRun != null)
{
PlayerSettings.SavedRun.IsTutorial = IsTutorial;
PlayerSettings.SavedRun.ActionBarBindings = _actionBarSlots.Select(slot => slot.Save()).ToArray();
}
SavePlayerSettings();
}
private void OnDisable()
{
Input.Dispose();
@ -264,10 +227,6 @@ public class ActionGameManager : MonoBehaviour
// TODO: Process Stories
// _loadoutPath = GameDataDirectory.CreateSubdirectory("Loadouts");
// Loadouts.AddRange(_loadoutPath.EnumerateFiles("*.loadout")
// .Select(fi => MessagePackSerializer.Deserialize<EntityPack>(File.ReadAllBytes(fi.FullName))));
#region Input Handling
Input = new AetheriaInput();
@ -1084,9 +1043,6 @@ public class ActionGameManager : MonoBehaviour
});
}
public void SaveZone(string name) => File.WriteAllBytes(
Path.Combine(_gameDataDirectory.FullName, $"{name}.zone"), MessagePackSerializer.Serialize(Zone.PackZone()));
// public void ToggleEditMode()
// {
// _editMode = !_editMode;

View file

@ -8,7 +8,6 @@ using MessagePack;
public class PlayerSettings
{
[Key(0)] public string Name = "Anonymous";
[Key(1)] public SavedGame SavedRun;
[Key(2)] public bool TutorialPassed;
[Key(3)] public Dictionary<string, string> HashedStoryFiles = new Dictionary<string, string>();
[Key(4)] public PlayerGameplaySettings GameplaySettings = new PlayerGameplaySettings();

View file

@ -48,40 +48,6 @@ public class SavedGame
[Key(12)]
public FactionRelationship[] Relationships;
public SavedGame() { }
// Writes a SavedZone record for every galaxy zone through the cache.
public SavedGame(CultCache cache, Galaxy galaxy, Zone currentZone, Entity currentEntity)
{
DiscoveredZones = galaxy.DiscoveredZones.Select(dz => Array.IndexOf(galaxy.Zones, dz)).ToArray();
Background = galaxy.Background;
var factions = galaxy.HomeZones.Keys.ToArray();
Factions = factions.Select(f => cache.RefOf(f)).ToArray();
Relationships = galaxy.Factions.Select(f => galaxy.FactionRelationships[f]).ToArray();
HomeZones = galaxy.HomeZones.ToDictionary(
x => Array.IndexOf(factions, x.Key),
x => Array.IndexOf(galaxy.Zones, x.Value));
BossZones = galaxy.BossZones.ToDictionary(
x => Array.IndexOf(factions, x.Key),
x => Array.IndexOf(galaxy.Zones, x.Value));
Zones = galaxy.Zones.Select(zone => cache.Upsert(new SavedZone
{
Name = zone.Name,
Position = zone.Position,
AdjacentZones = zone.AdjacentZones.Select(az=> Array.IndexOf(galaxy.Zones, az)).ToArray(),
Factions = zone.Factions.Select(f=> Array.IndexOf(factions, f)).ToArray(),
Contents = zone.Contents?.PackZone(),
Owner = zone.Owner == null ? -1 : Array.IndexOf(factions, zone.Owner)
})).ToArray();
CurrentZone = Array.FindIndex(galaxy.Zones, zone => zone.Contents == currentZone);
CurrentZoneEntity = currentZone.Entities.IndexOf(currentEntity);
Entrance = Array.IndexOf(galaxy.Zones, galaxy.Entrance);
Exit = Array.IndexOf(galaxy.Zones, galaxy.Exit);
}
}
[CultDocument("aetheria.savedzone", "1"), MessagePackObject]

View file

@ -1,11 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MessagePack;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using TMPro;
using UniRx;
using UnityEngine;
@ -85,11 +81,6 @@ public class InputDisplayLayout : MonoBehaviour
void Start()
{
_canvas = transform.root.GetComponent<Canvas>();
var path = Path.Combine(ActionGameManager.GameDataDirectory.CreateSubdirectory("KeyboardLayouts").FullName, $"{LayoutFile.name}.msgpack");
// _inputLayout = ParseJson(LayoutFile.text);
_inputLayout = MessagePackSerializer.Deserialize<InputLayout>(File.ReadAllBytes(path));
// _inputLayout = JsonConvert.DeserializeObject<InputLayout>(File.ReadAllText(path));
// SaveLayout();
DisplayLayout(_inputLayout);
_buttonMappings.Add(MapMouseButton(MouseLeft, "<Mouse>/leftButton"));
@ -147,8 +138,6 @@ public class InputDisplayLayout : MonoBehaviour
RegisterMouseCallbacks();
});
//StartCoroutine(AssociateInputKeys(_inputLayout));
}
private ButtonMapping MapMouseButton(InputDisplayButton button, string path)
@ -383,121 +372,6 @@ public class InputDisplayLayout : MonoBehaviour
}
}
public InputLayout ParseJson(string layout)
{
var rows = new List<InputLayoutRow>();
var nextWidth = 1f;
var nextHeight = 1;
var reader = new JsonTextReader(new StringReader(layout));
reader.Read();
if (reader.TokenType != JsonToken.StartArray)
throw new JsonReaderException($"Unexpected JSON format in line {reader.LineNumber}:{reader.LinePosition}, expected: StartArray, received: {Enum.GetName(typeof(JsonToken), reader.TokenType)}");
while(reader.Read() && reader.TokenType != JsonToken.EndArray)
{
if (reader.TokenType != JsonToken.StartArray)
throw new JsonReaderException($"Unexpected JSON format in line {reader.LineNumber}:{reader.LinePosition}, expected: StartArray, received: {Enum.GetName(typeof(JsonToken), reader.TokenType)}");
var row = new InputLayoutKeyRow();
var columns = new List<InputLayoutColumn>();
while (reader.Read() && reader.TokenType != JsonToken.EndArray)
{
switch (reader.TokenType)
{
case JsonToken.StartObject:
while(reader.Read() && reader.TokenType != JsonToken.EndObject)
{
switch (reader.Value.ToString())
{
case "a": break;
case "w":
nextWidth = (float) (reader.ReadAsDouble() ?? 1.0);
break;
case "h":
nextHeight = reader.ReadAsInt32() ?? 1;
break;
case "y":
rows.Add(new InputLayoutRowSpacer{Height = (float) (reader.ReadAsDouble() ?? 0.0)});
break;
case "x":
columns.Add(new InputLayoutColumnSpacer{Width = (float) (reader.ReadAsDouble() ?? 0.0)});
break;
}
}
break;
case JsonToken.String:
InputLayoutKey key;
var v = reader.Value.ToString().Trim();
if (!string.IsNullOrEmpty(v))
{
var labels = v.Split('\n');
key = nextHeight != 1 ? new InputLayoutMultiRowKey {Height = nextHeight} : new InputLayoutBindableKey();
nextHeight = 1;
((InputLayoutBindableKey) key).MainLabel = labels.Length == 2 ? labels[1] : v;
((InputLayoutBindableKey) key).AltLabel = labels.Length == 2 ? labels[0] : "";
}
else
key = new InputLayoutKey();
key.Width = nextWidth;
columns.Add(key);
nextWidth = 1f;
break;
default:
throw new JsonReaderException($"Unexpected JSON format in line {reader.LineNumber}:{reader.LinePosition}");
}
}
row.Columns = columns.ToArray();
rows.Add(row);
}
return new InputLayout {Rows = rows.ToArray()};
}
private IEnumerator AssociateInputKeys()
{
var path = "";
var keyPress = new InputAction(binding: "/<Keyboard>/<button>");
keyPress.performed += context =>
{
if (context.control.path.EndsWith("anyKey")) return;
path = context.control.path;
};
keyPress.Enable();
foreach (var button in _buttonMappings)
{
button.DisplayButton.Outline.color = HighlightColor;
var fillColor = HighlightColor;
fillColor *= FillMultiplier;
fillColor.a = FillAlpha;
button.DisplayButton.Fill.color = fillColor;
path = "";
while (string.IsNullOrEmpty(path)) yield return null;
button.Button.InputSystemPath = path;
//Debug.Log($"Bound \"{path}\" to \"{bindableKey.MainLabel}\"");
button.DisplayButton.Outline.color = DefaultColor;
fillColor = DefaultColor;
fillColor *= FillMultiplier;
fillColor.a = FillAlpha;
button.DisplayButton.Fill.color = fillColor;
}
keyPress.Disable();
SaveLayout();
}
private void SaveLayout()
{
File.WriteAllBytes(
Path.Combine(ActionGameManager.GameDataDirectory.CreateSubdirectory("KeyboardLayouts").FullName, $"{LayoutFile.name}.msgpack"),
MessagePackSerializer.Serialize(_inputLayout));
}
private void OnEnable()
{
foreach(var buttonMapping in _buttonMappings)

View file

@ -91,22 +91,6 @@ public class MainMenu : MonoBehaviour
{
_nextMenu.panel.Clear();
_nextMenu.panel.Title.text = TitleSubtitle("aetheria", "terminus");
if (!InGame)
{
if(ActionGameManager.PlayerSettings.SavedRun != null)
_nextMenu.panel.AddButton("Continue",
() =>
{
ActionGameManager.IsTutorial = ActionGameManager.PlayerSettings.SavedRun.IsTutorial;
ActionGameManager.CurrentGalaxy = new Galaxy(
ActionGameManager.CultCache,
ActionGameManager.PlayerSettings.SavedRun,
Debug.Log);
SceneManager.LoadScene("ARPG");
});
else
_nextMenu.panel.AddButton("Continue", null);
}
_nextMenu.panel.AddButton("New Game",
() =>
{
@ -135,7 +119,6 @@ public class MainMenu : MonoBehaviour
setState);
Observable.NextFrame().Subscribe(_ =>
{
ActionGameManager.PlayerSettings.SavedRun = null;
ActionGameManager.CurrentGalaxy = sector;
SceneManager.LoadScene("ARPG");
});
@ -164,7 +147,6 @@ public class MainMenu : MonoBehaviour
setState);
Observable.NextFrame().Subscribe(_ =>
{
ActionGameManager.PlayerSettings.SavedRun = null;
ActionGameManager.CurrentGalaxy = sector;
SceneManager.LoadScene("ARPG");
});

View file

@ -166,33 +166,6 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
if(GameManager.DockingBay!=null && _displayedCargo!=GameManager.DockingBay)
ContextMenu.AddOption(GameManager.DockingBay.Name, () => Display(GameManager.DockingBay));
ContextMenu.AddOption("Save Loadout",
() =>
{
GameManager.SaveLoadout(EntitySerializer.Pack(_displayedEntity));
});
if (GameManager.Loadouts.Any())
{
ContextMenu.AddDropdown("Restore Loadout",
GameManager.Loadouts.Select<EntityPack, (string text, Action action, bool enabled)>(pack =>
(
$"{pack.Name} - {pack.Price(GameManager.ItemManager):n0}", () =>
{
var entity = EntitySerializer.Unpack(GameManager.ItemManager, GameManager.Zone, pack, true);
entity.SetParent(GameManager.DockedEntity);
GameManager.Credits -= pack.Price(GameManager.ItemManager);
GameManager.CurrentEntity = entity;
if(entity is Ship ship)
{
ship.IsPlayerShip = true;
GameManager.DockingBay.DockedShip = ship;
}
Display(entity);
}, pack.Price(GameManager.ItemManager) < GameManager.Credits
)));
}
ContextMenu.Show();
});