Delete legacy saved game DTOs
This commit is contained in:
parent
aa5addf040
commit
83ef113937
7 changed files with 9 additions and 228 deletions
|
|
@ -20,6 +20,9 @@ package, player settings and loadout edits are session-local and run saving is
|
|||
disabled. That is intentional: the missing runtime package is the owner gap, and
|
||||
the old bespoke file formats must not keep acting as durable truth while the
|
||||
state spine is being rebuilt.
|
||||
The old `SavedGame`/`SavedZone` DTOs and `Galaxy` loader constructor have also
|
||||
been deleted; the only save model left is the typed `AetheriaSavedRun` document
|
||||
family in this project.
|
||||
|
||||
Keyboard layout rendering now reads the checked-in Unity text asset directly.
|
||||
The old generated `GameData/KeyboardLayouts/*.msgpack` cache was deleted; layout
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using TMPro;
|
||||
using UniRx.Triggers;
|
||||
using UnityEngine;
|
||||
|
|
@ -39,48 +37,6 @@ public class ActionBarSlot : MonoBehaviour
|
|||
Binding?.Update();
|
||||
}
|
||||
|
||||
public SavedActionBarBinding Save()
|
||||
{
|
||||
return Binding switch
|
||||
{
|
||||
ActionBarConsumableBinding actionBarConsumableBinding => new SavedActionBarConsumableBinding
|
||||
{
|
||||
Target = new DatabaseLink<ConsumableItemData>{LinkID = actionBarConsumableBinding.Target.ID}
|
||||
},
|
||||
ActionBarGearBinding actionBarGearBinding => new SavedActionBarGearBinding
|
||||
{
|
||||
EquipmentIndex = actionBarGearBinding.Entity.Equipment.IndexOf(actionBarGearBinding.Item),
|
||||
BehaviorIndex = Array.IndexOf(actionBarGearBinding.Item.Behaviors, actionBarGearBinding.Behavior)
|
||||
},
|
||||
ActionBarWeaponGroupBinding actionBarWeaponGroupBinding => new SavedActionBarWeaponGroupBinding
|
||||
{
|
||||
Group = actionBarWeaponGroupBinding.Group
|
||||
},
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
public void Restore(SavedActionBarBinding binding, Entity entity)
|
||||
{
|
||||
Binding = binding switch
|
||||
{
|
||||
SavedActionBarConsumableBinding savedActionBarConsumableBinding =>
|
||||
new ActionBarConsumableBinding(
|
||||
entity,
|
||||
this,
|
||||
savedActionBarConsumableBinding.Target.Value),
|
||||
SavedActionBarGearBinding savedActionBarGearBinding =>
|
||||
new ActionBarGearBinding(
|
||||
entity,
|
||||
this,
|
||||
entity.Equipment[savedActionBarGearBinding.EquipmentIndex],
|
||||
entity.Equipment[savedActionBarGearBinding.EquipmentIndex]
|
||||
.Behaviors[savedActionBarGearBinding.BehaviorIndex] as IActivatedBehavior),
|
||||
SavedActionBarWeaponGroupBinding savedActionBarWeaponGroupBinding =>
|
||||
new ActionBarWeaponGroupBinding(entity, this, savedActionBarWeaponGroupBinding.Group),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class ActionBarBinding
|
||||
|
|
@ -173,10 +129,9 @@ public class ActionBarGearBinding : ActionBarBinding
|
|||
}
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class ActionBarWeaponGroupBinding : ActionBarBinding
|
||||
{
|
||||
[Key(0)] public int Group;
|
||||
public int Group;
|
||||
|
||||
public ActionBarWeaponGroupBinding(Entity entity, ActionBarSlot slot, int group) : base(entity, slot)
|
||||
{
|
||||
|
|
@ -206,4 +161,4 @@ public class ActionBarWeaponGroupBinding : ActionBarBinding
|
|||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
public void SaveState()
|
||||
{
|
||||
if (CurrentGalaxy != null)
|
||||
Debug.LogWarning("Run persistence belongs to the Verse state spine. Legacy SavedGame serialization is disabled.");
|
||||
Debug.LogWarning("Run persistence belongs to the Verse state spine. Legacy run serialization is disabled.");
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
|
|
|
|||
|
|
@ -44,51 +44,6 @@ public class Galaxy
|
|||
}
|
||||
}
|
||||
|
||||
public Galaxy(CultCache cultCache, SavedGame savedGame, Action<string> log)
|
||||
{
|
||||
IsPrelude = savedGame.IsTutorial;
|
||||
_cache = cultCache;
|
||||
Log = log;
|
||||
Background = savedGame.Background;
|
||||
|
||||
Factions = savedGame.Factions.Select(cultCache.Get<Faction>).ToArray();
|
||||
for (var i = 0; i < Factions.Length; i++)
|
||||
{
|
||||
FactionRelationships[Factions[i]] = savedGame.Relationships[i];
|
||||
}
|
||||
|
||||
Zones = savedGame.Zones.Select(zone =>
|
||||
{
|
||||
return new GalaxyZone
|
||||
{
|
||||
Name = zone.Name,
|
||||
Position = zone.Position,
|
||||
PackedContents = zone.Contents
|
||||
};
|
||||
}).ToArray();
|
||||
foreach (var i in savedGame.DiscoveredZones) DiscoveredZones.Add(Zones[i]);
|
||||
for (var i = 0; i < Zones.Length; i++)
|
||||
{
|
||||
Zones[i].AdjacentZones = savedGame.Zones[i].AdjacentZones.Select(azi => Zones[azi]).ToList();
|
||||
Zones[i].Factions = savedGame.Zones[i].Factions.Select(mi => Factions[mi]).ToArray();
|
||||
Zones[i].Owner = savedGame.Zones[i].Owner < 0 ? null : Factions[savedGame.Zones[i].Owner];
|
||||
}
|
||||
|
||||
HomeZones = savedGame.HomeZones.ToDictionary(
|
||||
x => Factions[x.Key],
|
||||
x => Zones[x.Value]);
|
||||
|
||||
BossZones = savedGame.BossZones.ToDictionary(
|
||||
x => Factions[x.Key],
|
||||
x => Zones[x.Value]);
|
||||
|
||||
Entrance = Zones[savedGame.Entrance];
|
||||
if(savedGame.Exit != -1)
|
||||
Exit = Zones[savedGame.Exit];
|
||||
|
||||
CalculateDistanceMatrix();
|
||||
}
|
||||
|
||||
public Galaxy(
|
||||
SectorGenerationSettings settings,
|
||||
SectorBackgroundSettings background,
|
||||
|
|
|
|||
|
|
@ -1,132 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MessagePack;
|
||||
using Unity.Mathematics;
|
||||
using static Unity.Mathematics.math;
|
||||
|
||||
[MessagePackObject]
|
||||
public class SavedGame
|
||||
{
|
||||
[Key(0)]
|
||||
public SavedZone[] Zones;
|
||||
|
||||
[Key(1)]
|
||||
public Guid[] Factions;
|
||||
|
||||
[Key(2)]
|
||||
public Dictionary<int, int> HomeZones;
|
||||
|
||||
[Key(3)]
|
||||
public Dictionary<int, int> BossZones;
|
||||
|
||||
[Key(4)]
|
||||
public int Entrance;
|
||||
|
||||
[Key(5)]
|
||||
public int Exit;
|
||||
|
||||
[Key(6)]
|
||||
public int CurrentZone;
|
||||
|
||||
[Key(7)]
|
||||
public int CurrentZoneEntity;
|
||||
|
||||
[Key(8)]
|
||||
public SectorBackgroundSettings Background;
|
||||
|
||||
[Key(9)]
|
||||
public int[] DiscoveredZones;
|
||||
|
||||
[Key(10)]
|
||||
public SavedActionBarBinding[] ActionBarBindings;
|
||||
|
||||
[Key(11)]
|
||||
public bool IsTutorial;
|
||||
|
||||
[Key(12)]
|
||||
public FactionRelationship[] Relationships;
|
||||
|
||||
public SavedGame() { }
|
||||
|
||||
public SavedGame(Galaxy galaxy, Zone currentZone, Entity currentEntity)
|
||||
{
|
||||
DiscoveredZones = galaxy.DiscoveredZones.Select(dz => Array.IndexOf(galaxy.Zones, dz)).ToArray();
|
||||
Background = galaxy.Background;
|
||||
Factions = galaxy.HomeZones.Keys.Select(f => f.ID).ToArray();
|
||||
Relationships = galaxy.Factions.Select(f => galaxy.FactionRelationships[f]).ToArray();
|
||||
|
||||
HomeZones = galaxy.HomeZones.ToDictionary(
|
||||
x => Array.IndexOf(Factions, x.Key.ID),
|
||||
x => Array.IndexOf(galaxy.Zones, x.Value));
|
||||
BossZones = galaxy.BossZones.ToDictionary(
|
||||
x => Array.IndexOf(Factions, x.Key.ID),
|
||||
x => Array.IndexOf(galaxy.Zones, x.Value));
|
||||
|
||||
Zones = galaxy.Zones.Select(zone => 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.ID)).ToArray(),
|
||||
Contents = zone.Contents?.PackZone(),
|
||||
Owner = zone.Owner == null ? -1 : Array.IndexOf(Factions, zone.Owner.ID)
|
||||
}).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);
|
||||
}
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class SavedZone
|
||||
{
|
||||
[Key(0)]
|
||||
public string Name;
|
||||
|
||||
[Key(1)]
|
||||
public float2 Position;
|
||||
|
||||
[Key(2)]
|
||||
public int[] AdjacentZones;
|
||||
|
||||
[Key(3)]
|
||||
public int[] Factions;
|
||||
|
||||
[Key(4)]
|
||||
public int Owner;
|
||||
|
||||
[Key(5)]
|
||||
public ZonePack Contents;
|
||||
}
|
||||
|
||||
[MessagePackObject,
|
||||
Union(0, typeof(SavedActionBarConsumableBinding)),
|
||||
Union(1, typeof(SavedActionBarGearBinding)),
|
||||
Union(2, typeof(SavedActionBarWeaponGroupBinding))
|
||||
]
|
||||
public abstract class SavedActionBarBinding
|
||||
{
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class SavedActionBarConsumableBinding : SavedActionBarBinding
|
||||
{
|
||||
[Key(0)] public DatabaseLink<ConsumableItemData> Target;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class SavedActionBarGearBinding : SavedActionBarBinding
|
||||
{
|
||||
[Key(0)] public int EquipmentIndex;
|
||||
[Key(1)] public int BehaviorIndex;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public class SavedActionBarWeaponGroupBinding : SavedActionBarBinding
|
||||
{
|
||||
[Key(0)] public int Group;
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8996ce0796b84c50afbadabb5edc4c6c
|
||||
timeCreated: 1615670570
|
||||
|
|
@ -29,6 +29,8 @@ local CultCache, and legacy UI paths should be migration-only or deleted.
|
|||
`GameData/NameFile/*.msgpack` as migration/catalog inputs. The old
|
||||
`PlayerSettings.msgpack`, `.loadout`, `.zone`, and
|
||||
`GameData/KeyboardLayouts/*.msgpack` authority paths are disabled or deleted.
|
||||
The old `SavedGame`/`SavedZone` DTOs and `Galaxy` save-loader constructor are
|
||||
deleted.
|
||||
- `Economy.Server` now starts the modern `Aetheria.State` CultMesh node and no
|
||||
longer owns RethinkDB/LiteNetLib state.
|
||||
- The old IMGUI DB inspector under `Assets/Scripts/CultCache/Editor/` has been
|
||||
|
|
@ -186,6 +188,7 @@ First Aetheria surfaces to publish:
|
|||
- Done: delete the broken `Economy.Shared` wrapper and tracked build output.
|
||||
- Done: disable legacy local save, loadout, zone, player-settings, keyboard
|
||||
layout, DB inspector, and NameFile export writers.
|
||||
- Done: delete the old `SavedGame`/`SavedZone` runtime save DTO and loader.
|
||||
- Remaining: delete or quarantine old cache abstractions that no longer
|
||||
protect an invariant once catalog migration has a typed reader.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue